Ejemplo n.º 1
0
        public void Subscribe(Data.MarketData marketData)
        {
            Asset asset = GetPxAsset(marketData.Instrument);

            if (asset == null)
            {
                LogEventArgs.ProcessEventArgs(new LogEventArgs(string.Format("{0}: Failed to subscribe to instrument '{1}': empty symbol map", m_NTconnection.Options.Name, marketData.Instrument.FullName), NinjaTrader.Cbi.LogLevel.Error, LogCategory.Connection));
                return;
            }

            if (m_subscriptions.ContainsKey(asset.ExchangeCode))
            {
                return;
            }

            m_subscriptions.Add(asset.ExchangeCode, marketData);

            // If this is the first time subscribe for quotes
            if (m_subscriptions.Count == 1)
            {
                m_pxConnector.Send(pxNetAdapter.Request.MarketData.SubscribeForQuotes(m_token, m_userInfo.GUID), res => {
                    if (res.Error != null && !string.IsNullOrEmpty(res.Error.Code))
                    {
                        LogEventArgs.ProcessEventArgs(new LogEventArgs("Unable to subscribe to L1 data for instrument '" + marketData.Instrument.FullName + "': " + res.Error.Message, NinjaTrader.Cbi.LogLevel.Error));
                    }
                });
            }
        }
Ejemplo n.º 2
0
        public void Connect()
        {
            if (m_state != ConnectionStateEnum.Disconnected)
            {
                LogEventArgs.ProcessEventArgs(new LogEventArgs("Connect was called but PXAdapter state is " + m_state, NinjaTrader.Cbi.LogLevel.Warning));
                return;
            }

            m_pxConnector.Connect("dev-site01.toyga.local", 10300);
        }