private void _q_OnFrontConnected(object sender, EventArgs e) { Logger.Info("connected"); // 如果断线后会自动重连,这里需要刷新历史数据 // 同时隔天开盘的时候,也是会自动重连的 FlushWriters(); map.Clear(); writers.Clear(); _q.ReqUserLogin(_investor, _pwd, _broker); }
//登陆 public void Login(Account account) { if (account != null && mQuoter.IsLogin) { return; } mAccount = account; //前置连接回调 mQuoter.OnFrontConnected += (object sender, EventArgs e) => { mQuoter.ReqUserLogin(account.Investor, account.Password, account.Broker); LogUtils.EnginLog("ctpmd:OnFrontConnected"); }; //登陆回调 mQuoter.OnRspUserLogin += (object sender, IntEventArgs e) => { mQuoter.ReqSubscribeMarketData(mSubscribeMap.Keys.ToArray <string>()); LogUtils.EnginLog("ctpmd:OnRspUserLogin:"******"ctpmd:OnRspUserLogout"); }; //行情回调 mQuoter.OnRtnTick += _onTick; //错误回调 mQuoter.OnRtnError += (object sender, ErrorEventArgs e) => { LogUtils.EnginLog("OnRtnError:" + e.ErrorMsg); }; //开始连接 mQuoter.ReqConnect(account.Server); }
private void _q_OnFrontConnected(object sender, EventArgs e) { Logger.Info("connected"); _q.ReqUserLogin(_investor, _pwd, _broker); }