Ejemplo n.º 1
0
 protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
 {
     base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
     m_Hub      = (Hub)myEngineHub;
     this.m_Log = m_Hub.Log;                                              // set up our logging
     this.m_ExecutionContainer = (ExecutionContainer)engineContainer;
 }
Ejemplo n.º 2
0
        //
        //
        // ******************************************************
        // ****             Setup Initialize()               ****
        // ******************************************************
        /// <summary>
        /// Since we are a specialized gui manager, we override SetupInitialize()
        /// and don't create a default popup gui.
        /// </summary>
        /// <param name="myEngineHub"></param>
        /// <param name="engineContainer"></param>
        /// <param name="engineID"></param>
        /// <param name="isSetupGui"></param>
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool isSetupGui)
        {
            base.SetupInitialize(myEngineHub, engineContainer, engineID, false);// call base class first.

            m_Parent = (Strategy)engineContainer;
            m_ParentEngineContainerID = engineContainer.EngineContainerID;
            Log = m_Parent.StrategyHub.Log;

            // Set the plotting hour offset.
            m_StartTime = m_Parent.StrategyHub.GetLocalTime();
            m_StartHour = m_StartTime.Hour + m_StartTime.Minute / 60.0 + m_StartTime.Second / 3600.0;
            if (m_StartHour >= 16.0)
            {
                m_StartHour -= 24.0;                            // after 4pm, shift to negative numbers (new trading day).
            }
            //
            // Add our custom ZGraphControl template
            //
            UV.Lib.FrontEnds.GuiTemplates.EngineGui engineGui = new Lib.FrontEnds.GuiTemplates.EngineGui();
            engineGui.DisplayName           = "Graph";
            engineGui.EngineID              = this.m_EngineID;
            engineGui.EngineFullName        = this.GetType().FullName;
            engineGui.HeaderControlFullName = typeof(UV.Lib.FrontEnds.Graphs.ZGraphControl).FullName;
            engineGui.ParameterList.AddRange(this.m_PInfo);
            m_EngineGuis.Add(engineGui);
        }//SetupInitialize()
Ejemplo n.º 3
0
        //
        // *****************************************
        // ****         Setup Begin()           ****
        // *****************************************
        /// <summary>
        /// This is called after all Engines have been created, and added to the master
        /// list inside the Strategy (IEngineContainer).
        /// As a convenience, the PricingEngine class locates useful Engines and keeps
        /// pointers to them.
        /// </summary>
        /// <param name="myEngineHub"></param>
        /// <param name="engineContainer"></param>
        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            base.SetupBegin(myEngineHub, engineContainer);

            // Locate engines we need.
            m_MarketSubscribers = new List <IMarketSubscriber>();
            foreach (IEngine iEngine in engineContainer.GetEngines())
            {
                if (iEngine is ZGraphEngine)
                {
                    m_GraphEngine = (ZGraphEngine)iEngine;                  // PricingEngines also plot a lot.
                }
                else if (iEngine is IMarketSubscriber)
                {
                    m_MarketSubscribers.Add((IMarketSubscriber)iEngine);
                }
            }

            //
            // Subscribe to Pricing instruments.
            //
            List <InstrumentName> instruments = new List <InstrumentName>();

            foreach (PriceLeg leg in m_Legs)                                // Subscribe to each "PricingLeg" object.
            {
                instruments.Add(leg.InstrumentName);
            }
            this.ParentStrategy.StrategyHub.SubscribeToMarketInstruments(instruments, this.ParentStrategy);
        }//SetupBegin()
Ejemplo n.º 4
0
 //
 //
 public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
 {
     if (ParentStrategy != null)
     {
         m_QuoteTickSize = ParentStrategy.m_OrderEngine.QuoteTickSize;
     }
 }
Ejemplo n.º 5
0
 //
 //
 // ****             Setup Begin()               ****
 //
 public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
 {
     base.SetupBegin(myEngineHub, engineContainer);
     m_Name   = base.EngineName;
     m_Parent = (Strategy)engineContainer;
     this.Log = ((StrategyHub)myEngineHub).Log;
 }//SetupBegin()
Ejemplo n.º 6
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
            }
        }
