Skip to content
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

BSIP62: Close Margin Position #211

Merged
merged 10 commits into from
Sep 30, 2019
Merged

BSIP62: Close Margin Position #211

merged 10 commits into from
Sep 30, 2019

Conversation

bitcrab
Copy link
Contributor

@bitcrab bitcrab commented Sep 14, 2019

No description provided.

@ryanRfox
Copy link
Contributor

Please add the Issue to the Discussion heading: #156

@sschiessl-bcp
Copy link
Collaborator

sschiessl-bcp commented Sep 16, 2019

@abitmore @bitcrab

from the mechanics, would it make sense to additionally allow that the user defines "sell X of the collateral, and set the price dynamically (like a real margin position) Y% below feed price (Y > 0)"?

@abitmore
Copy link
Member

@sschiessl-bcp a dynamic price or a user-defined MSSR is "good to have" to me, but I think it would complicate the implementation (see also #51).

@sschiessl-bcp
Copy link
Collaborator

sschiessl-bcp commented Sep 17, 2019

@sschiessl-bcp a dynamic price or a user-defined MSSR is "good to have" to me, but I think it would complicate the implementation (see also #51).

I would like to include it in this BSIP, with a note to postpone it to the second next protocol upgrade. Feasible or weird? For me personally, dynamic price makes the most sense.

bsip-0062.md Show resolved Hide resolved
bsip-0062.md Outdated Show resolved Hide resolved
bsip-0062.md Outdated Show resolved Hide resolved
bsip-0062.md Outdated Show resolved Hide resolved
bsip-0062.md Outdated Show resolved Hide resolved
@abitmore
Copy link
Member

abitmore commented Sep 19, 2019

No creation fee refund when the order is cancelled.

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

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

The order should be cancelled automatically when remaining collateral in the position is less than the amount selling in the order.

  • This can happen when an order is placed but then collateral price fell below the order's price and the position is partially margin called.
  • This can also happen when the position is manually adjusted.
  • This can also happen when the position is force-settled.

What if the order is asking for more than its debt, due to margin called or debt position updated?

  • If "asking for more" is not allowed, how to deal with the order? Cancel it or shrink it?
  • If "asking for more" is allowed, should we fully fill it, or only fill the amount it borrowed then cancel the remainder? Not cancelling the remainder means to turn the order into a normal limit order. Perhaps make this an option, because perhaps some traders want it, but others don't want it. Technically this option's name is "Reduce-only".

Will the order has an expiration too? And what about fill_or_kill?

bsip-0062.md Outdated Show resolved Hide resolved
bsip-0062.md Outdated Show resolved Hide resolved
@ryanRfox ryanRfox changed the title Create bsip-0062.md BSIP62: Close Short Position (working title) Sep 19, 2019
bsip-0062.md Outdated Show resolved Hide resolved
@sschiessl-bcp
Copy link
Collaborator

All comments up till now have been addressed, resolved where possible. Please have a look!

@sschiessl-bcp
Copy link
Collaborator

sschiessl-bcp commented Sep 26, 2019

Considering the mentioned edge cases I am still wondering if it would not be easier to merely re-use existing margin call logic.

Either way, I have added it to the BSIP

@abitmore
Copy link
Member

abitmore commented Sep 26, 2019

merely re-use existing margin call logic.

It looks like that we can reuse the logic, but not that simple when coding. I agree to add it to the BSIP though, if it's too hard to efficiently implement it , we can leave it out in the first release.

sschiessl-bcp
sschiessl-bcp previously approved these changes Sep 26, 2019
@sschiessl-bcp sschiessl-bcp changed the title BSIP62: Close Short Position (working title) BSIP62: Close MArgin Position Sep 26, 2019
@sschiessl-bcp sschiessl-bcp changed the title BSIP62: Close MArgin Position BSIP62: Close Margin Position Sep 26, 2019
@sschiessl-bcp
Copy link
Collaborator

@abitmore please approve if you agree this is ready for voting.

bsip-0062.md Outdated Show resolved Hide resolved
@ryanRfox ryanRfox merged commit d5169b7 into bitshares:master Sep 30, 2019
@shulthz
Copy link

shulthz commented Dec 18, 2019

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;

@shulthz
Copy link

shulthz commented Dec 19, 2019

If this BSIP didn't charge fees like BSIP74, it will become very foolish like before.
Market will prove it in the future.

@sschiessl-bcp
Copy link
Collaborator

I see no reason not too include it as well, can be added to BSIP74 specification.

@shulthz
Copy link

shulthz commented Dec 19, 2019

I see no reason not too include it as well, can be added to BSIP74 specification.

Maybe.
But this BSIP is very different with BSIP74, in some case, they are against, i think BSIP62 not only need MCFR fees, but also need some Liquidity penalty fee, as BSIP62 consume the depth and liquidity of BSIP74 advance.
If no margin call in the market, nobody want to use it, if somebody want to use it, that's mean there will have a quick market volatility, he want to close his position in the market quickly, that's mean he will consume the depth and liquidity of the market advance, other margin call will not have enough liquidity and depth, if he can't close his position all, he will make a lower price than margin call price make sure the market can consume it all, that's very dangerous.

BSIP74 should have a function of share fees, as this, the Liquidity penalty fee of BSIP62 must adapt with the proportion of share fees.

BSIP62 fees will be: MCFR * quantity * (1+share proportion),

e.g.

if BSIP74: MSSR=1.10, MCFR=0.10, share proportion=20%,

so BSIP62 fees will be: MCFR * quantity * (1+0.2)

BOB in BSIP74, will sell 100 bts out, and pay 10 bts fees, share 2 bts to the buyer, system got 8 bts.

BOS in BSIP60, will sell 100 bts out, and pay 12 bts fees, system will get 12 bts.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants