Esempio n. 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
            }
        }
 void IStringifiable.AddSubElement(IStringifiable subElement)
 {
     if (subElement is PriceLeg)
     {
         if (m_PriceLeg == null)
         {
             m_PriceLeg = ((PriceLeg)subElement);
         }
         else
         {
             throw new Exception("Implemented Order Engine can only handle 1 leg, however more than 1 has been assigned");
         }
     }
 }
Esempio n. 3
0
        void IStringifiable.AddSubElement(IStringifiable subElement)
        {
            base.AddSubElement(subElement);
            Type type = subElement.GetType();

            if (type == typeof(PriceLeg))
            {
                m_PriceLeg        = (PriceLeg)subElement;
                this.m_EngineName = string.Format("CurveLeg:{0}", m_PriceLeg.InstrumentName.ToString());       // set our name.
            }
            else if (type == typeof(Scratcher))
            {
                m_Scratcher            = (Scratcher)subElement;
                m_Scratcher.m_PriceLeg = this.m_PriceLeg;
            }
        }
Esempio n. 4
0
 //
 //
 public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
 {
     base.SetupBegin(myEngineHub, engineContainer);
     foreach (IEngine ieng in engineContainer.GetEngines())
     { // Find Pricing Engine
         if (ieng is PricingEngine)
         {
             PricingEngine priceEngine = (PricingEngine)ieng;
             this.m_Leg = priceEngine.m_Legs[0];                                                 // keep pointer to legs.
             m_MaxPossibleWorkingQuoteQtyPerLot += (int)(Math.Abs(m_Leg.Weight) * 2);            // leg ratios * 2 (each side)
         }
         else if (ieng is OrderEngine)
         {
             this.m_OrderEngine = (OrderEngine)ieng;                                             // find our order engine
         }
     }
     ((StrategyHub)myEngineHub).SubscribeToTimer((Strategy)engineContainer, this);           // get periodic updates from ITimer.
 }
Esempio n. 5
0
        void IStringifiable.AddSubElement(IStringifiable subElement)
        {
            base.AddSubElement(subElement);
            Type type = subElement.GetType();

            if (type == typeof(PriceLeg))
            {
                m_PriceLeg        = (PriceLeg)subElement;
                this.m_EngineName = string.Format("QuoterLeg:{0}", m_PriceLeg.InstrumentName.ToString());       // set our name.
            }
            else if (type == typeof(Hedger))
            {
                m_Hedger = (Hedger)subElement;
                m_Hedger.m_SpreaderLeg = this;            // give pointer to ourself
            }
            else if (type == typeof(HedgeRuleManager))
            {
                m_HedgeRuleManager             = (HedgeRuleManager)subElement;
                m_HedgeRuleManager.m_QuoterLeg = this;
            }
        }