Author Topic: Market order matching bug?  (Read 4809 times)

0 Members and 1 Guest are viewing this topic.

Offline svk


If there are sell orders below that range, the margin orders won't execute at all, so you get a negative spread.


So in the current situation we have about $1500 being called at 290 BTS/USD. However since there is about $5000 USD in sell orders below the call price of 284 BTS/USD the call doesn't execute because they are still sufficiently collateralized against the actual market price (~280 BTS/USD) regardless of the feed.

Is it that the dex market price trumps the feed price when deciding when to execute a call? Am I close? If that's the case then the rule makes sense but the display is a bit...confusing.
That's quite a good explanation!
maybe we shouldn't place the margin call order at the order book.
just move it to another place, with the margin call price.

This would give invisible orders in illiquid markets.

A simple solution to all this would be to let call orders buy at a price down to the feed price.
Worker: dev.bitsharesblocks

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi

If there are sell orders below that range, the margin orders won't execute at all, so you get a negative spread.


So in the current situation we have about $1500 being called at 290 BTS/USD. However since there is about $5000 USD in sell orders below the call price of 284 BTS/USD the call doesn't execute because they are still sufficiently collateralized against the actual market price (~280 BTS/USD) regardless of the feed.

Is it that the dex market price trumps the feed price when deciding when to execute a call? Am I close? If that's the case then the rule makes sense but the display is a bit...confusing.
That's quite a good explanation!
maybe we shouldn't place the margin call order at the order book.
just move it to another place, with the margin call price.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc

If there are sell orders below that range, the margin orders won't execute at all, so you get a negative spread.


So in the current situation we have about $1500 being called at 290 BTS/USD. However since there is about $5000 USD in sell orders below the call price of 284 BTS/USD the call doesn't execute because they are still sufficiently collateralized against the actual market price (~280 BTS/USD) regardless of the feed.

Is it that the dex market price trumps the feed price when deciding when to execute a call? Am I close? If that's the case then the rule makes sense but the display is a bit...confusing.
That's quite a good explanation!

Offline tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile

If there are sell orders below that range, the margin orders won't execute at all, so you get a negative spread.


So in the current situation we have about $1500 being called at 290 BTS/USD. However since there is about $5000 USD in sell orders below the call price of 284 BTS/USD the call doesn't execute because they are still sufficiently collateralized against the actual market price (~280 BTS/USD) regardless of the feed.

Is it that the dex market price trumps the feed price when deciding when to execute a call? Am I close? If that's the case then the rule makes sense but the display is a bit...confusing.

You nailed it, 290@290 guy :)
Lack of arbitrage is the problem, isn't it. And this 'should' solves it.

Offline Riverhead


If there are sell orders below that range, the margin orders won't execute at all, so you get a negative spread.


So in the current situation we have about $1500 being called at 290 BTS/USD. However since there is about $5000 USD in sell orders below the call price of 284 BTS/USD the call doesn't execute because they are still sufficiently collateralized against the actual market price (~280 BTS/USD) regardless of the feed.

Is it that the dex market price trumps the feed price when deciding when to execute a call? Am I close? If that's the case then the rule makes sense but the display is a bit...confusing.
« Last Edit: October 22, 2015, 01:47:37 am by Riverhead »

Xeldal

  • Guest
The current rule makes the order book look silly and I think this should be changed to something like:

A margin call will occur any time the highest bid is greater than SQP and CALL PRICE is greater than SQP.

This doesn't capture the fact that the highest bid has to be lower than the call price.

I think the rule is fine, just the way the GUI displays it should be changed. Just don't show yellow orders (margin calls) unless the highest bid is less than the SQP. Then display all margin calls as an order at the SQP. That actually reflects what is happening.

Thats it.  makes sense graphically.  I would say don't display the (yellow) Highest Call Price unless its greater than the SQP Limit.  If its greater than the SQP Limit, place it *at the SQP Limit.  These are essentially Limit orders to sell at SQP Limit (if the  other condition is met. )=>  It won't sell to a BID above its Highest call price.


« Last Edit: October 22, 2015, 12:30:44 am by Xeldal »

Offline xiahui135

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
I am also confused by the order book. No matter how to adjust, you have to make sure all the orders in the list are tradable.
If I can see it, then I can place order to fill it. Simple like this.

Offline maqifrnswa

  • Hero Member
  • *****
  • Posts: 661
    • View Profile
The current rule makes the order book look silly and I think this should be changed to something like:

A margin call will occur any time the highest bid is greater than SQP and CALL PRICE is greater than SQP.

This doesn't capture the fact that the highest bid has to be lower than the call price.

I think the rule is fine, just the way the GUI displays it should be changed. Just don't show yellow orders (margin calls) unless the highest bid is less than the SQP. Then display all margin calls as an order at the SQP. That actually reflects what is happening.
maintains an Ubuntu PPA: https://launchpad.net/~showard314/+archive/ubuntu/bitshares [15% delegate] wallet_account_set_approval maqifrnswa true [50% delegate] wallet_account_set_approval delegate1.maqifrnswa true

Offline botfund

  • Full Member
  • ***
  • Posts: 174
    • View Profile
  • BitShares: botfund
The current rule makes the order book look silly and I think this should be changed to something like:

