/// <summary>报单返回:目前仅处理错误信息</summary> private int onRspOrderInsert(String[] resStr) { FormTool.DisplayErrorMessage(resStr[7]); String[] result = new String[2]; result[0] = resStr[0]; result[1] = resStr[7]; DataProcess.OrderError(result); return(0); }
// -------------------------------------------------------------------------------- // 成交返回 private int onRtnTrade(String[] resStr) { Trade thistrade = new Trade(); thistrade.SetData(resStr, 0); lock (this.trade) { this.trade.Add(thistrade); } DataProcess.TradeProcess(thistrade); return(0); }
/// <summary>报单返回</summary> private int onRtnOrder(String[] resStr) { lock (order) { Order thisorder = new Order(); thisorder.SetData(resStr, 0); // 根据返回报单修改请求号,确保不重复(与订阅流的方式相关) long thisRequestID = long.Parse(thisorder.OrderRef) / 100; if (requestID < thisRequestID) { requestID = thisRequestID + 1; } // TODO: 对于拒绝的报单,如何展示、存储,需完善 if (thisorder.OrderSysID != null && !thisorder.OrderSysID.Trim().Equals("")) { // 当前列表中是否已包含该报单,存在则更新,否则则添加 int i = 0; for (i = 0; i < order.Count; i++) { if (order.ElementAt(i).OrderSysID.Equals(thisorder.OrderSysID)) { break; } } if (i < order.Count) { order.RemoveAt(i); } this.order.Add(thisorder); } else if (thisorder.OrderSysID.Trim().Equals("") && thisorder.OrderStatus.Equals("5")) { String[] result = new String[2]; int len = resStr[9].Length - 2; result[0] = resStr[9].Substring(0, len); result[1] = resStr[56]; DataProcess.OrderError(result); } } return(0); }