From c6dbe1880e0250212729339977de0d54077d8bc6 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 17 Feb 2018 00:33:15 +0000 Subject: [PATCH] Add BSIP 33 --- bsip-0033.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 bsip-0033.md diff --git a/bsip-0033.md b/bsip-0033.md new file mode 100644 index 0000000..4b44795 --- /dev/null +++ b/bsip-0033.md @@ -0,0 +1,82 @@ + BSIP: 0033 + Title: Maker Orders With Better Prices Take Precedence + Author: Abit More + Status: Draft + Type: Protocol + Created: 2018-02-17 + Discussion: https://github.com/bitshares/bitshares-core/issues/625 + Replaces: - + Worker: To be done + +# Abstract + +Currently, when matching taker limit orders with maker limit orders, the maker +limit orders with better prices will always be matched first. + +For example, if trader A has a limit order selling 100 BTS at +0.1 USD per BTS, trader B has a limit order selling 100 BTS at 0.09 USD per BTS, +which means B's limit order has a better price for the opposite side to buy. +Now if trader C placed an order that buys 10 BTS at 0.105 USD per BTS, B's +limit order will take precedence, A's limit order won't be matched. + +However, when there are margin call orders in the market which have met the +requirements that to be matched, they always take precedence over limit orders +on the same side, no matter whether the limit orders provided better price. + +For example, if trader A's margin call order is selling 100 BTS at no less than +0.1 USD per BTS, trader B has a limit order selling 100 BTS at 0.09 USD per BTS, +which means B's limit order has a better price for the opposite side to buy. +Now if trader C placed an order that buys 10 BTS at 0.105 USD per BTS, A's +margin call order will take precedence, B's limit order won't be matched. That +means C is forced to "buy high" when have chance to "buy low". + +This BSIP proposes a mechanism to change this behavior to: always match taker +orders with maker orders with better prices first. + +# Motivation + +Make the exchange system more user-friendly. + +# Rational + +To attract more users, the system should be fair. + +It's common sense that, in a continuous trading market, new orders should be +matched with the orders on the opposite side which offerred best prices first. + +# 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". + +New limit order is being processed in `apply_order(...)` function of `database` +class. + +Currently, in the function, firstly call orders will be checked and matched. +After that, limit orders on the opposite side will be checked and matched. + +Need to change the logic to: +* match the new limit order with limit orders on the opposite side whose price + is below MSSP first, +* if the new order is still there, match it with call orders, +* if the new order is still there, match it with rest limit orders. + +# 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/625 +* https://bitsharestalk.org/index.php?topic=25926.0