Update Binance Data Structures#288
Open
snow-avocado wants to merge 7 commits into
Open
Conversation
b41005e to
9cc3f63
Compare
Binance Spot WebSocket trade stream no longer documents fields 'b' and 'a' (buyer/seller order IDs). Reference: https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#trade-streams
Author
|
@carlosmiei could you review this change? Thanks! |
added 5 commits
March 16, 2026 13:00
SpaceMonkeyForever
pushed a commit
to SpaceMonkeyForever/binance-rs
that referenced
this pull request
May 11, 2026
The futures `@bookTicker` payload carries `E` (event time) and `T` (transaction time) on the wire, but the spot `BookTickerEvent` struct that the futures stream was reusing didn't declare those fields, so serde silently dropped them. Downstream consumers had to fall back to `Utc::now()` for "when did this market event happen", which conflates wire/decode latency with exchange-side timing. Add a futures-specific `BookTickerEvent` in `futures::model` that carries both timestamps, and rewire `FuturesWebsocketEvent::BookTicker` / `FuturesEvents::BookTickerEvent` to use it. Spot's struct is untouched — the spot `@bookTicker` payload still doesn't carry exchange time. Equivalent to the BookTickerEvent slice of upstream PR ccxt#288 without the dependency/TradeEvent churn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per futures documentation, event and book time exist on the data stream. Below I add optional elements so they are captured for futures streams. Let me know if you prefer I add this in a different way.
Also, I have removed buyer_order_id and seller_order_id on TradeEvent, which are no longer set by futures or spot feeds (https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#trade-streams)