Skip to content
All library documents

Live Trading Bot Design for Order and Market Event Handling

Code Stratmill research code

Summary

The code excerpt outlines a Rust live-trading bot builder and event-processing loop. A builder registers instruments with connector and symbol details, tick and lot sizes, and market-depth storage; it can also attach error handlers and order-response hooks before constructing a bot and registering instruments with a communication channel. The bot processes feed updates into local depth and trade state, records feed and order latency, updates order status while guarding against stale updates, and handles position and connector error events.

The excerpt also shows order cancellation checks, optional waiting for a response, cleanup of inactive orders, and methods for waiting on feeds or elapsing over a duration. Some implementation is omitted or replaced with a placeholder, so the complete execution path cannot be assessed from this text. It describes infrastructure for live trading rather than a trading strategy, and it supplies no performance results or operational safety analysis. The visible logic is useful for understanding event-driven state management and the distinction between order responses and market-feed events.

Key ideas

  • The builder registers instruments and configures optional error and order-response handlers.
  • Feed events update local depth and trade data, while order events update tracked order state.
  • Order updates are checked against timestamps and final statuses to avoid applying stale changes.
  • Cancellation can validate order status and optionally wait for a response.
  • The excerpt is incomplete and provides no strategy or performance evidence.

Tags

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