n0mad01 / node.bittrex.api

No longer maintained
MIT License
183 stars 187 forks source link

Orderbook websocket #66

Open LRonHubs opened 7 years ago

LRonHubs commented 7 years ago

Does Bittrex really not have documentation for accessing the full orderbook via websocket? Isn't this the type of thing that would make people use your exchange more?

jaggedsoft commented 7 years ago

Step 1: Subscribe to the websocket for the order book with the getmarkethistory() function Step 2: Download complete order book history with /public/getorderbook Step 3: Now you're always in sync

jaggedsoft commented 7 years ago

The ugly tech specs for this part of the api are located at: https://github.com/n0mad01/node.bittrex.api/files/1104308/WebSocketAPI_MarketTracking.docx

gliwka commented 7 years ago

You basically first subscribe to the delta data for a currency pair by calling SubscribeToExchangeDeltas to make sure you don't miss anything. After that you call QueryExchangeState to get the initial state of the order book. Now you just need to apply all updates you receive after the call to QueryExchangeState on top of that.

See https://github.com/gliwka/bittrex-market/blob/master/lib/manager.js#L140 for the initialisation logic and https://github.com/gliwka/bittrex-market/blob/master/lib/market.js for handling the update messages.

skeller88 commented 6 years ago

Anyone know what the different order book event types mean? There are 3: "0", "1", and "2". Bittrex's API documentation is a bit limited.

LRonHubs commented 6 years ago

Generally one of these means "remove this order from the orderbook", another means "add this order to the orderbook", another means "keep this order on the orderbook,m but change the amount.

While I'm not sure which of these is which, the bittrex-market github repo does all this for you, you don't even need the aforementioned steps.

On Sun, Sep 24, 2017 at 3:34 AM, Shane Keller notifications@github.com wrote:

Anyone know what the different order book event types mean? There are 3: "0", "1", and "2". Bittrex's API documentation is a bit limited.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/n0mad01/node.bittrex.api/issues/66#issuecomment-331692934, or mute the thread https://github.com/notifications/unsubscribe-auth/AWRK7JZW9NE5sRnOEv9syOpXw_EIyIQnks5slgYhgaJpZM4PRaN- .

gliwka commented 6 years ago

Here some details about the orderbook types, in case anybody is searching for this information and finds this issue: https://github.com/gliwka/bittrex-market/issues/9