bsips/bsip-0032.md

70 lines
2.3 KiB
Markdown
Raw Normal View History

2018-02-16 22:48:21 +00:00
BSIP: 0032
Title: Always Match Orders At Maker Price
Author: Abit More <https://github.com/abitmore>
Status: Draft
Type: Protocol
Created: 2018-02-16
Discussion: https://github.com/bitshares/bitshares-core/issues/338
Replaces: -
Worker: To be done
# Abstract
Currently, under most circumstances, when matching two orders, the maker price
will be used. That said, the order that is placed earlier sets a price,
another order that is placed later accepts the price, thus a match, two orders
pay to each other at that price. For example, if one person (A) placed a limit
order to sell 100 BTS at 0.1 USD per BTS, another person (B) then placed a new
limit order to buy 100 BTS at 0.105 USD per BTS, the two orders will match at
0.1 USD per BTS, so A will pay 100 BTS and get 10 USD, B will pay 10 USD and
get 100 BTS.
However, when matching a taker limit order with a maker margin call order,
the taker price is being used. For example, if trader A's margin call order is
selling 100 BTS at no less than 0.1 USD per BTS, then trader B placed an order
that buys 100 BTS at 0.105 USD per BTS, the two order will match at 0.105 USD
per BTS, so A will pay 100 BTS and get 10.5 USD, B will pay 10.5 USD and get
100 BTS.
This BSIP proposes a mechanism to change this behavior: always match orders
at maker price.
# Motivation
Make the exchange system more user-friendly.
# Rational
To attract more users, the system should be fair.
It's common sense that orders should be matched at maker price.
# Specifications
There is a parameter in price feed named MSSR, which stands for "maximum short
squeeze ratio". Maker price of margin call orders is MSSP, which stands for
"maximum short squeeze price", is calculated as `feed_price / ( 100% + MSSR )`.
Note: `feed_price` here is in terms of debt/collateral, aka "how much debt per
collateral".
Matching between a limit order and a call order is done in
`check_call_orders(...)` function of `database` class, price of limit order
is always used. It need to be changed to use MSSP when the call order is maker.
# Discussion
[to be added if any]
# Summary for Shareholders
[to be added if any]
# Copyright
This document is placed in the public domain.
# See Also
* https://github.com/bitshares/bitshares-core/issues/338
* https://bitsharestalk.org/index.php?topic=25926.0