Author Topic: The market engine is not matching shorts properly  (Read 6021 times)

0 Members and 1 Guest are viewing this topic.

Offline sudo

  • Hero Member
  • *****
  • Posts: 2255
    • View Profile
  • BitShares: ags
With the current market engine, it reverts to normal status. I suppose the new engine will behave in the same way.

Another question: does an expired cover that later gets margin called execute at call price or call price + 10%? In other words, is the priority on expiry or on margin?

I am curious too

Offline svk

With the current market engine, it reverts to normal status. I suppose the new engine will behave in the same way.

Another question: does an expired cover that later gets margin called execute at call price or call price + 10%? In other words, is the priority on expiry or on margin?
Worker: dev.bitsharesblocks

Offline Shentist

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 1601
    • View Profile
    • metaexchange
  • BitShares: shentist
wow,

so a matching bug again. i hope it will get fixed soon. This costs not only me money, but will not get new people in BitShares.

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
With the current market engine, it reverts to normal status. I suppose the new engine will behave in the same way.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline svk

Another question about the mechanics, what happens to a short that gets margin called, but before it fills the call price drops below the margin call price? Does it remain a forced cover, or does it revert to normal status and wait for either another margin call or the expiration date?
Worker: dev.bitsharesblocks

Offline svk

You're right I could sum them, those are all expired orders actually, I forgot about the margin called orders. I was under the impression the 10% above price was a bug, isn't it? Expired orders should be at the feed price though right?

The bug was that expired cover orders had a limit price at 10% above the price feed when it was supposed to be at the price feed. However, margin call cover orders should have a price limit 10% above the price feed.

Thanks for the clarifications, I've worked some more on the wallet this morning and I believe I have it right this time. One thing that I'm unsure about is, what happens to a margin called order that expires before getting filled? Does it stay at +10% price, or does it revert to the feed price? I suppose it's the former, but unfortunately there's no way for me to distinguish between a call that had previously been margin called but is now expired..

Here's a screenie from bitBTC which currently has expired and forced margin calls at the top of the books:



FYI atm bitUSD as of right now still has an invisible buy order of 1275.55 bitUSD at 243.4266 BTS/bitUSD, and the expired orders make up a whopping 186944 bitUSD at 221.29 BTS/bitUSD. At least this makes the whole trading action make a lot more sense, what was missing from my understanding was the forced margin calls at +10% which were invisible in the client.
Worker: dev.bitsharesblocks

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag
You're right I could sum them, those are all expired orders actually, I forgot about the margin called orders. I was under the impression the 10% above price was a bug, isn't it? Expired orders should be at the feed price though right?

The bug was that expired cover orders had a limit price at 10% above the price feed when it was supposed to be at the price feed. However, margin call cover orders should have a price limit 10% above the price feed.


Offline svk





Shouldn't your buy table also have entries at 10% above the feed price for the margin-called orders?

Also I think it would look much better if you coalesced orders at the same price together. That means there shouldn't be more than at most two yellow items (one for expired cover orders and one for margin-called cover orders). If a user wants to a see a more detailed break down than that, they always could click the "Margin Orders" button (which I think is misleading and should instead be labelled "Cover Orders").

You're right I could sum them, those are all expired orders actually, I forgot about the margin called orders. I was under the impression the 10% above price was a bug, isn't it? Expired orders should be at the feed price though right?
Worker: dev.bitsharesblocks

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag


Shouldn't your buy table also have entries at 10% above the feed price for the margin-called orders?

Also I think it would look much better if you coalesced orders at the same price together. That means there shouldn't be more than at most two yellow items (one for expired cover orders and one for margin-called cover orders). If a user wants to a see a more detailed break down than that, they always could click the "Margin Orders" button (which I think is misleading and should instead be labelled "Cover Orders").

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
It is possible to buy bitUSD from regular sellers, but not from shorts.

It is also possible to short bitUSD at the feed price by either setting no limit or a limit above ~.0047 USD/BTS. These shorts will be eaten up immediately by the margin calls, so it is not possible to self-short.

That doesn't seem to be the case either, there's currently a short wall of 354 bitUSD for sale (no limit or below the limit), and several thousand bitUSD worth of cover orders that are not eating into this short wall. Is the single BUY order at 226 BTS/bitUSD blocking the other trades from happening?

All shorts have a limit below .004652 USD/BTS. It doesn't matter if that limit is above or below the feed. The bug is triggered because the margin call with the highest priority has a limit of 0.00469622149801484 which is greater than the limit of the shorts and therefore causes the shorts to be skipped.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

