Skip to content
All library documents

Building a Binance USD-M Futures Connector with Live Data and Order Streams

Code Stratmill research code

Summary

The Rust module outlines a connector for Binance USD-M futures that combines market data subscriptions, user account updates, and order management. It reads connection and credential settings from configuration, tracks registered symbols, and starts asynchronous WebSocket streams. The market data stream is started for the connector, while the user data stream is opened only when API credentials are present. Both stream tasks use retry logic with exponential backoff and publish connection errors as live events.

Order submission and cancellation run asynchronously through a REST client. The connector coordinates client order identifiers with a shared order manager, updates local order state from REST responses, and publishes order or error events. It also normalizes registered symbols to lowercase for stream subscriptions. The excerpt illustrates integration patterns for exchange connectivity, event publication, and order lifecycle tracking, but it is partial source code and omits several supporting modules. It does not describe a trading strategy or provide operational performance evidence.

Key ideas

  • The connector separates market data streaming, user data streaming, REST requests, and order management.
  • The user data stream starts only when both API credentials are configured.
  • WebSocket connection tasks retry with exponential backoff and report failures as live events.
  • Order submissions and cancellations update shared order state and publish outcomes asynchronously.
  • Registered Binance futures symbols are normalized to lowercase for stream subscriptions.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.