예제 #1
0
        /// <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   -= instrumentTradeSubscription_OrderAdded;
                    m_instrumentTradeSubscription.OrderDeleted -= instrumentTradeSubscription_OrderDeleted;
                    m_instrumentTradeSubscription.Dispose();
                    m_instrumentTradeSubscription = null;
                }

                TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted);
                TTAPI.Shutdown();
            }

            // only run shutdown once
            m_shutdownInProcess = true;
        }
예제 #2
0
        /// <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;
        }
        /// <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;
                    }
                    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;
                    }

                    // Begin shutdown the TT API
                    TTAPI.ShutdownCompleted += new EventHandler(TTAPI_ShutdownCompleted);
                    TTAPI.Shutdown();

                    m_disposed = true;
                }
            }
        }
예제 #4
0
        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_priceSubscription != null)
                    {
                        m_priceSubscription.FieldsUpdated -= m_priceSubscription_FieldsUpdated;
                        m_priceSubscription.Dispose();
                        m_priceSubscription = null;
                    }
                    if (m_instrumentTradeSubscription != null)
                    {
                        m_instrumentTradeSubscription.OrderUpdated  -= m_instrumentTradeSubscription_OrderUpdated;
                        m_instrumentTradeSubscription.OrderAdded    -= m_instrumentTradeSubscription_OrderAdded;
                        m_instrumentTradeSubscription.OrderDeleted  -= m_instrumentTradeSubscription_OrderDeleted;
                        m_instrumentTradeSubscription.OrderFilled   -= m_instrumentTradeSubscription_OrderFilled;
                        m_instrumentTradeSubscription.OrderRejected -= m_instrumentTradeSubscription_OrderRejected;
                        m_instrumentTradeSubscription.Dispose();
                        m_instrumentTradeSubscription = null;
                    }

                    m_isDisposed = true;
                }


                TTAPI.Shutdown();
            }
        }