Author Topic: A proposal to update the margin call process  (Read 6538 times)

0 Members and 1 Guest are viewing this topic.

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
BSIP 38 waiting for review: https://github.com/bitshares/bsips/pull/70 (add target CR option to short positions)
BitShares committee member: abit
BitShares witness: in.abit

Offline Thul3

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
I would also add a USD/BTS colletaral ratio function based on amount so it would be less possible to get these kind of big margin calls.Means as higher the amount of collateral as higher the ratio to lower the risk to get margin called.
Bitcraps margin call was a good example how his margin call sucked out all the bitUSD from the market.
Each and every coin was at least 10% cheaper than on other exchanges.And there was no possibility and liquidity to get funds
from external exchanges to buy these margin calls without loosing money.
Since Margin Call was offered 10% under settlement price and all coins had already a 10% lower price than on external exchanges there was no way to transfer liquidity to DEX without making a loss on that trading.
So the main intention to get the margin call quickly eaten by a lower price of 10% is only valid for margin calls to a certain seize.
DEX has till today a lack of liquidity of bitUSD which you can see that most coins are still 5% cheaper than on external exchanges.

I also agree that only the amount of BTS should be offered for sale on a margin call which is enought to get all colletreal back to minimal Ratio + 0.xx

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
About the stop-loss options and etc, I just started a discussion about a new BSIP: https://github.com/bitshares/bsips/issues/51 , please participate.

It is a new feature, no BSIP, no voting by stake holders, won't be implemented.
BitShares committee member: abit
BitShares witness: in.abit

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
Sorry, but OP proposal is a piece of shit.

Quote
I think it's possible to implement a mechanism that only minimum required collateral is sold

This is how it should work. It is a simple math, damn it!

If that second parameter can be optionally set by the user when creating the position (e.g. must be 2.00 or higher), you have both options and you dont kill the logic of existing positions (they would be handled as a position with the parameter left blank)

If going this way, it would be a bigger change, need more discussion. UI need to adapt as well.

And remove short squeeze protection to prevent global settlements.
You can vote for witnesses those are feeding a value that you like.

IMO we shouldn't make the margin call algorithm more complicated than necessary. Just match full orders until the call price is safe again.
Debatable.
It's not too complicated to implement "selling only required collateral".


target_CR = new_collateral / ( new_debt * feed_price )
          = (collateral - amount_to_sell) / (debt - amount_to_get) / feed_price
          = (collateral - amount_to_sell) / (debt - amount_to_sell / (feed_price * (1 - MSSR))) / feed_price
=>
amount_to_sell = (collateral - debt * feed_price * target_CR) * (1 - MSSR) / (1 - MSSR - target_CR)


Assuming feed_price is in terms of debt / collateral, e.g. how much CNY per BTS
Code: [Select]
target_CR = new_collateral / ( new_debt / feed_price )
          = ( collateral - amount_to_sell ) * feed_price / ( debt - amount_to_get )
          = ( collateral - amount_to_sell ) * feed_price / ( debt - amount_to_sell * (feed_price / MSSR) )
=>
amount_to_sell = (debt * target_CR - collateral * feed_price) * MSSR / (target_CR - MSSR) / feed_price
« Last Edit: March 05, 2018, 01:34:30 pm by abit »
BitShares committee member: abit
BitShares witness: in.abit

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
I think that hurts the BTS price when the whole market is going up. Clever traders can bet on the markets rising (all cryptos are connected in that somehow) and simply buy the whole margin call order without driving up the BTS price accordingly, which is bad for all BTS holders.

When BTS is going up it is unlikely that there are any margin calls that could be "exploited" like this. Also, the volume of buying up a single margin call will usually be too low to influence the price one way or another.

IMO we shouldn't make the margin call algorithm more complicated than necessary. Just match full orders until the call price is safe again.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline yvv

  • Hero Member
  • *****
  • Posts: 1186
    • View Profile
Sorry, but OP proposal is a piece of shit.

