Trade Subscription Behavior on Disconnect
Default Behavior on Disconnect
The TradeSubscription class only provides information on real time events. During a disconnect, the SDK stops receiving all real time order events. Once reconnected, the SDK simply syncs its order book by adding and deleting orders to match the current state of the TT order book.
The SDK does not have information on events that occurred during the disconnection (e.g., orders being triggered, changed, filled, or cancelled). Therefore, the SDK cannot replay these events when connectivity is reestablished.
The FillsSubscription class can provide access to fills that occurred during a disconnect since they provide access to historical fills.
Cancel-On-Disconnect Functionality
The TT .NET SDK provides the CancelOrderViaREST(OrderProfile) method as an alternate way to cancel orders after the application disconnects from the system.
Using this method, the application can cancel the working orders via a REST API call. Successfully cancelling an order triggers an OrderDeleted event. Unsuccessfully cancelling an order, triggers an OrderRejected event.
Note
This is a synchronous call and only supports cancelling one order at a time. Batch cancellation of orders is not supported.
Warning
Application disconnects due to network or other connectivity issues may result in the cancel-on-disconnect request to also fail. TT strongly recommends taking this restriction into account when coding your application.