bitshares / bsips

BitShares Improvement Proposals and Protocols. These technical documents describe the process of updating and improving the BitShares blockchain and technical ecosystem.
https://bitshares.github.io
63 stars 86 forks source link

New BSIP: Implement Buy Limit Order #38

Open abitmore opened 6 years ago

abitmore commented 6 years ago
BSIP: <BSIP number>
Title: Implement Buy Limit Order
Authors: Abit More
Status: Draft
Type: Protocol
Created: 2017-11-02
Discussion: https://github.com/bitshares/bitshares-core/issues/342
Replaces: <BSIP number> (optional)
Superseded-By: <BSIP number> (optional)
Worker: <Id of worker proposal> (optional)

Abstract

By now, in BitShares, since all markets are flip-able, all limit orders are implemented as sell limit orders. When a user placing a buy order via GUI, actually it's placed as a sell order in the flipped market. Although usually a flipped sell order is very close to a buy order, their behaviors are a bit different, as a result, this has led to some confusion. This BSIP proposes a protocol change to address this issue.

Motivation

Make the exchange more user-friendly.

Rational

A typical exchange should have both buy limit order and sell limit order with different behavior.

Specifications

[WIP]

A limit sell order means a user set a minimum price and an exact amount of one asset (which she owns) to sell, expecting all of them to be bought, and expecting to get at least amount*price of the other asset (which she doesn't have). It's expected and acceptable that she will get more than she wanted when there are better offers in the market.

A limit buy order means a user set a maximum price and an exact amount of one asset (which she doesn't have) to buy, and willing to pay at most amount*price of the other asset (which she owns). It's NOT acceptable if she finally got more than she wanted, instead, it's expected and acceptable that she will pay less when there are better offers in the market. When the order is partially filled, if the remaining fund is not enough to pay for the rest desired amount on next match, the order should be cancelled.

All above are talking about taker orders, when placing the order, there may be better offers on the order book already. For maker orders, usually the owner won't get a better offer, unless caused by rounding.

Discussion

Summary for Shareholders

Copyright

This document is placed in the public domain.

See Also

oxarbitrage commented 6 years ago

I had an idea on my mind since a while on writing a BSIP on how we can support the following basic order types:

If this BSIP goes forward we will be able to artificially create the STOP missing order types by flipping markets however i didn't went into the details to check if that will work.

Maybe we can extend this BSIP to consider this types.

abitmore commented 6 years ago

Buy limit orders will be more useful after we have grouped orders feature.