Esempio n. 1
0
        public void OnConnectionStatus_MarketData(object sender, ConnectionStatus status, ref LoginInfo userLogin)
        {
            this.marketDataLoginInfo = userLogin;
            logUtils.WriteLog("登陆数据服务器:" + status);
            logUtils.WriteLog("用户:" + userLogin.AccountID + "|" + userLogin.InvestorName);

            if (status == ConnectionStatus.Logined)
            {
                //登陆成功Beep
                System.Media.SystemSounds.Beep.Play();

                Type     type        = currentMarket.GetType();
                string[] nameDescArr = PluginAssembly.GetPluginNameDesc(type);
                //如果交易日期改了,需要重新创建一个tickbarwriter,否则程序隔夜跑的时候
                int date = marketDataLoginInfo.TradingDay;
                if (this.tickDataReceiver == null || this.tickDataReceiver.Date != date)
                {
                    //TODO tickbarwriter需要flush一下
                    this.marketPath       = path + "\\" + nameDescArr[0] + "\\";
                    this.tickDataReceiver = new DataReceiver_Tick(marketPath, marketDataLoginInfo.TradingDay);
                    if (onReceiverPrepared != null)
                    {
                        onReceiverPrepared(this, tickDataReceiver);
                    }
                }
            }
        }
Esempio n. 2
0
 private void clearCurrentDataReceiver()
 {
     if (this.dataReceiver_Tick != null)
     {
         this.dataReceiver_Tick.OnTickDataReceived = null;
         this.dataReceiver_Tick = null;
     }
     this.dic_Code_Receive.Clear();
 }
Esempio n. 3
0
        private void onReceiverPrepared(object sender, DataReceiver_Tick dataReceiver_Tick)
        {
            this.clearCurrentDataReceiver();

            this.dataReceiver_Tick = dataReceiver_Tick;
            this.dataReceiver_Tick.OnTickDataReceived = onTickDataReceived;

            int date = dataReceiver_Tick.Date;

            foreach (string code in receiveCodes)
            {
                dic_Code_Receive.Add(code, new RealTimeDataReceiver_Code(code, date, dataReaderFactory, lastOpenDate, klinePeriods, plugin_Market.MarketData.GetTradingSession(code, date)));
            }
        }