Exemplo n.º 1
0
 public static string ToFormattedString([In] this OrderField field)
 {
     return(string.Format("[InstrumentID={0};ExchangeID={1};Side={2};Qty={3};LeavesQty={4};Price={5};OpenClose={6};HedgeFlag={7};"
                          + "LocalID={8};ID={9};OrderID={10};Date={11};Time={12};"
                          + "Type={13};TimeInForce={14};Status={15};ExecType={16};"
                          + "XErrorID={17};RawErrorID={18};Text={19}]",
                          field.InstrumentID, field.ExchangeID, Enum <OrderSide> .ToString(field.Side), field.Qty, field.LeavesQty, field.Price, Enum <OpenCloseType> .ToString(field.OpenClose), Enum <HedgeFlagType> .ToString(field.HedgeFlag),
                          field.LocalID, field.ID, field.OrderID, field.Date, field.Time,
                          Enum <OrderType> .ToString(field.Type), Enum <TimeInForce> .ToString(field.TimeInForce), Enum <OrderStatus> .ToString(field.Status), Enum <ExecType> .ToString(field.ExecType),
                          field.XErrorID, field.RawErrorID, field.Text()));
 }
Exemplo n.º 2
0
 static void OnRtnOrder(object sender, ref OrderField order)
 {
     Console.WriteLine("AA " + order.Status + order.ExecType + order.Text() + "AA " + order.ID + "AA " + order.OrderID);
 }
Exemplo n.º 3
0
 static void OnRtnOrder(object sender, ref OrderField order)
 {
     Console.WriteLine("AA " + order.Status + order.ExecType + order.Text() + "AA " + order.ID + "AA " + order.OrderID);
 }
Exemplo n.º 4
0
        public void Process(ref OrderField order)
        {
            // 所有的成交信息都不处理,交给TradeField处理
            if (order.ExecType == XAPI.ExecType.Trade)
                return;

            OrderRecord record;

            switch (order.ExecType) {
                case XAPI.ExecType.New:
                    if (this.pendingOrders.TryRemove(order.LocalID, out record)) {
                        this.workingOrders.Add(order.ID, record);
                        // 将LocalID更新为ID
                        this.orderIDs[record.Order.Id] = order.ID;
                        EmitExecutionReport(record, (SQ.ExecType)order.ExecType, (SQ.OrderStatus)order.Status);
                    }
                    break;
                case XAPI.ExecType.Rejected:
                    if (this.pendingOrders.TryRemove(order.LocalID, out record))
                    {
                        orderIDs.Remove(record.Order.Id);
                        EmitExecutionReport(record, (SQ.ExecType)order.ExecType, (SQ.OrderStatus)order.Status, order.Text());
                    }
                    else if (this.workingOrders.TryGetValue(order.ID, out record)) {
                        // 比如说出现超出涨跌停时,先会到ProcessNew,所以得再多判断一次
                        workingOrders.Remove(order.ID);
                        orderIDs.Remove(record.Order.Id);
                        EmitExecutionReport(record, (SQ.ExecType)order.ExecType, (SQ.OrderStatus)order.Status, order.Text());
                    }
                    break;
                case XAPI.ExecType.Cancelled:
                    if (this.workingOrders.TryGetValue(order.ID, out record)) {
                        workingOrders.Remove(order.ID);
                        orderIDs.Remove(record.Order.Id);
                        EmitExecutionReport(record, SQ.ExecType.ExecCancelled, SQ.OrderStatus.Cancelled);
                    }
                    else if (this.pendingOrders.TryRemove(order.LocalID, out record))
                    {
                        orderIDs.Remove(record.Order.Id);
                        EmitExecutionReport(record, (SQ.ExecType)order.ExecType, (SQ.OrderStatus)order.Status, order.Text());
                    }
                    break;
                case XAPI.ExecType.PendingCancel:
                    if (this.workingOrders.TryGetValue(order.ID, out record)) {
                        EmitExecutionReport(record, SQ.ExecType.ExecPendingCancel, SQ.OrderStatus.PendingCancel);
                    }
                    break;
                case XAPI.ExecType.CancelReject:
                    if (this.pendingCancels.TryRemove(order.ID, out record)) {
                        EmitExecutionReport(record, SQ.ExecType.ExecCancelReject, (SQ.OrderStatus)order.Status, order.Text());
                    }
                    break;
            }
        }