bitshares1-core
bitshares1-core copied to clipboard
Test shorts to be forced to cover at up to 110% of price feed
This will allow them to walk the book and not be fully protected by the price feed. The short squeeze will also motivate more orders at higher prices to increase the probability of having some liquidity during a major squeeze.
Upon reviewing the code it already appears to be implemented and active. Updating task to provide unit test that verifies this is the case and works as intended.
Commit addb736d7c0203625b34e303d16f759ec57367bf is highly relevant (despite referencing another issue in the commit message). It makes the "plus ten percent" rule only apply to margin calls, not expired positions.
This is my first ever post on github, so thanks for the worm welcome :) and excuse me if I am posting this in not the most appropriate place/thread! Having cover orders being essentially market orders, opens the system to front-running. Having the forced cover order made to cover up to 0.9 * feed price, makes it particularly bad, although running is possible in front of expired cover orders as well.
Delegate example: Just in the block that the feed becomes < call price of a particular cover order; the delegate sneaks in an ask order(s), matching the highest bids (up to the just triggered cover amount of bitAssets) and place a bid for the same amount (of bitAsset) just above the next highest bid (if any bids in the feed-0.9 * feed range) or at the 0.9 * feed price if no other bids.
PS I hope I got something wrong here.
Internally shorts are on the bid side and margin calls are on the ask side, so internal is backwards relative to what you're saying. Basically the front runner uses his XTS stock to clear out anyone offering to buy the collateral, then he bids on the collateral at the lowest price the called position can accept (which will match because everyone else has been cleared out). Replenishing the XTS stock at below-market rates.
The value for this attack ultimately comes from the margin called position. Which ultimately means people should (possibly partially) cover their positions before they are in danger of being called.
I guess what I'm saying is it's no danger because shorts can easily avoid the margin call by keeping adequate collateral / covering.
There's also the question of how this will interact with black swans.
Suppose I short $300 at $0.03 / XTS with 20,000 XTS, initial collateral (including buyer's 10,000 XTS) would be 30,000 XTS. I'm insolvent if $300 is worth more than 30,000 XTS, which occurs at $0.01 / XTS.
The question is, if the feed is $0.0105 XTS, the effective liquidation price is 0.9 * $0.0105 = $0.00945, I might match order(s) between $0.00945 and $0.01 and nothing higher. Should the market engine trigger a black swan, or ignore the match?
The value of this attack comes from the fact that we have market orders now. Margin call orders are buying at the best price available, in general. The front runner is buying the best offers before them and replacing those orders with the best/worst proposition the market can bare.
I personally do not have any clear cut solution to prevent that - but: 1st we should be fully aware of that and not claim our 'get what you asked for' idea is anymore true how our system works at all times. And so our system preventing front running [in all cases] is no longer the case. 2nd Keeping in mind the 1 above. Should we at all go through all the trouble to make the life of the customers more miserable with those rules of ours if we cannot truly prevent front running????
On Mon, 2/9/15, theoreticalbts [email protected] wrote:
Subject: Re: [bitshares] Test shorts to be forced to cover at up to 110% of price feed (#1277) To: "BitShares/bitshares" [email protected] Cc: "tonyk2" [email protected] Date: Monday, February 9, 2015, 1:50 PM
Internally shorts are on the bid side, so internal is backwards relative to what you're saying. Basically the front runner uses his XTS stock to clear out anyone offering to buy the collateral, then he bids on the collateral at the lowest price the called position can accept (which will match because everyone else has been cleared out). Replenishing the XTS stock at below-market rates.
The value for this attack ultimately comes from the margin called position. Which ultimately means people should (possibly partially) cover their positions before they are in danger of being called.
— Reply to this email directly or view it on GitHub.
Check this:
blockchain_list_market_transactions 2018471
The feed_price
was around 0.009 USD per BTS at that time, execute price of that order is 0.007 which is much lower than feed_price * 90%
.
//Edit: it's a match between short_order and ask_order, not related to this issue.
That would make sense if there was no other short with a higher interest rate than the one matched in that tx.
This is due to a) shorts being preferred over normal bids independent from their limit price, and b) shorts with higher apr being preferred over those with lower apr. I think that will be resolved with splitting shorts into two queues, one executing at the price feed and one executing at their limits.
But that's somewhat off-topic in this issue here.
blockchain_list_market_transactions 2031473 //Edit: it's a match between short_order and ask_order, matched price is 0.4 and feed_price is about 0.55. So it's not related to this issue.
Continuing with the hijack, the behavior abitmore pointed out seems strange to me so I double-checked the feed numbers and they're correct: the feed for USD at block 2018471 was exactly 0.0091352683688564196, and CNY at block 2031473 was exactly 0.056047231337173431, according to blockchain_list_feed_prices (both are the same as their value in the previous block, in case that's what the market engine uses)