OrderPipeline

StockSharp.Algo.Strategies

Order tracking and processing. Handles attach/process/cancel lifecycle.

Implements: IEnumerable<Order>, IEnumerable

Constructors

OrderPipeline
public OrderPipeline(IStatisticManager stats)
orderPipeline = OrderPipeline(stats)

Order tracking and processing. Handles attach/process/cancel lifecycle.

stats
Statistic manager.

Properties

Commission
public decimal? Commission { get; private set; }
value = orderPipeline.Commission
orderPipeline.Commission = value

Total commission from registered orders.

Orders
public IEnumerable<Order> Orders { get; }
value = orderPipeline.Orders

Get all tracked orders.

Methods

AddReceivedVolume
public void AddReceivedVolume(Order order, decimal volume)
orderPipeline.AddReceivedVolume(order, volume)

Track received volume for WaitAllTrades logic.

AttachAndProcess
public void AttachAndProcess(Order order)
orderPipeline.AttachAndProcess(order)

Attach and immediately process an order (used for restored orders).

CancelAll
public void CancelAll()
orderPipeline.CancelAll()

Mark all active orders as canceled.

GetEnumerator
public IEnumerator<Order> GetEnumerator()
result = orderPipeline.GetEnumerator()

Returns an enumerator that iterates through the collection.

Returns: An enumerator for the collection.

IsTracked
public bool IsTracked(Order order)
result = orderPipeline.IsTracked(order)

Check if the exact order instance is currently tracked.

ProcessOrder
public void ProcessOrder(Order order, bool isChanging)
orderPipeline.ProcessOrder(order, isChanging)

Process order state change. Detects registration (Pending->Active/Done) and fires appropriate events.

RemoveDoneBefore
public void RemoveDoneBefore(DateTime time)
orderPipeline.RemoveDoneBefore(time)

Remove old completed orders.

time
Minimum order time to keep.
RemoveDoneWithNonPositiveVolume
public void RemoveDoneWithNonPositiveVolume()
orderPipeline.RemoveDoneWithNonPositiveVolume()

Remove completed orders with non-positive volume.

Reset
public void Reset()
orderPipeline.Reset()

Clear all tracked orders.

SetStatisticManager
public void SetStatisticManager(IStatisticManager stats)
orderPipeline.SetStatisticManager(stats)

Swap the statistic manager (used when StatisticManager is reassigned).

stats
The new statistic manager.
TryAttach
public bool TryAttach(Order order)
result = orderPipeline.TryAttach(order)

Try to attach (track) an order. Returns false if the same instance is already tracked.

TryMarkCanceled
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.

Returns: if the order was newly marked canceled.

Events

Changed
public event Action<Order> Changed
orderPipeline.Changed += handler

Fires on order state changes (non-registration).

NewOrder
public event Action<Order> NewOrder
orderPipeline.NewOrder += handler

Fires when a new order is added to tracking.

Registered
public event Action<Order> Registered
orderPipeline.Registered += handler

Fires when an order transitions from Pending to Active/Done.