コード例 #1
0
        public void ProcessNew(ref QuoteField quote, QuoteRecord record)
        {
            OrderRecord askRecord = new OrderRecord(record.AskOrder);

            this.workingOrders[quote.AskID]   = askRecord;
            this.orderIDs[askRecord.Order.Id] = quote.AskID;
            EmitExecutionReport(askRecord, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status);

            OrderRecord bidRecord = new OrderRecord(record.BidOrder);

            this.workingOrders[quote.BidID]   = bidRecord;
            this.orderIDs[bidRecord.Order.Id] = quote.BidID;
            EmitExecutionReport(bidRecord, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status);
        }
コード例 #2
0
        public void ProcessNew(ref QuoteField quote, QuoteRecord record)
        {
            OrderRecord askRecord = new OrderRecord(record.AskOrder);

            this.workingOrders.Add(quote.AskID, askRecord);
            this.orderIDs.Add(askRecord.Order.Id, quote.AskID);
            EmitExecutionReport(askRecord, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status);

            OrderRecord bidRecord = new OrderRecord(record.BidOrder);

            this.workingOrders.Add(quote.BidID, bidRecord);
            this.orderIDs.Add(bidRecord.Order.Id, quote.BidID);
            EmitExecutionReport(bidRecord, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status);
        }
コード例 #3
0
        public void ProcessNew(ref QuoteField quote, QuoteRecord record)
        {
            OrderRecord askRecord = new OrderRecord(record.AskOrder);
            this.workingOrders.Add(quote.AskID, askRecord);
            this.orderIDs.Add(askRecord.Order.Id, quote.AskID);
            EmitExecutionReport(askRecord, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status);

            OrderRecord bidRecord = new OrderRecord(record.BidOrder);
            this.workingOrders.Add(quote.BidID, bidRecord);
            this.orderIDs.Add(bidRecord.Order.Id, quote.BidID);
            EmitExecutionReport(bidRecord, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status);
        }
コード例 #4
0
        public void Process(ref QuoteField quote)
        {
            // 所有的成交信息都不处理,交给TradeField处理
            if (quote.ExecType == XAPI.ExecType.Trade)
            {
                return;
            }

            QuoteRecord record = null;

            switch (quote.ExecType)
            {
            case XAPI.ExecType.New:
                if (this.pendingOrders.TryRemove(quote.ID, out record))
                {
                    this.workingOrders.Add(quote.ID, record);
                    this.orderIDs.Add(record.AskOrder.Id, quote.ID);
                    this.orderIDs.Add(record.BidOrder.Id, quote.ID);

                    orderMap.ProcessNew(ref quote, record);

                    // 这个地方可以跳过
                    //EmitExecutionReport(record, quote.ExecType, quote.Status);
                }
                break;

            case XAPI.ExecType.Rejected:
                if (this.pendingOrders.TryRemove(quote.ID, out record))
                {
                    EmitExecutionReport(record, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status, quote.Text());
                }
                else if (this.workingOrders.TryGetValue(quote.ID, out record))
                {
                    // 比如说出现超出涨跌停时,先会到ProcessNew,所以得再多判断一次
                    workingOrders.Remove(quote.ID);
                    orderIDs.Remove(record.AskOrder.Id);
                    orderIDs.Remove(record.BidOrder.Id);
                    EmitExecutionReport(record, (SQ.ExecType)quote.ExecType, (SQ.OrderStatus)quote.Status, quote.Text());
                }
                break;

            case XAPI.ExecType.Cancelled:
                if (this.workingOrders.TryGetValue(quote.ID, out record))
                {
                    workingOrders.Remove(quote.ID);
                    orderIDs.Remove(record.AskOrder.Id);
                    orderIDs.Remove(record.BidOrder.Id);
                    EmitExecutionReport(record, SQ.ExecType.ExecCancelled, SQ.OrderStatus.Cancelled);
                }
                break;

            case XAPI.ExecType.PendingCancel:
                if (this.workingOrders.TryGetValue(quote.ID, out record))
                {
                    EmitExecutionReport(record, SQ.ExecType.ExecPendingCancel, SQ.OrderStatus.PendingCancel);
                }
                break;

            case XAPI.ExecType.CancelReject:
                if (this.pendingCancels.TryRemove(quote.ID, out record))
                {
                    EmitExecutionReport(record, SQ.ExecType.ExecCancelReject, (SQ.OrderStatus)quote.Status, quote.Text());
                }
                break;
            }
            if (record != null)
            {
                record.Status = (SQ.OrderStatus)quote.Status;
            }
        }
コード例 #5
0
 public void EmitExecutionReport(QuoteRecord record, SQ.ExecType execType, SQ.OrderStatus orderStatus, string text)
 {
     EmitExecutionReport(new OrderRecord(record.AskOrder), execType, orderStatus, text);
     EmitExecutionReport(new OrderRecord(record.BidOrder), execType, orderStatus, text);
 }