Back to Nautilus Trader

Binance SBE Codecs

crates/adapters/binance/src/spot/sbe/README.md

1.226.01.5 KB
Original Source

Binance SBE Codecs

  • generated/ contains Rust code generated by Real Logic's Simple Binary Encoding (SBE) generator from the Binance Spot API SBE schema (schema 3:3). Do not edit these files manually. Regenerate them with the Real Logic SBE tool when the schema changes.
  • stream/ contains hand-written decoders for Binance market data stream messages (schema 1:0).
  • Generic cursor/error utilities are shared from nautilus-serialization behind the sbe feature and re-exported from this module for compatibility.

Licensing

  • The generated/ codecs are generated using the Apache-2.0 licensed Real Logic SBE tool; see ../../../licenses/Apache-2.0-RealLogic-SBE.txt and the entry in ../../../licenses/THIRD_PARTY_LICENSES.md.
  • The hand-written stream/ code is covered by the NautilusTrader project license.

Modifications

The generated generated/ code has been modified from the original SBE generator output:

  • Added module-level lint suppression attributes in mod.rs for clippy compatibility
  • Reordered pub use statements to appear before use super::* (fixes rustfmt)
  • Removed unused codec modules (institutional, order amendments, user data stream mgmt)

Regeneration

When regenerating from a new schema, reapply these modifications:

  1. Run Real Logic SBE generator with the Binance schema
  2. Move the generated module tree under generated/
  3. Add lint attributes to generated/mod.rs (see existing file)
  4. Fix pub use ordering in each codec file
  5. Remove unused modules and update mod.rs accordingly