A margin call will occur any time the highest bid is greater than SQP and CALL PRICE is greater than SQP.

Xeldal

  • Guest
Yea this seems to be a "feature" of the market engine, I've made posts about it in several other threads as well, look through my post history for that.

I do not like to think of the market in USD/BTS terms, my examples assume a call is a buy order looking to buy USD.

What is displayed in the GUI in yellow are all current margin called orders. The line called Call limit is the call price of the least collateralized position currently being margin called. (Yes we know the call price of all margin positions)

Call orders will only execute in the range between that call limit and the margin call price.

If there are sell orders below that range, the margin orders won't execute at all, so you get a negative spread.

Crazy imo but as far as I can tell that's how it works.

I do not pull margin orders from the books just because there are sells below their range, that seems unfair to me, you should see that there are orders being margin called so you can sell to them.

Thanks for the explanation.  I think I've read nearly every explanation so far from various people.  I still don't quite get it.
I think I'm close, I've just got something backwards somewhere and I can't let it go,its blocking the full picture.  : )
I'd like to get it though, so I don't continue to spread wrong info. 

Having the orders not matching like that is really bad though, (even if thats proper function) and gives a really bad image.  I don't think generally people are going to understand this.

Offline svk

Yea this seems to be a "feature" of the market engine, I've made posts about it in several other threads as well, look through my post history for that.

I do not like to think of the market in USD/BTS terms, my examples assume a call is a buy order looking to buy USD.

What is displayed in the GUI in yellow are all current margin called orders. The line called Call limit is the call price of the least collateralized position currently being margin called. (Yes we know the call price of all margin positions)

Call orders will only execute in the range between that call limit and the margin call price.

If there are sell orders below that range, the margin orders won't execute at all, so you get a negative spread.

Crazy imo but as far as I can tell that's how it works.

I do not pull margin orders from the books just because there are sells below their range, that seems unfair to me, you should see that there are orders being margin called so you can sell to them.

Worker: dev.bitsharesblocks

Xeldal

  • Guest
This bring up another question for me.

Given:
Call price: .004
Highest BID: .0038
Feed Price: .0044
SQP(-10% Feed): .0039

So you have (blue)BID: .0038 || .0039 ASK (yellow)

The yellow margin call order is on the book because the highest BID is below the order Call Price

If a new BID were put on the book at .006 ( clearly above the orders Call Price).  Would the Margin Call order be filled or would it get pulled from the book because the highest Bid was now above the Call Price.

Basically, what comes first in order matching.  Calculating and placing\removing Margin Call orders or Filling existing orders(including Margin Call orders).

I would assume because we are no longer using the "get what you order" system like in BTS1 it would essentially be a limit order and fill at the best available price, which is still below the Call Price and so the Margin Call order would in fact be filled, regardless of how high this new BID was placed. 

Xeldal

  • Guest
bid(margin call) price is 269.74391
ask price is 265
it doesn't fill because the call price is greater than 265, for an example, it's 268.
if you want to fill it, you can give a bid order at price 265, this will fill the ask order.
then you give a ask order at price 269.74391(between 268 and 269.74391), this will fill the margin call order

I don't think you can know what the call price is(unless you own the order).  As each order will have a different call price and it won't change.
Because the order is yellow and on the book you can assume the highest bid is less than than this orders call price.
The yellow order is the SQP price, or 10% below the feed.

So Flipping it over, lets look at the same order:
margin call price is somewhere above the highest BID of .00377
The ASK (SQP margin call order) is 10% below the feed or .0037 (yellow)
The highest bid is .00377 which is above the SQP and so the Margin Call should execute.

If the highest BID were higher, say .004 the yellow (SQP margin call order) would disappear off the book, if this BID were higher than the orders Call price, whatever it is.

Edit: I'm confusing myself here, so I may have something backward or wrong, but I think the above is right.  I need to think of a better example maybe.
« Last Edit: October 21, 2015, 12:47:04 am by Xeldal »

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
bid(margin call) price is 269.74391
ask price is 265
it doesn't fill because the call price is greater than 265, for an example, it's 268.
if you want to fill it, you can give a bid order at price 265, this will fill the ask order.
then you give a ask order at price 269.74391(between 268 and 269.74391), this will fill the margin call order

Xeldal

  • Guest
Oh its gone... Maybe a display bug

I think its just slow to respond.  I've placed an order and its taken several minutes to display, and another couple minutes to show that its been filled.

I hope its a bug and not proper operation.

it's not a market engine bug or display bug, it's the rule how it works
https://bitsharestalk.org/index.php/topic,19102.0.html

Are you saying the BID and ASK are not supposed to match and fill?  That doesn't seem right.
no, look at the draft by BM, the margin call will occur only when highest bid is less than call price and greater than SQP.
it's not match because the bid price is greater than call price
https://bitsharestalk.org/index.php/topic,19102.0.html

Its difficult to explain using BM example because the market is flipped but heres my attempt.
Correct me if I'm wrong.   

The yellow price indicates an order that is being margin called, it is limited by the SQP or 10% below the feed.

The only way this order would even be displayed is if the highest bid was below the orders Call price.   And there were no orders to match above the SQP.

It would be filled with any Bid above the SQP. 

In the above picture there is a Bid at (1/265) that should fill the yellow order.  And i believe that is what happened but the display was delayed.