void trade_OnRspUserLogin(object sender, Trade2015.IntEventArgs e) { if (e.Value == 0) { ShowMsg("登录成功"); Thread.Sleep(1500); //交易登录成功后,登录行情 if (quote == null) LoginSuccess(); else quote.ReqConnect(); } else { ShowMsg("登录错误"); trade.ReqUserLogout(); trade = null; quote = null; } }
void trade_OnRtnError(object sender, Trade2015.ErrorEventArgs e) { ShowMsg(string.Format("帐号({0}),错误:{1}--{2}", ((Trade)sender).Investor, e.ErrorID, e.ErrorMsg)); if (e.ErrorMsg.IndexOf("未处理请求超过许可数", StringComparison.Ordinal) >= 0) { //重发 Thread.Sleep(20); OrderField of; if (((Trade)sender).DicOrderField.TryGetValue(e.ErrorID, out of)) ((Trade)sender).ReqOrderInsert(of.InstrumentID, of.Direction, of.Offset, of.AvgPrice, of.Volume, of.Hedge, Math.Abs(of.LimitPrice) < 1E-6 ? OrderType.Market : OrderType.Limit, of.Custom); } Ring("指令单错误"); }
void _t_OnRtnError(object sender, Trade2015.ErrorEventArgs e) { //_curStra = null; if (e.ErrorMsg.IndexOf("no sysid", StringComparison.Ordinal) >= 0) { //Thread.Sleep(200); //_t.ReqOrderAction(e.ErrorID); } }