Quote
I think it's possible to implement a mechanism that only minimum required collateral is sold

This is how it should work. It is a simple math, damn it! And remove short squeeze protection to prevent global settlements.


Offline sschiessl

  • Administrator
  • Hero Member
  • *****
  • Posts: 662
    • View Profile
  • BitShares: sschiessl
This issue will be addressed by fixing https://github.com/bitshares/bitshares-core/issues/343 .

In short,
* always update the call price after a short position got partially margin called, and
* always start matching from position with least collateral ratio.

With this logic, if a big position is partially called by a small limit order, the position will leave on the book with higher call price. It can still be fully called by a big limit order though, which is at same risk as small positions.

This will very likely resolve most of the issues, yet one enables to buy the whole margin call. I think that hurts the BTS price when the whole market is going up. Clever traders can bet on the markets rising (all cryptos are connected in that somehow) and simply buy the whole margin call order without driving up the BTS price accordingly, which is bad for all BTS holders.

I think some mechanic should be added to avoid buying the whole order if a collateral ratio of e.g. 2.00 can be achieved by partial selling (of course making sure in the formula that you can buy the whole order if the ratio is e.g. less than 1.5 or something). I would be happy to support working out a proper mechanics for this issue if there is agreement. Nevertheless, just fixing the above issue is also very beneficial.
I think it's possible to implement a mechanism that only minimum required collateral is sold, to archive a given collateral ratio, the MCR (175%), or perhaps another parameter that a little more than MCR to avoid dust data (orders/fills).

However, under certain circumstances (to stop loss for example) traders want to be fully magin called and/or don't want the call price to be updated. The demands are fair to some extent.

So, this is a serious question: what mechanism is better for the ecosystem? I'm not sure so far.

If that second parameter can be optionally set by the user when creating the position (e.g. must be 2.00 or higher), you have both options and you dont kill the logic of existing positions (they would be handled as a position with the parameter left blank)
« Last Edit: February 05, 2018, 12:08:49 pm by sschiessl »

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
This issue will be addressed by fixing https://github.com/bitshares/bitshares-core/issues/343 .

In short,
* always update the call price after a short position got partially margin called, and
* always start matching from position with least collateral ratio.

With this logic, if a big position is partially called by a small limit order, the position will leave on the book with higher call price. It can still be fully called by a big limit order though, which is at same risk as small positions.

This will very likely resolve most of the issues, yet one enables to buy the whole margin call. I think that hurts the BTS price when the whole market is going up. Clever traders can bet on the markets rising (all cryptos are connected in that somehow) and simply buy the whole margin call order without driving up the BTS price accordingly, which is bad for all BTS holders.

I think some mechanic should be added to avoid buying the whole order if a collateral ratio of e.g. 2.00 can be achieved by partial selling (of course making sure in the formula that you can buy the whole order if the ratio is e.g. less than 1.5 or something). I would be happy to support working out a proper mechanics for this issue if there is agreement. Nevertheless, just fixing the above issue is also very beneficial.
I think it's possible to implement a mechanism that only minimum required collateral is sold, to archive a given collateral ratio, the MCR (175%), or perhaps another parameter that a little more than MCR to avoid dust data (orders/fills).

However, under certain circumstances (to stop loss for example) traders want to be fully magin called and/or don't want the call price to be updated. The demands are fair to some extent.

So, this is a serious question: what mechanism is better for the ecosystem? I'm not sure so far.
BitShares committee member: abit
BitShares witness: in.abit

Offline sschiessl

  • Administrator
  • Hero Member
  • *****
  • Posts: 662
    • View Profile
  • BitShares: sschiessl
This issue will be addressed by fixing https://github.com/bitshares/bitshares-core/issues/343 .

In short,
* always update the call price after a short position got partially margin called, and
* always start matching from position with least collateral ratio.

With this logic, if a big position is partially called by a small limit order, the position will leave on the book with higher call price. It can still be fully called by a big limit order though, which is at same risk as small positions.

