Skip to main content

Module order_tracker

Module order_tracker 

Source
Expand description

Order lifecycle tracking (0.2c).

ExecutionService returns an exchange order id from place_order and then forgets it. For market orders that’s fine — they fill or reject immediately. But once a brain can place resting limit / post-only orders (0.2b), an order can sit on the book indefinitely: a stale limit ties up margin and may fill long after the signal that produced it is meaningless.

The OrderTracker records every resting order the framework places. The OrderReaperService periodically:

  1. Reconciles tracked state against the exchange’s actual open orders (so fills/cancels that happened out-of-band drop out of the tracker), and
  2. Ages out any tracked order older than a configured TTL by calling ExchangeClient::cancel_order.

Both require Capability::OrderTracking; without it the reaper is never spawned (see Bot::with_order_tracking).

Structs§

OcoRegistry
One-cancels-other registry for bracket (SL + TP) protective pairs.
OrderReaperService
Supervised service that reconciles tracked orders against the exchange and cancels any that outlive the configured TTL.
OrderTracker
Shared, cheaply-cloneable record of resting orders the framework placed.
TrackedOrder
One order the framework is tracking on the book.