Esempio n. 1
0
        private void disconnectFromTWS()
        {
            logMessage("Disconnecting from TWS");
            setConnectionState(ConnectionState.Disconnected);
            mApi.eDisconnect();

            ReqContractDetailsButton.Enabled = false;

            ContractGrid.Rows.Clear();
            mDepthMgr.Clear();
            stopAllTickers();

            mNextTickerId = 0;
            mTickers.Clear();
        }
Esempio n. 2
0
        private void stopMarketDepth()
        {
            StopMarketDepthButton.Enabled = false;

            if (!mDepthMgr.InProgress)
            {
                return;
            }

            var marketDepthIndex = mNextDOMTickerId - 1 - MinimumMarketDepthId;

            if (mDOMTickers[marketDepthIndex] == null)
            {
                return;
            }

            var id = mNextDOMTickerId - 1;

            logMessage($"Stopping market depth: id={id}; {contractToString(mDOMTickers[marketDepthIndex].ContractDetails.Contract)}");
            mApi.cancelMktDepth(id, false);

            mDOMTickers[marketDepthIndex] = null;
            mDepthMgr.Clear();
        }