Back to Nautilus Trader

Binance fixture sources

crates/adapters/binance/test_data/SOURCES.md

1.226.06.2 KB
Original Source

Binance fixture sources

This file maps Binance parser surfaces to their primary docs sources.

Use the docs examples first. Fall back to live capture for SBE wire payloads and for cases where a docs example is missing or stale.

Spot HTTP

SurfaceParser functionsPrimary source
Market data RESTdecode_ping, decode_server_time, decode_depth, decode_trades, decode_klines, decode_exchange_infoSpot REST market data docs
Account RESTdecode_account, decode_account_trades, decode_ordersSpot REST account docs
Trading RESTdecode_new_order_full, decode_cancel_order, decode_order, decode_cancel_open_ordersSpot REST trading docs

Spot WebSocket

SurfaceParser functionsPrimary source
User data streamparse_spot_exec_report_to_order_status, parse_spot_exec_report_to_fill, parse_spot_account_positionSpot user data stream docs
WS API tradingSpot WebSocket API request and response parsing around trading flows.Spot WebSocket API trading docs

Spot SBE

SurfaceParser functionsPrimary source
HTTP SBE responsesSpot decode_* functions in src/spot/http/parse.rs.Spot REST docs above for semantic examples, then live SBE capture for raw payloads.
Market data stream SBEdecode_market_data, parse_trades_event, parse_bbo_event, parse_depth_snapshot, parse_depth_diffSpot SBE market data docs
SBE schema and payload interpretationShared SBE decoding and fixture derivation work.Spot SBE FAQ

Futures

SurfaceParser functionsPrimary source
Futures HTTPHTTP model and response fixtures under src/futures/http.Official Binance Futures REST docs for each endpoint we cover.
Market data streamsparse_agg_trade, parse_trade, parse_book_ticker, parse_depth_update, parse_mark_price, parse_kline, extract_symbol, extract_event_typeUSD-M Futures market stream docs for aggregate trade, book ticker, diff depth, mark price, and klines.
User data streamsparse_futures_order_update_to_order_status, parse_futures_order_update_to_fill, parse_futures_algo_update_to_order_status, parse_futures_account_update, decode_order_client_id, decode_algo_client_idUSD-M Futures user-data docs for balance and position updates, order updates, and algo order updates.

Notes

  • As of March 12, 2026, Binance spot REST, user-data stream, and WS API docs publish canonical JSON examples for the major parser surfaces.
  • As of March 12, 2026, Binance SBE docs publish schema and transport guidance, but not a complete set of raw binary fixture payloads.
  • As of March 12, 2026, the Spot user-data docs examples are wrapped in a subscriptionId and event envelope. The WebSocket handler in this crate now accepts both wrapped docs payloads and legacy top-level event payloads.
  • The low-level Spot user-data message structs still deserialize the inner event object directly, so wrapped docs fixtures should use the shared load_event_fixture helper in tests.
  • For SBE coverage, the docs define the expected fields. Live capture supplies the canonical wire bytes.
  • As of March 12, 2026, Binance does not appear to publish a separate USD-M individual trade stream example on the market-stream docs pages. The fixture futures/market_data_json/trade_stream.json is derived from the published aggregate trade example and should be replaced with a live sample if we capture one.
  • The fixtures futures/market_data_json/kline_stream_closed.json, futures/user_data_json/order_update_trade.json, and futures/user_data_json/algo_update_new.json are narrow derived variants of a published docs example so we can test alternate parser branches that the docs do not show directly.