Bybit WebSocket Feed for Order Book Depth and Public Trades
Summary
This Rust component connects to a Bybit public WebSocket stream and converts incoming order book and public trade messages into internal live feed events. It subscribes to several order book depth levels and public trades for requested symbols, parses bid and ask updates, and records exchange and local timestamps. Trade events are classified by side and carry price and size.
The connection loop sends periodic application-level pings, handles server ping messages, and reports subscription lag, parsing failures, closures, and connection errors. The code notes that multiple depth subscriptions are intended to support data fusion, but it does not explain the fusion method or show downstream use. This is connector implementation detail rather than a trading strategy; it provides no evidence about execution quality, latency, market behavior, or strategy performance. The event channel also unwraps sends, so channel failure handling is not shown.
Key ideas
- The stream subscribes to multiple order book depths and public trades for each requested symbol.
- Order book updates are parsed into bid-side and ask-side feed events.
- Trade messages are mapped to buy or sell events with price, size, and timestamps.
- The asynchronous loop manages subscriptions, pings, and common WebSocket errors.
- The code does not describe how downstream data fusion works or evaluate trading outcomes.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.