// public override void SetupComplete() { base.SetupComplete(); if (m_CurveTrader != null) { for (int leg = 0; leg < m_CurveTrader.m_CurveLegs.Count; ++leg) { // add a scratcher for each instrument CurveLeg curveLeg = m_CurveTrader.m_CurveLegs[leg]; m_Scratchers.Add(curveLeg.m_Scratcher); curveLeg.m_Scratcher.m_ScratchManager = this; // give pointer to ourself } m_CurveTrader.m_ExecutionListener.InstrumentFound += new EventHandler(ExecutionListener_InstrumentsFound); } m_OrderEventArg = new OrderEventArgs(); // create our event arg for recycling }
// ***************************************************************** // **** Properties **** // ***************************************************************** // // #endregion//Properties #region Public Methods // ***************************************************************** // **** Public Methods **** // ***************************************************************** // // // // *********************************************************** // **** IsThresholdsValid **** // *********************************************************** /// <summary> /// Caller would like to validate Threshold values for a curve leg along with its /// corresponding scratcher /// </summary> /// <param name="curveLeg"></param> /// <returns></returns> public bool IsLegThresholdsValid(CurveLeg curveLeg) { // TODO: Add other risk checks, does it matter if this is a "quote leg" if (curveLeg.JoinThreshold < curveLeg.PullThreshold) { // our join threshold must be greater than equal! m_Log.NewEntry(LogLevel.Error, "RiskManager.IsThresholdsValid: JoinThreshold={0} must be greater than or equal to PullThreshold={1}", curveLeg.JoinThreshold, curveLeg.PullThreshold); return(false); } if (curveLeg.m_Scratcher.ActiveScratch) { // our scratcher is in active mode if (curveLeg.PullThreshold < curveLeg.m_Scratcher.ScratchThreshold) { // we aren't pulling before we are scratching! m_Log.NewEntry(LogLevel.Error, "RiskManager.IsThresholdsValid: PullThreshold={0} must be greater than ScratchThreshold={1}", curveLeg.PullThreshold, curveLeg.m_Scratcher.ScratchThreshold); return(false); } } return(true); }