bsip32: add when to check for black swan event

bsip53
abitmore 2018-02-16 23:41:39 +00:00
parent 8bc2a40e46
commit 2723cc73b6
1 changed files with 23 additions and 0 deletions

View File

@ -51,6 +51,29 @@ 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.
Currently a black swan event will occur when the call order with least
collateral ratio is going to be matched below 100% collateral ratio price
(name it CRP). Because the call order will be matched with incoming limit order
at limit order's price (taker price),
which can be higher or lower than CRP, so even if MSSP is
below CRP, an incoming taker limit order may or may not trigger a black swan.
So it makes sense to check if a black swan event will occur every time when a
limit order is created.
After the behavior changed to always match at maker price, when MSSP is below
CRP, an incoming taker limit order will always trigger a black swan event.
So it makes sense to trigger the black swan event when MSSP is below CRP rather
than waiting for an incoming limit order. That means it's no longer needed to
check for black swan event when a limit order is created. Since checking for
black swan event is somehow expensive, we'll gain a side benefit on performance
with the change.
When triggering a black swan event when MSSP is below CRP, sometimes the short
position with least collateral ratio may still have more than 100% collateral
ratio. In this case, the global settlement price is CRP but not the actual
collateral ratio of the short position with least collateral ratio.
This is current behavior, it's fair, no need to change.
# Discussion
[to be added if any]