Ejemplo n.º 7
0
        //
        //
        // ****         SetupBegin()            ****
        //
        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            base.SetupBegin(myEngineHub, engineContainer);
            m_Parent = (Strategy)engineContainer;
            Log      = ((Hub)myEngineHub).Log;

            // Get Engines of interest.
            int modelCounter = 0;

            foreach (IEngine ieng in m_Parent.GetEngines())
            {
                if (ieng is ZGraphEngine)
                {
                    if (m_GraphEngine == null)
                    {
                        m_GraphEngine = (ZGraphEngine)ieng;                 // take first found graph engine to draw to.
                    }
                }
                else if (ieng is ModelEngine)
                {
                    if (ieng == this)
                    {
                        m_ModelEngineID = modelCounter;
                    }                                                           // store the number of models in front of me (use as my id!)
                    modelCounter++;
                }
            }
        }//SetupBegin()
Ejemplo n.º 8
0
 protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
 {
     base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
     m_StrategyHub = (StrategyHub)myEngineHub;
     this.m_Log    = m_StrategyHub.Log;                                           // set up our logging
     this.m_Market = m_StrategyHub.m_Market;                                      // grab the market so we can have some instrument details
 }
Ejemplo n.º 9
0
        //
        //
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
            ExecutionContainer execContainer = (ExecutionContainer)engineContainer;

            execContainer.TryAddEngine(m_Hedger);   // add my sub engines to the container.
            execContainer.TryAddEngine(m_HedgeRuleManager);
        }
Ejemplo n.º 10
0
        }//SetupInitialize()

        //
        //
        // *************************************************
        // ****             SetupBegin()                 ****
        // *************************************************

        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            base.SetupBegin(myEngineHub, engineContainer);


            // ParentStrategy.StrategyHub.SubscribeToTimer(ParentStrategy, this);
            // ParentStrategy.m_OrderEngine.QuoteTickSize = m_QuoteTickSize; // set our quote tick size for proper rounding
        }
Ejemplo n.º 11
0
 //
 // *****************************************
 // ****     Setup Initialize()          ****
 // *****************************************
 protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
 {
     base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
     //
     // Keep pointers to important objects.
     //
     this.ParentStrategy = (Strategy)engineContainer;
     this.Log            = ((Hub)myEngineHub).Log;                   // Pricing engines tend to log a lot, so keep a pointer.
 }
Ejemplo n.º 12
0
        //
        //
        public void BroadcastParameter(IEngineHub hub, IEngineContainer parent, string parameterName)
        {
            int id = GetParameterId(parameterName);

            if (id > -1)
            {
                BroadcastParameter(hub, parent, id);
            }
        }
Ejemplo n.º 13
0
        //
        //
        //
        // *****************************************************************
        // ****                 Initialize MultiPanel()                 ****
        // *****************************************************************
        private void InitializeMultiPanel(IEngineContainer parentContainer, EngineContainerGui guiContainer)
        {
            m_EngineContainerID = parentContainer.EngineContainerID;

            // Try to create any hudpanels discovered
            List <HudPanel> newHudPanels = new List <HudPanel>();

            foreach (EngineGui engineGui in guiContainer.m_Engines)
            {
                if (string.IsNullOrEmpty(engineGui.LowerHudFullName))
                {
                    continue;
                }
                Control newControl = null;
                Type    guiType    = typeof(EngineControl);
                if (Stringifiable.TryGetType(engineGui.LowerHudFullName, out guiType))     // Check whether this control is known to us!
                {
                    if (Utilities.GuiCreator.TryCreateControl(out newControl, guiType, engineGui))
                    {   // We have successfully created the desired control.
                        if (newControl is HudPanel)
                        {
                            newHudPanels.Add((HudPanel)newControl);
                        }
                    }
                }
            }



            int maxX = 0;
            int maxY = 0;

            this.SuspendLayout();
            foreach (HudPanel control in newHudPanels)
            {
                if (control != null)                                    // each engine has entry here, even if its null. (but why?)
                {
                    m_EngineControlList.Add(control.EngineId, control);
                    control.Size     = control.SmallestSize;            // force panel to be smallest size possible.
                    control.Location = new Point(m_NextPanelXLoc, m_NextPanelYLoc);
                    // update layout control parameters.
                    m_NextPanelXLoc += control.Size.Width;
                    maxX             = Math.Max(maxX, control.Location.X + control.Width);
                    maxY             = Math.Max(maxY, control.Location.Y + control.Height);
                    this.Controls.Add(control);
                }
            }//next engine
            // Resize myself.
            this.ClientSize = new Size(maxX, maxY);     // make this as small as possible, Cluster will resize again.
            if (m_EngineControlList.Count == 0)
            {
                this.Visible = false;
            }

            this.ResumeLayout(false);
        }//InitializeMultiPanel()
