-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BSIP 35: Mitigate Rounding Issue On Order Matching #59
Conversation
I wonder if it's better to separate the solution for force settlement order into a new BSIP, since it's a bit more controversial than others, by putting it to a new BSIP would be easier for us to push other solutions forward. |
Very good bsip and easy to follow. This:
... I agree with. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solit bsip. Good proposal.
Only missing aspect is the shareholder summary.
@xeroc If I'm correct share holder summary is not a must. After this draft listed in the main page we can start stake based voting, although if you as an important proxy don't agree it won't pass, in this case can you help revise the solution, or start a discussion somewhere? |
Actually there is a serious issue in this BSIP. When matching a taker limit order and a margin call order, if |
I think we need to round up the paying collateral to 1 Satoshi in this case. |
Here came more thoughts about settle orders. A settle order may suffer something-for-nothing issue when
We need to react differently for these scenarios. IMHO,
|
## The Chosen Solution | ||
|
||
Current code actually implemented (a) in the first place: when matching two | ||
orders, if there is a rounding issue, the order with smaller volume will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please specify how order volumes are compared to determine which is "smaller".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The something-for-nothing issue exists as well when force settling against the global settlement fund (force settling after the asset has been globally settled, e.g. after a black swan event). Code:
//Update: |
Add description for the old total supply rule (no change).
Something-for-nothing is only a subset of rounding issues, it's the most extreme one. There are other scenarios that one of the matched parties would be paying more than enough, although they're not paying something for nothing overall. There are discussions in bitshares/bitshares-core#342. I got an idea about how to mitigate the rounding issue, but wonder if it's better to add it to this BSIP (or even replaces this BSIP), or write it as another BSIP. The principle would be: never pay more than enough when matching orders. Nevertheless, by paying "enough", it's possible that the party still need to pay more than preferred. Current code writes (comment added by me):
It can be explained as: when
Take a scenario similar to the one described in the 4th comment of bitshares/bitshares-core#132 as an example:
The original process would be:
Both results are far from Alice's desired price The revised process would be:
Both results are still below Alice's desired price Above are processes about processing limit orders. After get |
Changed this BSIP to an overall solution for rounding issues, so it will also resolve bitshares/bitshares-core#342. Title changed accordingly. |
Outstanding description of a complicated issue! The enumeration of the various combinations of order types was very helpful to me. I like the idea of canceling orders that are predicted to be "too small" to be fulfilled in the future. But how can "too small" be determined? Is the answer, "when any future matching would result in a "something-for-nothing" scenario"? |
Example 2 had me wonder about something. Could there be a way for someone to make a black swan more likely by borrowing such a tiny amount (perhaps with a tiny amount of collateral?) that black swans could more easily be triggered during a market downturn? (Even if my concern is real, perhaps it is not a situation that is introduced by the proposed solution.) |
Yes. Only need to check if its |
The black swan scenario introduced in example 2 is not due to amount too small, but due to collateral ratio too low. Tiny call orders are more likely to be filled when entered margin call territory. By the way, the scenario won't happen after BSIP 32 is implemented. |
BSIP for bitshares/bitshares-core#132 and bitshares/bitshares-core#184.
//Update: changed this BSIP to an overall solution for rounding issues, so it will also resolve bitshares/bitshares-core#342. Title changed accordingly.