zerosum

  • Guest
In what world this belongs to the trading sub section?

PS
Sorry for not checking each illogical subsection before posting this  https://bitsharestalk.org/index.php/topic,15170.msg201296.html#msg201296

Offline svk

So it seems the long and, er, short of it is currently it's not possible to acquire bitUSD?

It is possible to buy bitUSD from regular sellers, but not from shorts.

It is also possible to short bitUSD at the feed price by either setting no limit or a limit above ~.0047 USD/BTS. These shorts will be eaten up immediately by the margin calls, so it is not possible to self-short.

That doesn't seem to be the case either, there's currently a short wall of 354 bitUSD for sale (no limit or below the limit), and several thousand bitUSD worth of cover orders that are not eating into this short wall. Is the single BUY order at 226 BTS/bitUSD blocking the other trades from happening?

Another picture to help the explanation:



If what you say is true, shouldn't the expired margin calls (in yellow) be matched with the short wall (first entry in blue in the SELL table)?
« Last Edit: April 11, 2015, 01:05:53 pm by svk »
Worker: dev.bitsharesblocks

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
So it seems the long and, er, short of it is currently it's not possible to acquire bitUSD?

It is possible to buy bitUSD from regular sellers, but not from shorts.

It is also possible to short bitUSD at the feed price by either setting no limit or a limit above ~.0047 USD/BTS. These shorts will be eaten up immediately by the margin calls, so it is not possible to self-short.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline Riverhead

This is a known bug: https://github.com/BitShares/bitshares/issues/1495

The problem here is that the huge volume of expired BitUSD shorts have a call price that's close to the feed price, and shorts with a limit above the call price are skipped in the order matching. Also, the engine tries to match covers before regular orders. So when the engine get to match your regular offer, the matching short will already have been skipped.

Thank you PC. That is a perfect explanation. So it seems the long and, er, short of it is currently it's not possible to acquire bitUSD?

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
This is a known bug: https://github.com/BitShares/bitshares/issues/1495

The problem here is that the huge volume of expired BitUSD shorts have a call price that's close to the feed price, and shorts with a limit above the call price are skipped in the order matching. Also, the engine tries to match covers before regular orders. So when the engine get to match your regular offer, the matching short will already have been skipped.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline svk

At the moment we seem to have simple buy orders not getting matched with shorts either, see the screenshot below for the current state in my wallet:

Worker: dev.bitsharesblocks

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
Not only are shorts not getting matched, normal sells that match only fill one order but keep the other on the book!
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline Riverhead


Is that what's happening here? Those shorts aren't really there? My bot is very low on bitUSD can I can't seem to buy more.

Code: [Select]
     BIDS (* Short, + Relative, - Relative Limit)                            |                                   ASKS                                 
TOTAL                     QUANTITY                                     PRICE | PRICE                                        QUANTITY                     TOTAL   COLLATERAL
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1.1250 USD                250.00000 BTS                   0.004500000000 USD*| 0.004444344444 USD                  132,000.00000 BTS              586.6534 USD
444.4444 USD              100,000.00000 BTS               0.004444444444 USD*| 0.004651162791 USD                   10,750.00000 BTS               50.0000 USD

Offline bytemaster

There are a ton of market order fixes that have been heavily tested in the current DEV shares release.   Those fixes will migrate to BTS soon.   

In the mean time we have the issue that the expired orders are not being properly displayed in the GUI and the LIMIT prices are not properly included.   bitsharesblocks.com seems to do it properly.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline biophil

  • Hero Member
  • *****
  • Posts: 880
  • Professor of Computer Science
    • View Profile
    • My Academic Website
  • BitShares: biophil
Right now, there are bids for BitUSD above the feed price. The feed price is about 211, the highest bid is 225. To test the market, I shorted BitUSD with 1000 BTS of collateral, and was able to borrow 2.3637 BitUSD. Now in my margin order it says I have about 1500 BTS, which means the proceeds of my short order were about 500 BTS. THAT IS THE WRONG AMOUNT!! I should have been matched with the highest bid and gotten the 225 price, but as you can calculate (500/2.3637), I only got the 211 price. I'm guessing I matched one of the many expired shorts.

I know the devs aren't allowed to talk to us anymore or some such insane bullshit, but is there anybody out there who knows how to get a fix for this in the pipeline? Thanks.
Support our research efforts to improve BitAsset price-pegging! Vote for worker 1.14.204 "201907-uccs-research-project."