public OnErrRtnOrderInsertArgs(IntPtr pTraderApi, ref CZQThostFtdcInputOrderField pInputOrder, ref CZQThostFtdcRspInfoField pRspInfo) { this.pTraderApi = pTraderApi; this.pInputOrder = pInputOrder; this.pRspInfo = pRspInfo; }
public OnRspOrderInsertArgs(IntPtr pTraderApi, ref CZQThostFtdcInputOrderField pInputOrder, ref CZQThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { this.pTraderApi = pTraderApi; this.pInputOrder = pInputOrder; this.pRspInfo = pRspInfo; this.nRequestID = nRequestID; this.bIsLast = bIsLast; }
private void OnRspOrderInsert(IntPtr pTraderApi, ref CZQThostFtdcInputOrderField pInputOrder, ref CZQThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { SingleOrder order; string strKey = string.Format("{0}:{1}:{2}", _RspUserLogin.FrontID, _RspUserLogin.SessionID, pInputOrder.OrderRef); if (_OrderRef2Order.TryGetValue(strKey, out order)) { if (OutputLogToConsole) { Console.WriteLine("CTP回应:{0},{1},开平{2},价{3},原量{4},引用{5},{6}", pInputOrder.InstrumentID, pInputOrder.Direction, pInputOrder.CombOffsetFlag, pInputOrder.LimitPrice, pInputOrder.VolumeTotalOriginal, pInputOrder.OrderRef, pRspInfo.ErrorMsg); } order.Text = string.Format("{0}|{1}", order.Text, pRspInfo.ErrorMsg); EmitRejected(order, order.Text); //这些地方没法处理混合报单 //没得办法,这样全撤了状态就唯一了 //但由于不知道在错单时是否会有报单回报,所以在这查一次,以防重复撤单出错 //找到对应的报单回应 Dictionary<string, CZQThostFtdcOrderField> _Ref2Action; if (_Orders4Cancel.TryGetValue(order, out _Ref2Action)) { lock (_Ref2Action) { _Ref2Action.Remove(strKey); if (0 == _Ref2Action.Count()) { _Orders4Cancel.Remove(order); return; } Cancel(order); } } } }
private void OnRspOrderInsert_callback(IntPtr pTraderApi, ref CZQThostFtdcInputOrderField pInputOrder, ref CZQThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast) { if (null != OnRspOrderInsert) { OnRspOrderInsert(this, new OnRspOrderInsertArgs(pTraderApi, ref pInputOrder, ref pRspInfo, nRequestID, bIsLast)); } }
private void OnErrRtnOrderInsert_callback(IntPtr pTraderApi, ref CZQThostFtdcInputOrderField pInputOrder, ref CZQThostFtdcRspInfoField pRspInfo) { if (null != OnErrRtnOrderInsert) { OnErrRtnOrderInsert(this, new OnErrRtnOrderInsertArgs(pTraderApi, ref pInputOrder, ref pRspInfo)); } }
private void OnErrRtnOrderInsert(IntPtr pTraderApi, ref CZQThostFtdcInputOrderField pInputOrder, ref CZQThostFtdcRspInfoField pRspInfo) { SingleOrder order; string strKey = string.Format("{0}:{1}:{2}", _RspUserLogin.FrontID, _RspUserLogin.SessionID, pInputOrder.OrderRef); if (_OrderRef2Order.TryGetValue(strKey, out order)) { tdlog.Error("交易所回应:{0},{1},开平{2},价{3},原量{4},引用{5},{6}#{7}", pInputOrder.InstrumentID, pInputOrder.Direction, pInputOrder.CombOffsetFlag, pInputOrder.LimitPrice, pInputOrder.VolumeTotalOriginal, pInputOrder.OrderRef, pRspInfo.ErrorID, pRspInfo.ErrorMsg); order.Text = string.Format("{0}|{1}#{2}", order.Text.Substring(0, Math.Min(order.Text.Length, 64)), pRspInfo.ErrorID, pRspInfo.ErrorMsg); EmitRejected(order, order.Text); //没得办法,这样全撤了状态就唯一了 Dictionary<string, CZQThostFtdcOrderField> _Ref2Action; if (_Orders4Cancel.TryGetValue(order, out _Ref2Action)) { lock (_Ref2Action) { _Ref2Action.Remove(strKey); if (0 == _Ref2Action.Count()) { _Orders4Cancel.Remove(order); return; } Cancel(order); } } } }