Ejemplo n.º 14
0
        }// GetParameterValue()

        //
        //
        //
        //
        //
        // ****           Get Event For Parameter Values                ****
        //
        /// <summary>
        /// This method allows an outsider to ask the Engine to automatically create
        /// the appropriate EngineEventArg that can be used to have it broadcast its
        /// current parameter values.
        /// This is useful when the Engine's parameters have been changed internally
        /// by some method, orther than the usual EngineEventArg parameter Change request,
        /// which will usually produce a response event automatically anyway.
        /// For example, use this when an engine parameter spontaneously changes (from
        /// a market event, or fill, or by the action of a model) to send the new parameter
        /// values to all GUIs, even though no one requested one.
        /// </summary>
        public virtual EngineEventArgs GetEventForParameterValues(IEngineContainer parent)
        {
            EngineEventArgs newEvent = new EngineEventArgs();

            newEvent.MsgType           = EngineEventArgs.EventType.ParameterValue;
            newEvent.Status            = EngineEventArgs.EventStatus.Request;
            newEvent.EngineContainerID = parent.EngineContainerID;
            newEvent.EngineID          = this.EngineID;
            return(newEvent);
        }// GetEventForParameterValues();
Ejemplo n.º 15
0
        //
        // *****************************************
        // ****     Setup Initialize()          ****
        // *****************************************
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);

            // Keep pointers to important objects.
            this.ParentStrategy = (Strategy)engineContainer;


            // TODO: Locate the Alarm service.
        }
Ejemplo n.º 16
0
 //
 //
 // ************************************************
 // ****             SetupInitialize()          ****
 // ************************************************
 /// <summary>
 /// This is called immediately after construction, when we add this engine to its strategy.
 /// During this call the Parameter tables *must* be created, and all *Gui Templates* must be
 /// created.
 /// If an Engine wants to create additional Engines, it should be done here.  Since *after*
 /// this initialize call (that is, during the SetupBegin() call), Engines can assume that all
 /// other Engines have been created and added to the EngineList of the WStrategy.
 /// The short explanation:
 ///     Setup Initialize:   Strategy, StrategyHub and other ApplicationServices exist.
 ///     Setup Begin:        All Engines within my Strategy exist, and were SetupInitialize().
 ///     Setup Complete:     All Engines in all Strategies exist and were SetUpBegin().
 /// Note:
 ///     1)  At this point, the Strategy has been created, but possibly no others.
 ///     2)  The other engines in the Strategy may also not be created at this point.
 ///         * Therefore, Engines should not look for other Strategies of other Engines.
 ///     3)  Subclasses should call this base-class method FIRST (so engineID is set) before other implementations.
 /// </summary>
 public void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID)
 {
     if (engineID >= 0)                                              // If engineID provide is positive, then
     {
         m_EngineID = engineID;                                      // accept ID provided by my parent Strategy. Otherwise leave it alone.
     }
     // This is useful when its assigned at construction time already.
     m_Parent = engineContainer;
     SetupInitialize(myEngineHub, engineContainer, engineID, true);  // default is to creaet the default Gui templates.
 }// SetupInitialize()
Ejemplo n.º 17
0
        //
        //
        //
        //
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
            // Request historic data for plots.
            DateTime end   = ParentStrategy.StrategyHub.GetLocalTime();
            DateTime start = end.AddHours(-m_NHoursHistoricData);            // TODO: allow this to passed in as istringifiable param?

            base.RequestHistoricData(start, end);
            m_IEngineHub = myEngineHub;
        }