This will very likely resolve most of the issues, yet one enables to buy the whole margin call. I think that hurts the BTS price when the whole market is going up. Clever traders can bet on the markets rising (all cryptos are connected in that somehow) and simply buy the whole margin call order without driving up the BTS price accordingly, which is bad for all BTS holders.

I think some mechanic should be added to avoid buying the whole order if a collateral ratio of e.g. 2.00 can be achieved by partial selling (of course making sure in the formula that you can buy the whole order if the ratio is e.g. less than 1.5 or something). I would be happy to support working out a proper mechanics for this issue if there is agreement. Nevertheless, just fixing the above issue is also very beneficial.

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1928
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
This issue will be addressed by fixing https://github.com/bitshares/bitshares-core/issues/343 .

In short,
* always update the call price after a short position got partially margin called, and
* always start matching from position with least collateral ratio.

With this logic, if a big position is partially called by a small limit order, the position will leave on the book with higher call price. It can still be fully called by a big limit order though, which is at same risk as small positions.

great, in my view this issue should be give the highest priority to solve, the current process give manipulators big chance to short BTS and make money and increase the risk of black swan, all this hurt the BTS ecosystem greatly.

@abit please ask me to attend the test afte development.
« Last Edit: February 05, 2018, 05:22:05 am by bitcrab »
Email:bitcrab@qq.com

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
This issue will be addressed by fixing https://github.com/bitshares/bitshares-core/issues/343 .

In short,
* always update the call price after a short position got partially margin called, and
* always start matching from position with least collateral ratio.

With this logic, if a big position is partially called by a small limit order, the position will leave on the book with higher call price. It can still be fully called by a big limit order though, which is at same risk as small positions.
+5%

Offline KenMonkey

  • Full Member
  • ***
  • Posts: 112
    • View Profile
  • BitShares: kmnk
Ugh understanding bitshares economics is hard. And then it's up to the stakeholders to vote correctly. We need to be smart and we need to have good explanations.

Any ideas on this?

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
This issue will be addressed by fixing https://github.com/bitshares/bitshares-core/issues/343 .

In short,
* always update the call price after a short position got partially margin called, and
* always start matching from position with least collateral ratio.

With this logic, if a big position is partially called by a small limit order, the position will leave on the book with lower call price (in terms of debt/collateral, e.g. how much CNY per BTS). It can still be fully called by a big limit order though, which is at same risk as small positions.
« Last Edit: March 05, 2018, 10:58:26 am by abit »
BitShares committee member: abit
BitShares witness: in.abit

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
IMO it's a bad idea to split one short into two, because the lower collateralized one is more likely to cause a black swan.

But I agree that it is not really required the the whole position is margin called. In fact I think the current implementation is flawed in that regard. It would normally be sufficient to sell *some* of the collateral to cover the debt. As long as the price is better than the collateral ratio (CR) of the short position, the CR will improve through such trades, and can eventually move out of margin call territory. At this point, the short position should no longer automatically buy back the debt. The current implementation continues to do so. This should be fixed.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline sschiessl

  • Administrator
  • Hero Member
  • *****
  • Posts: 662
    • View Profile
  • BitShares: sschiessl
I agree that big margin calls have a significant impact on the market, there is room for improvement.
Are there any mechanics in the fiat world to learn from / compare to?

Anyways, I like your approach, but.it.seems overly complicated, but maybe there is thought in it that I can't grasp yet, I am in no position to qualify your proposal. Could you explain more why you wanted two parameters?

Anyways, the first thought that came to my head is to introduce a fallback collateral ratio (can be set optional by the user when creating the position, to not break existing logic, must be e.g. 1.85 or higher) . The mechanic would be as follows:
 If a position is margin called, an order is placed to sell as many BTS as needed to reduce the debt, such that the position has a collateral ratio higher or equal to the fallback ratio after the sale.
This introduces also a implicit reserve and enhance part but utilizes only one parameter.
« Last Edit: February 04, 2018, 03:49:32 pm by sschiessl »