bitshares / bsips

BitShares Improvement Proposals and Protocols. These technical documents describe the process of updating and improving the BitShares blockchain and technical ecosystem.
https://bitshares.github.io
63 stars 86 forks source link

BSIP62: Close short position (i.e. manual margin call) #156

Closed sschiessl-bcp closed 4 years ago

sschiessl-bcp commented 5 years ago
BSIP: 0062
Title: Close short position (i.e. manual margin call)
Authors:
  Stefan Schießl <stefan.schiessl@blockchainprojectsbv.com>
Contributors and Reviewers:
  Jerry Liu bitcrab@qq.com
Status: Draft
Type: Protocol
Created: 2019-03-28
Discussion: https://bitsharestalk.org/index.php?topic=28211.0
Worker: Unpaid

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.

Specification

Introduce a way that triggers something similar to a margin call. The user defines:

The price must be restricted such that the CR is not reduced when orders are matched against it. The order must appear as a normal order on the order book and not as a margin call. If the position is in a state of being margin called, this manual margin call will remain alongside the margin call.

This can be done by adding optional parameters to the update of a short position, or by addition of a new operation that activates the manual margin call (and deactivates on setting amount to 0)

Discussion and Summary for Shareholders

Reducing the risk of a margin call is favorable for the network and the position holder, while there is no risk for the market or long holders in allowing to put the position on the market.

References

sschiessl-bcp commented 5 years ago

Question:

Include in update of short position, or extra operation?

abitmore commented 5 years ago

Also see #129.

sschiessl-bcp commented 5 years ago

Also see #129.

Adjusted the text to include the idea there.

bitcrab commented 5 years ago

it's easy to ensure that the CR is not reduced with close short orders by limiting the selling price >margin call price/MCR.

how to coordinate this close short logic with the margin call logic? in my view the margin call logic should take high priority, means if a position is margin called with "close short" orders, all the close short orders should be deleted and then the margin called orders will be placed.

if necessary(although not very necessary in my view) maybe we can introduce independent MSSR for each position, however independent MSSR should be equal or greater than global MSSR.

how to coordinate this close short logic with adjusting position? seems some pre check is necessary, the updated position should have more collateral than in the close short orders and the close short orders price should >updated margin call price/MCR.

froooze commented 5 years ago

Is this not related to #167 ?

bitcrab commented 5 years ago

I feel the title should be "close long positions", right? when one hold a debt position he is holding a long position of BTS, right?

pmconrad commented 5 years ago

He is short in the debt asset. He may be long in BTS at the same time, but that is irrelevant. (He could have sold the BTS on a CEX for example.)

bitcrab commented 5 years ago

smartcoin is stablecoin, when we do BTS/stablecoin trading, it's reasonable to tell long or short BTS, it's wired to tell long or short stablecoin.

abitmore commented 5 years ago

I think using the term "debt position" is better. MPA is not only for stable coins.

bitcrab commented 4 years ago

hope this can be pushed forward and included in the next HF, as the logic is clear and will greatly help the smartcoin ecosystem.

abitmore commented 4 years ago

The specification needs to be more detailed.

bitcrab commented 4 years ago

updated specitication, not sure whether it is detailed enough, seems more detailed specification should come from developer?

Specification

Introduce a way that user can directly place orders to sell collaterals in a debt position, and the got smartcoins will be used to reduce debt automatically.

User need to define the amount and price while placing the sell orders, and the price should be greater or equal to margin call price/MCR, to ensure the deposit position CR will not be reduced after the filling of the sell orders.

When a debt position is margin called with close short orders, 2 ways are possible to handle this: 1.system delete all the close short orders and place margin call orders. 2.system define a logic to check whether the margin call conflict with the close short orders, if yes than delete all the close short orders and place margin call orders, if not just place margin call orders.

When user adjust the debt position, system will check whether the target debt position conflict with the close short orders, if yes than reject to adjust.

abitmore commented 4 years ago

I think the feature described here is clear enough, although there are many corner cases to consider when implementing. Someone please create a PR?

bitcrab commented 4 years ago

done. https://github.com/bitshares/bsips/pull/211

shulthz commented 4 years ago

If want BSIP62 to become really useful? It must charge the MCFR fees++Liquidity penalty 1%; #164

If someone want to use BSIP62, the system will charge the MCFR fees +Liquidity penalty 1% from the user;

These fees were very important.

sschiessl-bcp commented 4 years ago

Voting outcome: Approved.

image