コード例 #1
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);
        }
コード例 #2
0
        //
        //
        protected override void SetupInitialize(IEngineHub myEngineHub, IEngineContainer engineContainer, int engineID, bool setupGui)
        {
            this.m_EngineName = string.Format("HedgeRuleManager:{0}", m_QuoterLeg.m_PriceLeg.InstrumentName);
            base.SetupInitialize(myEngineHub, engineContainer, engineID, setupGui);
            m_Hedger = m_QuoterLeg.m_Hedger;
            m_Log    = ((ExecutionHub)myEngineHub).Log;
            ExecutionContainer execContainer = (ExecutionContainer)engineContainer;

            m_HedgeRules.OrderBy(x => x.RuleNumber); // sort our list by the rule number, so they get called in order!

            foreach (HedgeRule rule in m_HedgeRules) // check that they are all unique, and add them to our container
            {
                if (!m_PriorityToRule.ContainsKey(rule.RuleNumber))
                {
                    m_PriorityToRule.Add(rule.RuleNumber, rule);
                    execContainer.TryAddEngine((Engine)rule);   // add my sub engines to the container.
                }
                else
                {
                    m_Log.NewEntry(LogLevel.Error, "HedgeRuleManager: Failed to find unique hedge rules");
                    throw new Exception("HedgeRuleManager: Failed to find unique hedge rules");
                }
            }
        }