예제 #1
0
        private void Dispose()
        {
            if (_krakenClient != null)
            {
                _krakenClient.ConnectionFail      -= ConnectionFail;
                _krakenClient.ConnectionSucsess   -= ConnectionSucsess;
                _krakenClient.LogMessageEvent     -= SendLogMessage;
                _krakenClient.NewPortfolio        -= NewPortfolio;
                _krakenClient.NewMyTradeEvent     -= _Client_NewMyTradeEvent;
                _krakenClient.NewOrderEvent       -= _ibClient_NewOrderEvent;
                _krakenClient.NewTradeEvent       -= AddTick;
                _krakenClient.NewSecuritiesEvent  -= _krakenClient_NewSecuritiesEvent;
                _krakenClient.NewMarketDepthEvent -= _krakenClient_NewMarketDepthEvent;
            }

            try
            {
                if (_krakenClient != null && ServerStatus == ServerConnectStatus.Connect)
                {
                    _krakenClient.Disconnect();
                }
            }
            catch (Exception error)
            {
                SendLogMessage(error.ToString(), LogMessageType.Error);
            }

            _krakenClient = null;
        }
예제 #2
0
 /// <summary>
 /// создать новое подключение
 /// </summary>
 private void CreateNewServer()
 {
     if (_krakenClient == null)
     {
         _krakenClient = new KrakenServerClient();
         _krakenClient.ConnectionFail      += ConnectionFail;
         _krakenClient.ConnectionSucsess   += ConnectionSucsess;
         _krakenClient.LogMessageEvent     += SendLogMessage;
         _krakenClient.NewPortfolio        += NewPortfolio;
         _krakenClient.NewMyTradeEvent     += _Client_NewMyTradeEvent;
         _krakenClient.NewOrderEvent       += _ibClient_NewOrderEvent;
         _krakenClient.NewTradeEvent       += AddTick;
         _krakenClient.NewSecuritiesEvent  += _krakenClient_NewSecuritiesEvent;
         _krakenClient.NewMarketDepthEvent += _krakenClient_NewMarketDepthEvent;
         _krakenClient.DataType             = _loadDateType;
     }
 }