Ejemplo n.º 18
0
        //
        // *********************************************
        // ****         SetUp Initialize()          ****
        // *********************************************
        /// <summary>
        /// </summary>
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            // Save information about local strategy hub.
            m_EngineContainerId = engineContainer.EngineContainerID;
            if (myEngineHub is IService)
            {
                m_LocalEngineHubName = ((IService)myEngineHub).ServiceName;
            }
            StrategyHub strategyHub = ((StrategyHub)myEngineHub);

            this.Log         = strategyHub.Log;
            m_LocalEngineHub = myEngineHub;

            // Locate our target remote hub/service.
            IEngineHub   remoteEngineHub = null;
            EventHandler del             = new EventHandler(ProcessRemoteEngineEvents);

            if (strategyHub.SubscribeToRemoteEngineHub("ExecutionHub", m_EngineContainerId, m_EngineID, del, out remoteEngineHub))
            {
                m_RemoteEngineHub = remoteEngineHub;
            }
            else
            {
                throw new Exception("Failed to locate remote hub.");
            }


            // Create the parameter table.
            Type remoteEngineType;

            if (Stringifiable.TryGetType(m_RemoteEngineClassName, out remoteEngineType))
            {
                this.m_PInfo = CreateParameterInfo(myEngineHub, engineContainer.EngineContainerID, this.EngineID, remoteEngineType);
            }

            //
            // Add sub-engines to the parent Strategy
            //
            //  They will be automatically initialized outside in StrategyHub loop
            //  that called us, since we will add new engine to the end of the list we are looping thru now.
            List <IStringifiable> subElements = m_Node.GetElements();

            if (subElements != null)
            {
                foreach (IStringifiable iObject in subElements)
                {                                       // Engines that are beneath non-engines will not be found here.
                    if (iObject is ExecutionController) // This remote engine will not need to broad its existance,
                    {
                        ExecutionController subEngine = (ExecutionController)iObject;
                        subEngine.m_IsSubEngine = true;                     // since it will be included in another engine (this one).
                        ((Strategy)engineContainer).TryAddEngine(subEngine, myEngineHub);
                    }
                }
            }
        }//SetupInitialize()
Ejemplo n.º 19
0
        //
        //
        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            base.SetupBegin(myEngineHub, engineContainer);

            if (myEngineHub is ExecutionHub)
            { // set up ITimer to work
                ThreadContainer execContainer = (ThreadContainer)engineContainer;
                ((ExecutionHub)myEngineHub).SubscribeToTimer((ITimerSubscriber)execContainer.m_ExecutionListener);
                execContainer.m_ExecutionListener.SubscribeToTimer(this); // subscribe to updates
            }
        }
Ejemplo n.º 20
0
 //
 public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
 {
     base.SetupBegin(myEngineHub, engineContainer);
     foreach (IEngine eng in engineContainer.GetEngines())
     {
         if (eng is IOrderEngine)
         {   // find our orer engine and our execution listner
             m_ExecutionListener = ((IOrderEngine)eng).GetExecutionListener();
             continue;
         }
     }
 }
Ejemplo n.º 21
0
        //
        // *****************************************
        // ****     Setup Initialize()          ****
        // *****************************************
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            base.SetupInitialize(myEngineHub, engineContainer, engineID, false);
            EngineGui engineGui = base.SetupGuiTemplates();

            if (engineContainer is Strategy)
            {
                ParentStrategy = (Strategy)engineContainer;
                Log            = ParentStrategy.StrategyHub.Log;
            }
            m_Services = AppServices.GetInstance();
        }
Ejemplo n.º 22
0
        private Dictionary <int, int> m_OppositeOrderIDToIPrice             = new Dictionary <int, int>();            // map order ids to IPrice we want to scratch

        #endregion                                                                                                    // members

        #region Constructors
        // *****************************************************************
        // ****                     Constructors                        ****
        // *****************************************************************
        //
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            this.m_EngineName = string.Format("Scratcher:{0}", m_PriceLeg.InstrumentName);
            if (typeof(UV.Strategies.ExecutionHubs.ExecutionContainers.MultiThreadContainer).IsAssignableFrom(engineContainer.GetType()))
            {                                                          // this is the "first" set up call from the manager container.
                base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
                m_Log = ((ExecutionHubs.ExecutionHub)myEngineHub).Log; // keep pointer to log
            }
            else
            {   // this is the second set up call from the correct container, add correct sub engine mappings
            }
        }
