/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_tradeSubscription != null) { m_tradeSubscription.OrderAdded -= tradeSubscription_OrderAdded; m_tradeSubscription.OrderBookDownload -= tradeSubscription_OrderBookDownload; m_tradeSubscription.OrderDeleted -= tradeSubscription_OrderDeleted; m_tradeSubscription.OrderFilled -= tradeSubscription_OrderFilled; m_tradeSubscription.OrderRejected -= tradeSubscription_OrderRejected; m_tradeSubscription.OrderUpdated -= tradeSubscription_OrderUpdated; m_tradeSubscription.OrderStatusUnknown -= tradeSubscription_OrderStatusUnknown; m_tradeSubscription.Dispose(); m_tradeSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (m_lock) { if (!m_disposed) { // Unattached callbacks and dispose of all subscriptions if (m_fs != null) { m_fs.FillAdded -= m_fs_FillAdded; m_fs.FillBookDownload -= m_fs_FillBookDownload; m_fs.FillListEnd -= m_fs_FillListEnd; m_fs.FillListStart -= m_fs_FillListStart; m_fs.Dispose(); m_fs = null; } // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }
/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (_lock) { if (!_disposed) { foreach (InstrumentLookupSubscription req in m_lreq) { if (req != null) { req.Update -= ReqUpdate; req.Dispose(); } } foreach (PriceSubscription tsSub in m_ltsSub) { if (tsSub != null) { tsSub.FieldsUpdated -= PriceFieldsUpdated; tsSub.Dispose(); } } // Begin shutdown the TT API TTAPI.ShutdownCompleted += ShutdownCompleted; TTAPI.Shutdown(); _disposed = true; } } }
/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (m_lock) { if (!m_disposed) { // Unattached callbacks and dispose of all subscriptions if (plsList != null) { for (int i = 0; i < plsList.Count; i++) { plsList[i].Update -= pls_Update; plsList[i].Dispose(); plsList[i] = null; } } if (ics != null) { ics.InstrumentsUpdated -= ics_InstrumentsUpdated; ics.Dispose(); ics = null; } // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_customerDefaultsSubscription != null) { m_customerDefaultsSubscription.CustomerDefaultsChanged -= m_customerDefaultsSubscription_CustomerDefaultsChanged; m_customerDefaultsSubscription.Dispose(); m_customerDefaultsSubscription = null; } if (m_instrumentTradeSubscription != null) { m_instrumentTradeSubscription.OrderAdded -= m_instrumentTradeSubscription_OrderAdded; m_instrumentTradeSubscription.OrderRejected -= m_instrumentTradeSubscription_OrderRejected; m_instrumentTradeSubscription.Dispose(); m_instrumentTradeSubscription = null; } if (m_priceSubscription != null) { m_priceSubscription.FieldsUpdated -= m_priceSubscription_FieldsUpdated; m_priceSubscription.Dispose(); m_priceSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (m_lock) { if (!m_disposed) { // Unattached callbacks and dispose of all subscriptions if (m_req != null) { m_req.Update -= m_req_Update; m_req.Dispose(); m_req = null; } if (m_ps != null) { m_ps.FieldsUpdated -= m_ps_FieldsUpdated; m_ps.Dispose(); m_ps = null; } // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose may be called on another thread due to garbage collection. // InvokeIfRequired is an extension method defined in Utility.cs within this project. // Please refer to Utility.cs for more information on what InvokeIfRequired is doing. Dispatcher.Current.InvokeIfRequired(() => { if (m_prodCat != null) { m_prodCat.ProductsUpdated -= new EventHandler <ProductCatalogUpdatedEventArgs>(productsUpdated); m_prodCat.Dispose(); m_prodCat = null; } if (m_instrumentCatalogSubscriptionList.Count > 0) { foreach (InstrumentCatalogSubscription instrCat in m_instrumentCatalogSubscriptionList.Values) { instrCat.InstrumentsUpdated -= new EventHandler <InstrumentCatalogUpdatedEventArgs>(instrumentsUpdated); instrCat.Dispose(); } m_instrumentCatalogSubscriptionList.Clear(); } foreach (MarketListViewItem market in m_marketList) { market.Dispose(); } m_marketList.Clear(); foreach (MarketListViewItem market in listViewMarketList.Items) { market.Dispose(); } listViewMarketList.Items.Clear(); foreach (FeedListViewItem feed in m_feedList) { feed.Dispose(); } m_feedList.Clear(); foreach (FeedListViewItem feed in listViewMarketFeeds.Items) { feed.Dispose(); } listViewMarketFeeds.Items.Clear(); }); TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (m_lock) { if (!m_disposed) { // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Shuts down the TT API and disposes the subscriptions </summary> //////////////////////////////////////////////////////////////////////////////////////////////////// public void Dispose() { if (object.ReferenceEquals(m_instrLookupRequest, null) == false) { m_instrLookupRequest.Dispose(); } if (object.ReferenceEquals(m_tsSubscription, null) == false) { m_tsSubscription.Dispose(); } TTAPI.Shutdown(); }
/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (m_lock) { if (!m_disposed) { // Unattached callbacks and dispose of all subscriptions if (m_req1 != null) { m_req1.Update -= m_req_Update; m_req1.Dispose(); m_req1 = null; } if (m_req2 != null) { m_req2.Update -= m_req_Update; m_req2.Dispose(); m_req2 = null; } if (m_ps != null) { m_ps.FieldsUpdated -= m_ps_FieldsUpdated; m_ps.Dispose(); m_ps = null; } if (m_ts != null) { m_ts.OrderAdded -= m_ts_OrderAdded; m_ts.OrderDeleted -= m_ts_OrderDeleted; m_ts.OrderFilled -= m_ts_OrderFilled; m_ts.OrderRejected -= m_ts_OrderRejected; m_ts.OrderUpdated -= m_ts_OrderUpdated; m_ts.Dispose(); m_ts = null; } if (m_casReq != null) { m_casReq.Completed -= m_casReq_Completed; m_casReq.Dispose(); m_casReq = null; } // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects foreach (InstrumentModel model in m_bindingModels.Values) { model.Dispose(); } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } m_shutdownInProcess = true; }
public void Dispose() { lock (m_Lock) { if (!m_isDisposed) { // Unattached callbacks and dispose of all subscriptions if (m_instrLookupRequest != null) { m_instrLookupRequest.OnData -= m_instrLookupRequest_OnData; m_instrLookupRequest.Dispose(); m_instrLookupRequest = null; } if (m_algoLookupSubscription != null) { m_algoLookupSubscription.OnData -= AlgoLookupSubscription_OnData; m_algoLookupSubscription.Dispose(); m_algoLookupSubscription = null; } if (m_priceSubscription != null) { m_priceSubscription.FieldsUpdated -= m_priceSubscription_FieldsUpdated; m_priceSubscription.Dispose(); m_priceSubscription = null; } if (m_algoTradeSubscription != null) { m_algoTradeSubscription.OrderUpdated -= m_algoTradeSubscription_OrderUpdated; m_algoTradeSubscription.OrderAdded -= m_algoTradeSubscription_OrderAdded; m_algoTradeSubscription.OrderDeleted -= m_algoTradeSubscription_OrderDeleted; m_algoTradeSubscription.OrderFilled -= m_algoTradeSubscription_OrderFilled; m_algoTradeSubscription.OrderRejected -= m_algoTradeSubscription_OrderRejected; m_algoTradeSubscription.ExportValuesUpdated -= m_algoTradeSubscription_ExportValuesUpdated; m_algoTradeSubscription.AlertsFired -= m_algoTradeSubscription_AlertsUpdated; m_algoTradeSubscription.Dispose(); m_algoTradeSubscription = null; } m_isDisposed = true; } TTAPI.Shutdown(); } }
private void Shutdown() { if (m_ts != null) { m_ts.OrderBookDownload -= OnOrderBookDownload; m_ts.OrderAdded -= OnOrderAdded; m_ts.OrderDeleted -= OnOrderDeleted; m_ts.OrderFilled -= OnOrderFilled; m_ts.OrderUpdated -= OnOrderUpdated; m_ts.OrderPendingAction -= OnOrderPendingAction; m_ts.OrderRejected -= OnOrderRejected; m_ts.Dispose(); m_ts = null; } TTAPI.Shutdown(); }
}//Dispose() protected virtual void Dispose(bool disposing) { bool isOkayToStop = true; // if TTAPI is now requested to shutdown, we have to wait for their callback before we shutdown lock (m_DisposeLock) { if (!m_IsDisposed) { if (disposing) { if (m_UAPI != null) { TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); isOkayToStop = false; } if (m_XAPI != null) { TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); isOkayToStop = false; } if (isOkayToStop) { if (m_Log != null) { m_Log.RequestStop(); m_Log = null; } if (m_Dispatcher != null) { m_Dispatcher.BeginInvokeShutdown(); m_Dispatcher = null; } } } } m_IsDisposed = true; if (isOkayToStop) // if we aren't waiting for TT to shutdown we can call our own shutdown { OnStopping(); } } }//Dispose()
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_timeAndSalesSubscription != null) { m_timeAndSalesSubscription.Update -= timeAndSalesSubscription_Update; m_timeAndSalesSubscription.Dispose(); m_timeAndSalesSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_priceSubscription != null) { m_priceSubscription.FieldsUpdated -= priceSubscription_FieldsUpdated; m_priceSubscription.Dispose(); m_priceSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_instrumentTradeSubscription != null) { m_instrumentTradeSubscription.ProfitLossChanged -= instrumentTradeSubscription_ProfitLossChanged; m_instrumentTradeSubscription.Dispose(); m_instrumentTradeSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
public void Dispose() { lock (m_Lock) { if (!m_isDisposed) { if (m_instCatSubscription != null) { m_instCatSubscription.OnData -= OnSpreadDefinitionNotification; m_instCatSubscription.Dispose(); m_instCatSubscription = null; } m_isDisposed = true; } TTAPI.Shutdown(); } }
public void shutdownTTAPI() { if (!m_shutdownInProcess) { if (m_prodCat != null) { m_prodCat.OnData -= new EventHandler <ProductCatalogEventArgs>(productsUpdated); m_prodCat.Dispose(); m_prodCat = null; } if (m_instrumentCatalogList?.Count > 0) { foreach (InstrumentCatalog instrCat in m_instrumentCatalogList.Values) { instrCat.OnData -= new EventHandler <InstrumentCatalogEventArgs>(instrumentsUpdated); instrCat.Dispose(); } m_instrumentCatalogList.Clear(); } if (m_marketList != null) { foreach (MarketListViewItem market in m_marketList) { market.Dispose(); } m_marketList.Clear(); foreach (MarketListViewItem market in listViewMarketList.Items) { market.Dispose(); } listViewMarketList.Items.Clear(); } TTAPI.Shutdown(); m_shutdownInProcess = true; } }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_spreadDetailSubscription != null) { m_spreadDetailSubscription.SpreadDetailsAdded -= spreadDetailsChanged; m_spreadDetailSubscription.SpreadDetailsDeleted -= spreadDetailsChanged; m_spreadDetailSubscription.SpreadDetailsUpdated -= spreadDetailsChanged; m_spreadDetailSubscription.Dispose(); m_spreadDetailSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
/// <summary> /// Shuts down the TT API /// </summary> public void Dispose() { lock (m_lock) { if (!m_disposed) { // Dispose of all request objects if (m_cdSub != null) { m_cdSub.CustomerDefaultsChanged -= m_cd_CustomerDefaultsChanged; m_cdSub.Dispose(); m_cdSub = null; } // TODO: DISPOSE OF ALL TT OBJECTS HERE! /*if (m_instrumentTradeSubscription != null) * { * m_instrumentTradeSubscription.OrderAdded -= m_instrumentTradeSubscription_OrderAdded; * m_instrumentTradeSubscription.OrderRejected -= m_instrumentTradeSubscription_OrderRejected; * m_instrumentTradeSubscription.Dispose(); * m_instrumentTradeSubscription = null; * } * * if (m_priceSubscription != null) * { * m_priceSubscription.FieldsUpdated -= m_priceSubscription_FieldsUpdated; * m_priceSubscription.Dispose(); * m_priceSubscription = null; * }*/ // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }
/// <summary> /// Dispose of all the TT API objects and shutdown the TT API /// </summary> public void shutdownTTAPI() { if (!m_shutdownInProcess) { // Dispose of all request objects if (m_tradeSubscription != null) { m_tradeSubscription.FillRecordAdded -= m_tradeSubscription_FillRecordAdded; m_tradeSubscription.AdminFillAdded -= m_tradeSubscription_AdminFillAdded; m_tradeSubscription.AdminFillDeleted -= m_tradeSubscription_AdminFillDeleted; m_tradeSubscription.FillBookDownload -= m_tradeSubscription_FillBookDownload; m_tradeSubscription.FillAmended -= m_tradeSubscription_FillAmended; m_tradeSubscription.Dispose(); m_tradeSubscription = null; } TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); } // only run shutdown once m_shutdownInProcess = true; }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { // Shutdown all subscriptions if (req != null) { req.Dispose(); req = null; } if (ps != null) { ps.Dispose(); ps = null; } // Shutdown the Dispatcher if (disp != null) { disp.BeginInvokeShutdown(); disp = null; } // Shutdown the TT API if (apiInstance != null) { //TTAPI.ShutdownCompleted += new EventHandler(); TTAPI.Shutdown(); apiInstance = null; } } } disposed = true; }
public void Dispose() { TTAPI.ShutdownCompleted += TTAPI_ShutdownCompleted; TTAPI.Shutdown(); }
public void Dispose() { lock (m_lock) { if (!m_disposed) { if (PlsDictionary != null) { foreach (ProductKey Pkey in PlsDictionary.Keys.ToList()) { PlsDictionary[Pkey].Update -= PLSEventHandler; PlsDictionary[Pkey].Dispose(); PlsDictionary[Pkey] = null; } PlsDictionary = null; } if (IcsDictionary != null) { foreach (ProductKey Pkey in IcsDictionary.Keys.ToList()) { IcsDictionary[Pkey].InstrumentsUpdated -= ICUEventHandler; IcsDictionary[Pkey].Dispose(); IcsDictionary[Pkey] = null; } IcsDictionary = null; } if (IlsDictionary != null) { foreach (InstrumentKey IKey in IlsDictionary.Keys.ToList()) { for (int j = 0; j < ilsUpdateList.Count; j++) { IlsDictionary[IKey].Update -= ilsUpdateList[j]; } IlsDictionary[IKey].Dispose(); IlsDictionary[IKey] = null; } IlsDictionary = null; } if (PsDictionary != null) { foreach (InstrumentKey Ikey in PsDictionary.Keys.ToList()) { PsDictionary[Ikey].FieldsUpdated -= priceUpdatedEventHandler; PsDictionary[Ikey].Dispose(); PsDictionary[Ikey] = null; } PsDictionary = null; } if (TsDictionary != null) { foreach (InstrumentKey IKey in TsDictionary.Keys.ToList()) { TsDictionary[IKey].OrderUpdated -= m_ts_OrderUpdated; TsDictionary[IKey].OrderAdded -= m_ts_OrderAdded; TsDictionary[IKey].OrderDeleted -= m_ts_OrderDeleted; TsDictionary[IKey].OrderFilled -= orderFilledEventHandler; TsDictionary[IKey].OrderRejected -= m_ts_OrderRejected; TsDictionary[IKey].Dispose(); TsDictionary[IKey] = null; } TsDictionary = null; } // Begin shutdown the TT API TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted); TTAPI.Shutdown(); m_disposed = true; } } }