OrderPipeline
Order tracking and processing. Handles attach/process/cancel lifecycle.
実装: IEnumerable<Order>, IEnumerable
コンストラクター
public OrderPipeline(IStatisticManager stats)
orderPipeline = OrderPipeline(stats)
Order tracking and processing. Handles attach/process/cancel lifecycle.
- stats
- Statistic manager.
プロパティ
public decimal? Commission { get; private set; }
value = orderPipeline.Commission
orderPipeline.Commission = value
Total commission from registered orders.
public IEnumerable<Order> Orders { get; }
value = orderPipeline.Orders
Get all tracked orders.
メソッド
public void AddReceivedVolume(Order order, decimal volume)
orderPipeline.AddReceivedVolume(order, volume)
Track received volume for WaitAllTrades logic.
public void AttachAndProcess(Order order)
orderPipeline.AttachAndProcess(order)
Attach and immediately process an order (used for restored orders).
public IEnumerator<Order> GetEnumerator()
result = orderPipeline.GetEnumerator()
Returns an enumerator that iterates through the collection.
戻り値: An enumerator for the collection.
public bool IsTracked(Order order)
result = orderPipeline.IsTracked(order)
Check if the exact order instance is currently tracked.
public void ProcessOrder(Order order, bool isChanging)
orderPipeline.ProcessOrder(order, isChanging)
Process order state change. Detects registration (Pending->Active/Done) and fires appropriate events.
public void RemoveDoneBefore(DateTime time)
orderPipeline.RemoveDoneBefore(time)
Remove old completed orders.
- time
- Minimum order time to keep.
public void RemoveDoneWithNonPositiveVolume()
orderPipeline.RemoveDoneWithNonPositiveVolume()
Remove completed orders with non-positive volume.
public void SetStatisticManager(IStatisticManager stats)
orderPipeline.SetStatisticManager(stats)
Swap the statistic manager (used when StatisticManager is reassigned).
- stats
- The new statistic manager.
public bool TryAttach(Order order)
result = orderPipeline.TryAttach(order)
Try to attach (track) an order. Returns false if the same instance is already tracked.
public bool TryMarkCanceled(Order order)
result = orderPipeline.TryMarkCanceled(order)
Mark a single tracked order as canceled. Returns only on the transition (i.e. the order was tracked and had not been marked canceled yet), so the caller can issue the cancel exactly once.
- order
- The order to mark.
戻り値: if the order was newly marked canceled.
イベント
public event Action<Order> Changed
orderPipeline.Changed += handler
Fires on order state changes (non-registration).
public event Action<Order> NewOrder
orderPipeline.NewOrder += handler
Fires when a new order is added to tracking.
public event Action<Order> Registered
orderPipeline.Registered += handler
Fires when an order transitions from Pending to Active/Done.