Subscribing to initialization events
About initialization events
A TradeSubscription object is essentially a collection of pointers to a set of orders and a collection of pointers to a set of fills. Before calling the Start() method for a TradeSubscription object, these collections are empty. After calling the Start method, the TT .NET SDK begins to populate these collections.
Supported initialization events
A TradeSubscription object fires the following event when its initial set of orders and fills are added.
Event | Description |
---|---|
OrderBookDownload | Fired when the order book download is complete and the orders have been added to the TradeSubscription instance |
After this event has fired, the application can begin to perform actions on the orders associated with a TradeSubscription instance.
Subscribing for initialization events
You can subscribe for initialization events as follows before calling the Start() method.
// Create a TradeSubscription to listen for initialization events
m_ts = new TradeSubscription(tt_net_sdk.Dispatcher.Current);
m_ts.OrderBookDownload += new EventHandler<OrderBookDownloadEventArgs>(m_ts_OrderBookDownload);
m_ts.Start();
Defining event handlers
The following code snippet shows the structure for these event handlers.
void m_ts_OrderBookDownload(object sender, OrderBookDownloadEventArgs e)
{
}