Ejemplo n.º 1
0
        /// <summary>
        /// 检查套利单是否有异常委托。
        /// </summary>
        /// <remarks>
        /// 1.非今日的历史委托回报未结束,无法更新,列入异常套利单
        /// </remarks>
        private ErrorArbitrageOrder CheckErrorArbitrageOrder(USeArbitrageOrder arbitrageOrder)
        {
            ErrorArbitrageOrder errorArbitrageOrder = new ErrorArbitrageOrder();

            errorArbitrageOrder.ArbitrageOrder = arbitrageOrder;

            List <ErrorUSeOrderBook> errorBookList = new List <ErrorUSeOrderBook>();

            if (arbitrageOrder.HasUnFinishOrderBook == false)
            {
                return(errorArbitrageOrder);
            }

            List <USeOrderBook> unFinishOrderBookList = arbitrageOrder.GetAllUnfinishOrderBooks();

            Debug.Assert(unFinishOrderBookList != null && unFinishOrderBookList.Count > 0);

            foreach (USeOrderBook orderBook in unFinishOrderBookList)
            {
                USeOrderBook newOrderBook = m_orderDriver.QueryOrderBook(orderBook.OrderNum);
                if (newOrderBook != null)
                {
                    OrderBookUpdateResult updateResult = arbitrageOrder.UpdateOrderBook(newOrderBook);
                    updateResult.Task.UpdateTaskState();
                    arbitrageOrder.UpdataArbitrageOrderState();
                    errorArbitrageOrder.HasChanged = true;
                }
                else
                {
                    ErrorUSeOrderBook errorOrderBook = new ErrorUSeOrderBook()
                    {
                        TradeIdentify = arbitrageOrder.TraderIdentify,
                        Alias         = arbitrageOrder.Alias,
                        OrderBook     = orderBook.Clone()
                    };
                    errorBookList.Add(errorOrderBook);
                }
            }

            errorArbitrageOrder.ErrorOrderBooks = errorBookList;

            return(errorArbitrageOrder);
        }