Exemple #1
0
 /// <summary>
 /// создать новое подключение
 /// </summary>
 private void CreateNewServer()
 {
     if (_client == null)
     {
         _client                        = new NinjaTraderClient(Port, ServerAdress);
         _client.Connected             += Сlient_Connected;
         _client.UpdateSecuritiesEvent += _client_UpdatePairs;
         _client.Disconnected          += ClientnDisconnected;
         _client.UpdatePortfolio       += UpdatePortfolios;
         _client.UpdateMarketDepth     += UpdateMarketDepth;
         _client.NewTradesEvent        += NewTrades;
         _client.MyTradeEvent          += NewMyTrade;
         _client.MyOrderEvent          += BitMex_UpdateOrder;
         _client.LogMessageEvent       += SendLogMessage;
     }
 }
Exemple #2
0
 public void Connect()
 {
     if (_client == null)
     {
         _client                        = new NinjaTraderClient(((ServerParameterString)ServerParameters[1]).Value, ((ServerParameterPassword)ServerParameters[0]).Value);
         _client.Connected             += ClientOnConnected;
         _client.UpdateSecuritiesEvent += ClientOnUpdateSecuritiesEvent;
         _client.Disconnected          += ClientOnDisconnected;
         _client.UpdatePortfolio       += ClientOnUpdatePortfolio;
         _client.UpdateMarketDepth     += ClientOnUpdateMarketDepth;
         _client.NewTradesEvent        += ClientOnNewTradesEvent;
         _client.MyTradeEvent          += ClientOnMyTradeEvent;
         _client.MyOrderEvent          += ClientOnMyOrderEvent;
         _client.LogMessageEvent       += ClientOnLogMessageEvent;
     }
 }
Exemple #3
0
        public void Dispose()
        {
            if (_client != null)
            {
                _client.Dispose();

                _client.Connected             -= ClientOnConnected;
                _client.UpdateSecuritiesEvent -= ClientOnUpdateSecuritiesEvent;
                _client.Disconnected          -= ClientOnDisconnected;
                _client.UpdatePortfolio       -= ClientOnUpdatePortfolio;
                _client.UpdateMarketDepth     -= ClientOnUpdateMarketDepth;
                _client.NewTradesEvent        -= ClientOnNewTradesEvent;
                _client.MyTradeEvent          -= ClientOnMyTradeEvent;
                _client.MyOrderEvent          -= ClientOnMyOrderEvent;
                _client.LogMessageEvent       -= ClientOnLogMessageEvent;
            }

            _client      = null;
            ServerStatus = ServerConnectStatus.Disconnect;
        }