I have a few proposed tweaks.
First I will make a note of five main queues:
- Regular call queue
- Margin call queue
- Activated redeem queue
- Sell queue
- Buy queue
A short position has a grace period G (e.g. G = 14 days) during which it is not callable unless margin called. If the collateral ratio of a short position is below the margin call ratio limit M (e.g. M = 175% = 1.75), it will be placed in the margin call queue. If a short position does not belong in the margin call queue but it has existed for longer than the grace period, it is placed in the regular call queue. Both the regular call queue and margin call queue are ordered in ascending collateral ratio order (meaning the head of each queue is the short position that has a lower collateral ratio than any other short position in the same queue).
The buy queue contains all the orders that want to buy the BitAsset by selling its corresponding collateral asset (e.g. BTS). This is actually a virtual queue that encompasses all the other real buy queues such as the ones for absolute buy orders and relative (to the price feed) buy orders. The sell queue contains all the orders that want to sell the BitAsset for the corresponding collateral asset. It too is actually a virtual queue that encompasses all the other real sell queues such as the ones for absolute sell orders, relative sell orders, absolute short orders, relative short orders, and unactivated redeem orders.
An unactivated redeem order is very similar to a relative sell order except that its offset is restricted to be no greater than -1% (meaning offering the order at a price no better than 99% of the price feed). Once an unactivated redeem order has existed continuously for an X period (e.g. X = 48 hours), it is promoted to an activated redeem order.
The buy queue is in descending price order. The sell queue and activated redeem queue are in ascending price order.
Matching rules are as follows:
- If the activated redeem queue is not empty, first attempt matching the head of the activated redeem queue with the order with the highest bid from the set of orders composed from the head of the buy queue and margin call queue (all margin call queue items offer a limit bid price up to Y fraction above the feed price, where Y is a monotonic function of the collateral ratio, e.g. Y = 20% * (1 - (COLLATERAL_RATIO - 1)/(M-1))^2 ). If there was a (partial) match, repeat with the new set of heads until there is no match anymore. If the activated redeem queue is still not empty at that point (which, by the way, indicates that the margin call queue must be empty), match the head of the activate redeem queue with the head of the regular call queue (this will guarantee a match as long as the regular call queue is not empty) until either the activated redeem queue is empty or the regular call queue is empty.
- Attempt matching the order with the highest bid from the set of orders composed from the head of the buy queue and margin call queue with the head of the sell queue. Repeat until no more matches are possible.
A short order has no price restriction. However, the short order has to provide the initial collateral ratio it wants to match with and the blockchain requires that this ratio is not less than the margin call ratio limit imposed by the BitAsset (a reasonable value for the margin call ratio limit, for now, might be something between 150% and 180%). So if the margin call ratio limit for the BitAsset was set to 175%, the short order could specify an initial collateral ratio of 175%, but then the risk of margin call would be insanely high, so perhaps the short seller would choose a more sensible initial collateral ratio of 190%.
Black swan liquidation rules still exist and are triggered when the collateral ratio of any short position falls below 100%.
Finally, the mechanism that triggers forced settlement of all longs with shorts needs to be made more concrete. How exactly do we determine whether BitUSD asks are not fair and also not fair for a long enough period of time (30 days?) to justify triggering the forced settlement? I'm still thinking about the details of this one, but would love to hear what you suggest.