コード例 #1
0
        //
        //
        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            base.SetupBegin(myEngineHub, engineContainer);
            foreach (IEngine ieng in engineContainer.GetEngines())
            { // Find order Engine
                if (ieng is IOrderEngine)
                {
                    this.m_IOrderEngine = (IOrderEngine)ieng;                                             // find our order engine
                }
            }
            if (m_IOrderEngine is SingleLegExecutor)
            { // if this is a single leg order engine
                m_SingleLegExecutor = (SingleLegExecutor)m_IOrderEngine;
                this.m_Leg          = m_SingleLegExecutor.m_PriceLeg;
                m_MaxPossibleWorkingQuoteQtyPerLot += (int)(Math.Abs(m_Leg.Weight) * 2);            // leg ratios * 2 (each side)
            }
            // If we subscribe to order book creation, we can be sure to get all the info for all fills and submissions
            // this only works if create order books after setup beging.
            m_IOrderEngine.GetExecutionListener().OrderBookCreated += new EventHandler(ExecutionListener_OrderBookCreated);

            if (m_Hub is ExecutionHub)
            {                                                                    // set up ITimer to work
                ((ExecutionHub)m_Hub).SubscribeToTimer((ITimerSubscriber)m_ExecutionContainer.m_ExecutionListener);
                m_ExecutionContainer.m_ExecutionListener.SubscribeToTimer(this); // subscrie to updates
            }
        }