Exemplo n.º 1
0
        /// <summary>
        /// 委托回报变更。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OrderDriver_OnOrderBookChanged(object sender, USeOrderBookChangedEventArgs e)
        {
            try
            {
                OrderBookUpdateResult result = null;
                lock (m_syncObj)
                {
                    result = m_arbitrageOrder.UpdateOrderBook(e.OrderBook);
                    if (result != null)
                    {
                        result.Task.UpdateTaskState();

                        m_arbitrageOrder.UpdataArbitrageOrderState();
                        m_operatorEvent.Set();
                    }
                }

                if (result != null)
                {
                    //委托更新触发流程监控运行
                    m_operatorEvent.Set();
                    SafeFireArbitrageOrderChanged();

                    AutoTraderNotice tradeNotice = result.CreateNotice(this.TraderIdentify, this.Alias);
                    if (tradeNotice != null)
                    {
                        SafeFireAutoTraderNotice(tradeNotice);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(false, ex.Message);
            }
        }
        /// <summary>
        /// 新增,变更委托单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OrderDriver_OnOrderBookChanged(object sender, USeOrderBookChangedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EventHandler <USeOrderBookChangedEventArgs>(OrderDriver_OnOrderBookChanged), sender, e);
                return;
            }

            UpdateOrderBook(e.OrderBook);
        }