Closed archienorman11 closed 6 years ago
1: when PRICE = 0 then you have to delete the order - does this only mean that an order has been cancelled? Or are they other reasons why the order might be deleted, for example, a market or limit order also result in this message being sent? If so, can I match a trade (from trade channel) with that of these messages where the price = 0, as far as I can see, trade_id has no correlation to order_id.
You need to check amount
, not price
. As for reasons of cancellation, you'll best ask Bitfinex directly, but generally I would assume cancelling, or filling would both cause removal from the book.
2: when PRICE > 0 then you have to add or update the order - does this mean, if the price is not 0 and the order does not exist, then add it, otherwise overwrite the order values on the book with the new values in the message just received? Generally, yes. You can essentially use a python dictionary to keep track of the book and should be fine.
Hi, thanks very much for this tool - its very helpful. I realise the scope of this project does not include building orderbooks, but perhaps someone could help me understand a couple of things with the bfx websocket api
raw orderbook messages
:1:
when PRICE = 0 then you have to delete the order
- does this only mean that an order has been cancelled? Or are they other reasons why the order might be deleted, for example, a market or limit order also result in this message being sent? If so, can I match a trade (from trade channel) with that of these messages where theprice = 0
, as far as I can see,trade_id
has no correlation toorder_id
.2:
when PRICE > 0 then you have to add or update the order
- does this mean, if the price is not 0 and the order does not exist, then add it, otherwise overwrite the order values on the book with the new values in the message just received?Any help hugely appreciated.
Thanks,