private void TraderAdapter_OnRspSettlementInfoConfirm( ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestId, bool bIsLast) { try { if (MyUtils.IsWrongRspInfo(pRspInfo)) { MyUtils.ReportError(pRspInfo, "结算信息确认错误"); return; } if (pSettlementInfoConfirm != null) { var temp = string.Format("结算信息确认回报:经纪公司代码:{0},确认日期:{1},确认时间:{2},投资者代码:{3}", pSettlementInfoConfirm.BrokerID, pSettlementInfoConfirm.ConfirmDate, pSettlementInfoConfirm.ConfirmTime, pSettlementInfoConfirm.InvestorID); } if (bIsLast) { Thread.Sleep(1000); ReqQryAllInstruments(); //查询所有合约 } } catch (Exception ex) { MessageBox.Show("结算确认发生异常,异常信息:" + ex.Message); } }
void TraderApi_OnRspEvent(object sender, OnRspEventArgs e) { bool err = IsError(e.RspInfo, e.EventType.ToString()); switch (e.EventType) { case EnumOnRspType.OnRspUserLogin: if (!err) { Console.WriteLine("登录成功"); var fld = Conv.P2S <ThostFtdcRspUserLoginField>(e.Param); Console.WriteLine("TradingDay is " + fld.TradingDay); ThostFtdcSettlementInfoConfirmField req = new ThostFtdcSettlementInfoConfirmField(); req.BrokerID = BrokerID; req.InvestorID = user; TraderApi.ReqSettlementInfoConfirm(req, ++iRequestID); } break; case EnumOnRspType.OnRspQryInstrument: if (e.Param != IntPtr.Zero) { var fld = Conv.P2S <ThostFtdcInstrumentField>(e.Param); Console.WriteLine("=====> {0}, {1}, isLast {2}", e.EventType, fld.InstrumentID, e.IsLast); } break; } }
public override void OnRspUserLogin(ThostFtdcRspUserLoginField pRspUserLogin, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (pRspInfo.ErrorID != 0) { LogCenter.Error("交易登录失败:" + pRspInfo.ErrorMsg); return; } LogCenter.Log("交易登录成功"); AccountCenter.Instance.IsTDLogin = true; this.instruments.Clear(); LogCenter.Log("请求查询合约"); int i = this.ReqQryInstrument(new ThostFtdcQryInstrumentField(), 0); if (i != 0) { LogCenter.Error("请求查询合约错误:" + CTPErrorHelper.GetError(i)); } var field = new ThostFtdcSettlementInfoConfirmField { BrokerID = AccountCenter.Instance.Account.BrokerID, InvestorID = AccountCenter.Instance.Account.InvestorID, ConfirmDate = DateTime.Today.ToString(), ConfirmTime = DateTime.Now.ToLongTimeString() }; LogCenter.Log("投资者结算结果确认"); i = this.ReqSettlementInfoConfirm(field, 0); if (i != 0) { LogCenter.Error("投资者结算结果确认错误:" + CTPErrorHelper.GetError(i)); } }
/// <summary> /// """确认结算信息回报""" /// </summary> /// <param name="pSettlementInfoConfirm"></param> /// <param name="pRspInfo"></param> /// <param name="nRequestID"></param> /// <param name="bIsLast"></param> public void HandleOnRspSettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (bIsLast) { Console.WriteLine("确认结算信息回报完毕"); } }
public override void OnRspUserLogin(ThostFtdcRspUserLoginField pRspUserLogin, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (pRspInfo.ErrorID != 0) { LogCenter.Error("交易登录失败:" + pRspInfo.ErrorMsg); return; } LogCenter.Log("交易登录成功"); AccountCenter.Instance.IsTDLogin = true; this.instruments.Clear(); LogCenter.Log("请求查询合约"); int i = this.ReqQryInstrument(new ThostFtdcQryInstrumentField(), 0); if (i != 0) { LogCenter.Error("请求查询合约错误:" + CTPErrorHelper.GetError(i)); } var field = new ThostFtdcSettlementInfoConfirmField { BrokerID = AccountCenter.Instance.Account.BrokerID, InvestorID = AccountCenter.Instance.Account.InvestorID, ConfirmDate = DateTime.Today.ToString(), ConfirmTime = DateTime.Now.ToLongTimeString() }; LogCenter.Log("投资者结算结果确认"); i = this.ReqSettlementInfoConfirm(field, 0); if (i != 0) { LogCenter.Error("投资者结算结果确认错误:" + CTPErrorHelper.GetError(i)); } }
void TraderApi_OnRspEvent(object sender, OnRspEventArgs e) { bool err = IsError(e.RspInfo, e.EventType.ToString()); switch (e.EventType) { case EnumOnRspType.OnRspAuthenticate: if (err) { Console.WriteLine("认证失败!!!"); } else { Console.WriteLine("认证成功!!!"); if (chkSubmitUserSystemInfo.Checked) { RegSystemInfo(); } ReqUserLogin(); } break; case EnumOnRspType.OnRspUserLogin: if (err) { Console.WriteLine("登录失败"); } else { Console.WriteLine("登录成功"); var fld = Conv.P2S <ThostFtdcRspUserLoginField>(e.Param); Console.WriteLine("TradingDay is " + fld.TradingDay); Console.WriteLine("CTP Version " + FtdcTdAdapter.GetApiVersion()); ThostFtdcSettlementInfoConfirmField req = new ThostFtdcSettlementInfoConfirmField(); req.BrokerID = this.txtBrokerID.Text; req.InvestorID = this.txtUserID.Text; TraderApi.ReqSettlementInfoConfirm(req, ++this.iRequestID); } break; case EnumOnRspType.OnRspQryInstrument: if (e.Param != IntPtr.Zero) { var fld = Conv.P2S <ThostFtdcInstrumentField>(e.Param); Console.WriteLine("=====> {0}, {1}, isLast {2}", e.EventType, fld.InstrumentID, e.IsLast); } break; case EnumOnRspType.OnRspQryDepthMarketData: if (e.Param != IntPtr.Zero) { var fld = Conv.P2S <ThostFtdcDepthMarketDataField>(e.Param); Console.WriteLine("=====> {0}, {1}, isLast {2}", e.EventType, fld.InstrumentID, e.IsLast); } break; } }
void OnRspSettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { __DEBUGPF__(); if (bIsLast && !IsErrorRspInfo(pRspInfo)) { ///请求查询合约 ReqQryInstrument(); } }
void OnRspSettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { DebugPrintFunc(new StackTrace()); if (bIsLast && !IsErrorRspInfo(pRspInfo)) { ///请求查询合约 ReqQryInstrument(); } }
void ReqSettlementInfoConfirm() { ThostFtdcSettlementInfoConfirmField req = new ThostFtdcSettlementInfoConfirmField(); req.BrokerID = BROKER_ID; req.InvestorID = INVESTOR_ID; int iResult = api.ReqSettlementInfoConfirm(req); Console.WriteLine("--->>> 投资者结算结果确认: " + ((iResult == 0) ? "成功" : "失败")); }
public void ReqSettlementInfoConfirm() { var req = new ThostFtdcSettlementInfoConfirmField { BrokerID = _brokerId, InvestorID = _investorId }; var iResult = ReqSettlementInfoConfirm(req, RequestId++); }
private void OnRspSettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField p, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { __DEBUGPF__(); if (bIsLast) { HandleStatusInternal("CTP投资者结算结果已确认"); // 获取合约信息 ReqQryInstrument(); } }
private void ReqSettlementInfoConfirm() { Thread.Sleep(1000); ThostFtdcSettlementInfoConfirmField confirm = new ThostFtdcSettlementInfoConfirmField(); confirm.BrokerID = BROKER_ID; confirm.InvestorID = INVESTOR_ID; int ret = trader.ReqSettlementInfoConfirm(confirm, iRequestID++); HandleStatusInternal("CTP投资者结算结果确认:" + (ret == 0 ? "成功" : "失败,返回代码" + ret)); }
/// <summary> /// 投资者结算结果应答 /// </summary> /// <param name="pSettlementInfoConfirm"></param> /// <param name="pRspInfo"></param> /// <param name="nRequestID"></param> /// <param name="bIsLast"></param> void OnRspSettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { DebugPrintFunc(new StackTrace()); if (bIsLast && !IsErrorRspInfo(pRspInfo)) { //请求查询银期签约关系 ReqQryAccountregister(); } }
void trader_OnRspSettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (pRspInfo.ErrorID != 0) { this.SetMsg("结算结果确认失败," + pRspInfo.ErrorMsg); } else { this.DoQryTradingAccount(); } }
/// <summary> /// 投资者结算结果确认 /// </summary> void ReqSettlementInfoConfirm() { ThostFtdcSettlementInfoConfirmField req = new ThostFtdcSettlementInfoConfirmField(); req.BrokerID = BROKER_ID; req.InvestorID = INVESTOR_ID; int iResult = api.ReqSettlementInfoConfirm(req, ++iRequestID); Console.WriteLine("--->>> 投资者结算结果确认:" + ((iResult == 0) ? "成功" : "失败")); }
/// <summary> /// 查询结算信息确认应答 /// </summary> /// <param name="pSettlementInfoConfirm"></param> /// <param name="pRspInfo"></param> /// <param name="nRequestID"></param> /// <param name="bIsLast"></param> void OnRspQrySettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { DebugPrintFunc(new StackTrace()); if (bIsLast && !IsErrorRspInfo(pRspInfo)) { //请求查询投资者结算结果 ReqQrySettlementInfo(); } }
public static extern int TdReqSettlementInfoConfirm(IntPtr pApi, ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, int nRequestID);
void trader_OnRspQrySettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (pSettlementInfoConfirm == null) { this.SetMsg("正在查询结算结果……"); try { ThostFtdcQrySettlementInfoField field = new ThostFtdcQrySettlementInfoField(); field.TradingDay = DateTime.Now.AddDays(-1).ToShortDateString(); Thread.Sleep(1000); this.trader.ReqQrySettlementInfo(field, requestID++); } catch (Exception exp) { this.SetMsg("结算结果查询失败," + exp.Message); } } else { this.DoQryTradingAccount(); } }
private void TDReqSettlementInfoConfirm() { ThostFtdcSettlementInfoConfirmField cReqSettlementInfoConfirm = new ThostFtdcSettlementInfoConfirmField(); cReqSettlementInfoConfirm.BrokerID = this.sBrokerID; cReqSettlementInfoConfirm.InvestorID = this.sUserID; int resault = this.CtpTDApi.ReqSettlementInfoConfirm(cReqSettlementInfoConfirm, ++nRequestID); }
///请求查询结算信息确认响应 public void OnRspQrySettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, ThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (!IsErrorRspInfo(pRspInfo)) { } }
/// <summary> ///投资者结算结果确认 /// </summary> public int ReqSettlementInfoConfirm(ThostFtdcSettlementInfoConfirmField pSettlementInfoConfirm, int nRequestID) { return(Interop.TdReqSettlementInfoConfirm(Handle, pSettlementInfoConfirm, nRequestID)); }
/// <summary> /// 处理投资者结算结果响应 /// </summary> void processRspQrySettlementInfo(ThostFtdcSettlementInfoField pSettlementInfo) { SettlementInfoConfirmDialog dialog = new SettlementInfoConfirmDialog(); if (pSettlementInfo != null && pSettlementInfo.Content != null) { dialog.Content = pSettlementInfo.Content; } if (dialog.ShowDialog(this) == DialogResult.OK) { this.SetMsg("正在确认结算结果……"); try { ThostFtdcSettlementInfoConfirmField field = new ThostFtdcSettlementInfoConfirmField(); field.BrokerID = this.trader.BrokerID; field.InvestorID = this.trader.InvestorID; field.ConfirmDate = DateTime.Now.ToShortDateString(); field.ConfirmTime = DateTime.Now.ToShortTimeString(); Thread.Sleep(1000); this.trader.ReqSettlementInfoConfirm(field, requestID++); } catch (Exception exp) { this.SetMsg("结算结果确认失败," + exp.Message); } } else { this.SetMsg("用户取消了操作!"); } }