Ejemplo n.º 23
0
        private OrderEventArgs m_OrderEventArg; // careful, but this is always recycled

        #endregion                              // members


        #region Constructors
        // *****************************************************************
        // ****                     Constructors                        ****
        // *****************************************************************
        //
        //
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            if (typeof(UV.Strategies.ExecutionHubs.ExecutionContainers.MultiThreadContainer).IsAssignableFrom(engineContainer.GetType()))
            {   // this is the "first" set up call from the manager container.
                base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
                m_Log = ((ExecutionHubs.ExecutionHub)myEngineHub).Log;
            }
            else
            {   // this is the second set up call from the correct container, add correct sub engine mappings
                m_ExecutionContainer = (ThreadContainer)engineContainer;
            }
        }
Ejemplo n.º 24
0
 //
 public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
 {
     base.SetupBegin(myEngineHub, engineContainer);
     m_Log = ((ExecutionHub)myEngineHub).Log;
     foreach (IEngine iEng in engineContainer.GetEngines())
     {// find our needed engine pointers
         if (iEng is ExecutionEngines.OrderEngines.Spreader)
         {
             m_Quoter = (ExecutionEngines.OrderEngines.Spreader)iEng;
         }
     }
 }
Ejemplo n.º 25
0
        }//SetupInitialize()

        //
        //
        //
        //
        // ************************************************
        // ****             SetupBegin()               ****
        // ************************************************
        /// <summary>
        /// </summary>
        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            //
            // Master Remote-Engines must send requests to ExecutionHub now.
            //
            if (m_IsSubEngine == false)
            {
                // Count number of (master) remote engines found in this strategy.
                // Master remote engines are those connected directly to the Strategy,
                // without being held by another engine.
                // Only masters broadcast their xml to the ExecutionHub, and other sub-engine
                // engines are included as subelements of their master's broadcast.
                // (If each remote engine broadcasted separately, the ExecHub would have to know how
                // to put them all back together again... that is, who owned whom.)
                int remoteMasterEngineCount = 0;
                foreach (IEngine iEng in engineContainer.GetEngines())
                {
                    if (iEng is ExecutionController && ((ExecutionController)iEng).m_IsSubEngine == false)
                    {
                        remoteMasterEngineCount++;
                    }
                    //if (iEng is RemoteEngine)           // now count all remote engines
                    //    remoteMasterEngineCount++;
                }

                //
                // Create my engine creation request
                //
                Dictionary <Type, string[]> rules = new Dictionary <Type, string[]>();
                rules.Add(this.GetType(), new string[] { "GetClassName", string.Empty, string.Empty });
                string xmlString = Stringifiable.Stringify(this, rules);

                EngineEventArgs e = new EngineEventArgs();
                e.MsgType           = EngineEventArgs.EventType.NewEngine;
                e.Status            = EngineEventArgs.EventStatus.Request;
                e.EngineID          = m_EngineID;
                e.EngineContainerID = m_EngineContainerId;
                e.DataObjectList    = new List <object>();
                e.DataObjectList.Add(xmlString);                          // 0 - engine specs
                e.DataObjectList.Add(m_LocalEngineHubName);               // 1 - engine hub name
                e.DataObjectList.Add(remoteMasterEngineCount.ToString()); // 2 - number of engines remote hub should expect from this EngineContainer
                // Send request to remote.
                if (m_RemoteEngineHub != null && m_RemoteEngineHub.HubEventEnqueue(e))
                {
                    Log.NewEntry(LogLevel.Minor, "SetupBegin: Remote-{0} sent creation request to remote.", m_RemoteEngineClassName);
                }
                else
                {
                    Log.NewEntry(LogLevel.Minor, "SetupBegin: Remote-{0} failed to send creation request to remote.", m_RemoteEngineClassName);
                }
            } // master remote-engine sends request.
        }     //SetupBegin()
