Getting orders information
The IConnector events related to orders listed below:
- ITransactionProvider.NewOrder - the new order received event.
- Connector.OrderCancelFailed - the event on errors related to orders cancel.
- Connector.OrderChanged - the order state change event (cancelled, matched).
- Connector.OrderRegisterFailed - the event on errors related to orders registration.
- Connector.NewStopOrder - the new stop order received event.
- Connector.StopOrderCancelFailed - the event on errors related to stop orders cancelling.
- Connector.StopOrderChanged - the stop orders state change event.
- Connector.StopOrderRegisterFailed - the event on errors related to stop orders registration.
Transactions (orders registration, replacement or cancelling) are sent in asynchronous mode. Asynchronous mode allows the trading program not to wait for transaction delivery confirmation by the exchange and continues to work further. That reduces program wait time and increases the speed of response to the market situation changes.
To find out in the program when the exchange has assigned the Order.Id to the order, you need to subscribe for the Connector.OrderChanged event (or the Connector.StopOrderChanged for stop orders). To determine the registration failed the Connector.OrderRegisterFailed event is used (or the Connector.StopOrderRegisterFailed for stop orders).
Caution
If at the start of the application the previously registered orders have been passed from the connector, they all passed through the ITransactionProvider.NewOrder events, regardless of their state (except the OrderStates.Failed state). This is because the Connector.NewOrder event shows the new orders receiving in the program, not the event of order successful registration.