private void EmitCancelReject(GenericOrderItem item,int error_id,string message) { TextResponse r = new TextResponse() { Error = CTPAPI.FromCTP(error_id), ErrorID = error_id, ErrorMsg = message, }; foreach (var leg in item.GetLegs()) { r.OpenClose = leg.OpenClose; leg.Order.Text = r.ToString(); EmitCancelReject(leg.Order, leg.Order.OrdStatus, r.ToString()); } }
private void EmitCancelLastStatus(GenericOrderItem item) { foreach (var leg in item.GetLegs()) { OrdStatus status; if (orderMap.TryGetValue(leg.Order , out status)) { EmitExecutionReport(leg.Order, status); orderMap.Order_OrdStatus.Remove(leg.Order); } } }
private void EmitCancelled(GenericOrderItem item) { foreach (var leg in item.GetLegs()) { EmitCancelled(leg.Order); } }
private void EmitRejected(GenericOrderItem item, string message) { TextResponse r = new TextResponse() { Error = EnumError.OTHER, StatusMsg = message, }; foreach (var leg in item.GetLegs()) { r.OpenClose = leg.OpenClose; leg.Order.Text = r.ToString(); EmitRejected(leg.Order, r.ToString()); } }
private void UpdateOrderText(GenericOrderItem item, string message) { foreach (var leg in item.GetLegs()) { leg.Order.Text = message; } }
private void OnLastStatus(GenericOrderItem item, string OrderSysID, string Key) { // 一个单子成交完成,报单组可能还没有完,这个地方一定要留意 if (!item.IsDone()) return; foreach (var order in item.GetLegs()) { orderMap.Order_OrderItem.Remove(order.Order); } orderMap.OrderItem_OrderField.Remove(item); orderMap.OrderRef_OrderItem.Remove(Key); orderMap.OrderSysID_OrderRef.Remove(OrderSysID); }
private void OnRtnOrderFirstStatus(GenericOrderItem item, CThostFtdcOrderField pOrder, string OrderSysID, string Key) { // 向上层报告保单引用 if(OrderSysID.Length>0) { orderMap.OrderSysID_OrderRef[OrderSysID] = Key; foreach (var o in item.GetLegs()) { // 这个地方要再查一查,是不是要移动出来? o.Order.OrderID = pOrder.OrderSysID; } } // 判断是第一次报单,还是只是撤单时的第一条记录 if (!orderMap.OrderItem_OrderField.ContainsKey(item)) { // 在Order_OrderItem中记录绑定关系 foreach (var o in item.GetLegs()) { orderMap.Order_OrderItem[o.Order] = item; } EmitAccepted(item); } // 在OrderItem_OrderField中记录与API的对应关系 orderMap.OrderItem_OrderField[item] = pOrder; }