Table of Contents

Orders states

The order during it’s life goes through the following states:

OrderStates

To find out the order trading state (what volume is matched, whether the order fully matched, and so on) the Extensions.IsCanceled(StockSharp.Messages.IOrderMessage order ), Extensions.IsMatchedEmpty(StockSharp.Messages.IOrderMessage order ), Extensions.IsMatchedPartially(StockSharp.Messages.IOrderMessage order ), Extensions.IsMatched(StockSharp.Messages.IOrderMessage order ) and Extensions.GetMatchedVolume(StockSharp.Messages.IOrderMessage order ) methods should be used:

// any order
Order order = ....
// is the order was cancelled
Console.WriteLine(order.IsCanceled());
// or fully matched
Console.WriteLine(order.IsMatched());
// or just partially
Console.WriteLine(order.IsMatchedPartially());
// or non of any contracts was matched 
Console.WriteLine(order.IsMatchedEmpty());
// so we are getting the realized (=matched) order size.
Console.WriteLine(order.GetMatchedVolume());