altangent / ccxws

WebSocket client for 38 cryptocurrency exchanges
MIT License
617 stars 186 forks source link

Bittrex: Bittrex Level 2 Snapshot should return the sequence Id #220

Closed lostless13 closed 3 years ago

lostless13 commented 3 years ago

function _requestLevel2Snapshot should include the sequence id in the return value so that the starting point is known.

The sequence id is in the response header called "sequence" when you call the Bittrex V3 markets/{id}/orderbook endpoint.

lostless13 commented 3 years ago

Sorry I would have done a pull request but I wasn't sure how you wanted to handle dealing with the https.js core utility and getting the header.

In my Bittrex Api library I just do this check in the main get method and add it to the body json:

if (response.headers.sequence) response.data["sequence"] = Number(response.headers.sequence)

Sort of a weird design on bittrex's part.

bmancini55 commented 3 years ago

Ah! Interesting, I didn't realize Bittrex sent the sequence in the headers.

We can just add a getRaw (or something like that) method to https that resolves with tuple of the concatenated body and headers on success instead of the parsed JSON body. That way the caller can take action they want on the body Buffer and headers.

bmancini55 commented 3 years ago

If you want to give it a shot, I can assign the issue to you.

lostless13 commented 3 years ago

I already overrode and rebound the function in my app to get it out the door so I doubt I'd get to it anytime soon with my current backlog. Sorry.

bmancini55 commented 3 years ago

No worries! Thanks for reporting the issue