Ejemplo n.º 26
0
        //
        // *************************************************************
        // ****                 Setup Initialize()                  ****
        // *************************************************************
        /// <summary>
        /// Since I depend critically on an OrderBookHub, I will look for them now.
        /// </summary>
        /// <param name="myEngineHub"></param>
        /// <param name="engineContainer"></param>
        /// <param name="engineID"></param>
        /// <param name="setupGui"></param>
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            base.SetupInitialize(myEngineHub, engineContainer, engineID, false);
            EngineGui engineGui = base.SetupGuiTemplates();

            engineGui.LowerHudFullName = typeof(OrderEngineHud).FullName;


            // Collect services that I need.
            m_Hub                = (Hub)myEngineHub;
            this.Log             = m_Hub.Log;
            m_ExecutionContainer = (ThreadContainer)engineContainer;
        }// SetupInitialize()
Ejemplo n.º 27
0
        }// SetupInitialize()

        //
        //
        /// <summary>
        /// This should be overridden if the user does NOT want the default Gui Template.
        ///     1.) SetupGui = false will skip construction of the basic Engine Gui Template.
        /// </summary>
        protected virtual void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            SetupParameterInfoTable(myEngineHub, engineContainer);      // Create table for all parameters
            if (setupGui)
            {
                SetupGuiTemplates();
            }

            if (myEngineHub is Hubs.Hub)
            {   // this is a real hub, and should have a log, which we want to use
                m_Log = ((Hubs.Hub)myEngineHub).Log;
            }
        }//SetupInitialize()
Ejemplo n.º 28
0
        }// SetupInitialize()

        //
        //
        // *************************************************
        // ****             SetupBegin()                ****
        // *************************************************
        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            //EngineEventArgs e = EngineEventArgs.RequestAllParameters(m_ExecutionHubName, m_Strategy.EngineContainerID, -1);
            //SyntheticOrder synth = new SyntheticOrder(e);
            for (int i = 0; i < 2; i++)
            { // set up event args to reuse.
                m_EngineEventArgsForOrders[i] = new EngineEventArgs();
                m_EngineEventArgsForOrders[i].EngineHubName     = m_ExecutionHubName;
                m_EngineEventArgsForOrders[i].EngineContainerID = m_Strategy.EngineContainerID;
                m_EngineEventArgsForOrders[i].MsgType           = EngineEventArgs.EventType.SyntheticOrder;
                m_EngineEventArgsForOrders[i].Status            = EngineEventArgs.EventStatus.Request;
                m_EngineEventArgsForOrders[i].DataObjectList    = new List <object>();
            }
        }// SetupBegin()
Ejemplo n.º 29
0
        }        // GetEventForParameterValues();

        //
        //
        /// <summary>
        /// This method allows an engine to broadcast all of his own parameters even if not
        /// requested by the user.  This is useful when the engine changed its parameters automatically,
        /// and now wants to ensure the user knows about it.
        /// </summary>
        /// <param name="hub"></param>
        /// <param name="parent"></param>
        public void BroadcastAllParameters(IEngineHub hub, IEngineContainer parent)
        {
            EngineEventArgs eArgs = new EngineEventArgs();

            eArgs.MsgType           = EngineEventArgs.EventType.ParameterValue;
            eArgs.Status            = EngineEventArgs.EventStatus.Confirm;
            eArgs.EngineHubName     = hub.ServiceName;
            eArgs.EngineContainerID = parent.EngineContainerID;
            eArgs.EngineID          = this.EngineID;
            if (GetParameterValue(ref eArgs.DataIntA, ref eArgs.DataObjectList))
            {
                m_EventQueue.Add(eArgs);
            }
        }        // BroadcastParameters()
Ejemplo n.º 30
0
        }// SetupInitialize()

        //
        // *************************************************************
        // ****                    Setup Begin()                   ****
        // *************************************************************
        public override void SetupBegin(IEngineHub myEngineHub, IEngineContainer engineContainer)
        {
            base.SetupBegin(myEngineHub, engineContainer);
            foreach (IEngine iEng in engineContainer.GetEngines())
            {
                if (iEng is Risk.RiskManager)
                {
                    m_RiskManager = (Risk.RiskManager)iEng;
                }
            }
            if (m_RiskManager == null)
            {
                throw new NotImplementedException("All Strategies Must Have a Risk Manager, Please Add One To Your User Config");
            }
        }//SetupBegin().