Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 3.93 KB

bsip-0062.md

File metadata and controls

65 lines (43 loc) · 3.93 KB
 BSIP: 0062
 Title: Close margin position 
 Authors:
   Stefan Schießl stefan.schiessl@blockchainprojectsbv.com
   Jerry Liu bitcrab@qq.com
 Status: Approved
 Type: Protocol
 Created: 2019-09-14
 Worker: 1.14.228

Abstract

Closing a short position comes with a risk of getting margin called if no spare funds are available to buy the long and reduce the debt to zero. This BSIP introduces a way to put the short position directly on the market.

Rationale

Closing a short position with a healthy CR should come with no risk of getting margin called. Currently a user, who has no spare funds, has to take out collateral from the short position in order to put it on the market. Reducing the collateral increases the risk of margin call. This is especially cumbersome and risky if you want to close a position that has CR close to MCR (in that case you can only take out a small amount of collateral, sell it, reduce debt, repeat until position closed).

Specification

Introduce a way that user can directly place orders to sell collateral in a margin position, and the received SmartCoins will be used to reduce the debt automatically.

We introduce a direct collateral sell order and a manual margin call. Recommendation to the core team is to implement one of them for the upcoming hard fork, and the other one for the following one.

Direct collateral sell order

User needs to define the amount to sell and the amount to receive while placing the order. The amount to receive must be equal or less than the debt amount, and the price must be less than the current collateral ration times feed price (ensurance that the margin positions collatearl ratio will not be reduced after the filling of the sell orders).

Remarks:

  1. No creation fee refund when the order is cancelled.

  2. The order should be cancelled automatically if the asset is globally settled.

  3. The order should be cancelled automatically if the position is manually closed.

  4. If the order wants to sell more collateral than it has left (due to margin called, force settled or debt position updated), only allow to fill this order up to the actually available collateral (this may be realized by shrinking the actual values in the limit_order object, or through calculation logic when trying to match).

  5. If the order is asking for more than its debt (due to margin called, force settled or debt position updated), only allow to fill this order up to the actually needed debt (this may be realized by shrinking the actual values in the limit_order object, or through calculation logic when trying to match).

  6. fill_or_kill can be set just like for a normal limit order

  7. expiration must be defined

Manual margin call

User needs to specify the manual margin call price ratio (value must be positive, and a value of 1 represents the feedprice) that will be used to calculate the sell price depending the feed price, and a manual margin call will be created that follows the logic of a margin call, except that the price is calculated from the user-defined percent instead of MSSR.

Discussion

Another process logic is also possible when a debt position is margin called or margin call orders change with close short orders,system check whether the margin call conflict with the close short orders via a defined logic, if yes than delete all the close short orders and place margin call orders, if not just place margin call orders without deleting the close short orders.

This logic bring better user experience but also complexity. it is also a good choice if the complexity is acceptable from developer's perspective.

References

Copyright

This document is placed in the public domain.

Voting outcome

Approved since December 2019. image