}//Quote() // // // // // #endregion//private Methods #region IOrderEngine Implementation // // // ************************************************************* // **** Filled() **** // ************************************************************* // /// <summary> /// Called by the StrategyHub when it received a fillEventArg from an OrderBook /// that this engine subscribed to. /// </summary> /// <param name="fillEventArgs"></param> /// <returns>null is no fill is generated.</returns> public Fill Filled(FillEventArgs fillEventArgs) { m_FillBook.TryAdd(fillEventArgs.Fill); int fillSide = QTMath.MktSignToMktSide(fillEventArgs.Fill.Qty); m_StrategyPosition[fillSide] += fillEventArgs.Fill.Qty; m_RiskManager.Filled(fillEventArgs); // make sure our risk manager knows return(fillEventArgs.Fill); // pass fill through to other engines. }//Filled()
}//Quote() // // // // // #endregion//private Methods #region IOrderEngine Implementation // // // ************************************************************* // **** Filled() **** // ************************************************************* // /// <summary> /// Called by the StrategyHub when it received a fillEventArg from an OrderBook /// that this engine subscribed to. /// </summary> /// <param name="fillEventArgs"></param> /// <returns>null is no fill is generated.</returns> public Fill Filled(FillEventArgs fillEventArgs) { m_FillBook.TryAdd(fillEventArgs.Fill); int fillSide = QTMath.MktSignToMktSide(fillEventArgs.Fill.Qty); m_StrategyPosition[fillSide] += fillEventArgs.Fill.Qty; fillEventArgs.Fill.Price = fillEventArgs.Fill.Price * m_PriceLeg.PriceMultiplier; return(fillEventArgs.Fill); // pass fill through to other engines. }//Filled()
// #endregion //IOrderEngine Implementation #region Event Handlers // ***************************************************************** // **** Event Handlers **** // ***************************************************************** // // // // ***************************************************************** // **** OrderBook_OrderFilled() **** // ***************************************************************** private void OrderBook_OrderFilled(object sender, EventArgs eventArgs) { FillEventArgs fillEventArgs = (FillEventArgs)eventArgs; m_FillBook.TryAdd(fillEventArgs.Fill); int fillSide = QTMath.MktSignToMktSide(fillEventArgs.Fill.Qty); m_StrategyPosition[fillSide] += fillEventArgs.Fill.Qty; fillEventArgs.Fill.Price = fillEventArgs.Fill.Price * m_PriceLeg.PriceMultiplier; Quote(); // this will update our orders now that we got filled, and resubmit if we are dripping etc.. // // Create a synthetic fill to pass back to the strategy. // if (m_OpenSyntheticOrders[fillSide] != null) { SyntheticFill newSyntheticFill = SyntheticFill.CreateSyntheticFillFromFill(fillEventArgs.Fill); m_OpenSyntheticOrders[fillSide].m_SyntheticFills.Add(newSyntheticFill); m_ExecutionContainer.SendSyntheticOrderToRemote(m_OpenSyntheticOrders[fillSide]); } }