void IStringifiable.SetAttributes(Dictionary <string, string> attributes) { TradePageType pageType; foreach (KeyValuePair <string, string> a in attributes) { if (a.Key == "PageType" && Enum.TryParse <TradePageType>(a.Value, out pageType)) { this.PageType = pageType; } } }
// TODO: Create an overloading that takes QuoteLegs, // if that is more convenient for execution engines. // // // #endregion//Constructors #region no Properties // ***************************************************************** // **** Properties **** // ***************************************************************** // // #endregion//Properties #region Public Methods // ***************************************************************** // **** Public Methods **** // ***************************************************************** // // // // ********************************************* // **** AddFill() **** // ********************************************* /// <summary> /// Add a new fill to this Trade object. /// </summary> /// <param name="instrumentName"></param> /// <param name="type"></param> /// <param name="newFill"></param> public void AddFill(InstrumentName instrumentName, TradePageType type, Fill newFill) { // Locate appropriate TradePage, or if need be, create new page. Dictionary <InstrumentName, TradePage> tradePageDict = null; if (type == TradePageType.Entry) { tradePageDict = this.Entry; } else if (type == TradePageType.Exit) { tradePageDict = this.Exit; } TradePage page = null; if (tradePageDict.TryGetValue(instrumentName, out page) == false) { page = new TradePage(instrumentName, type); } // Add fill to page. page.Fills.Add(newFill); }// AddFill()
public TradePage(InstrumentName instrumentName, TradePageType type) { this.InstrumentName = instrumentName; this.PageType = type; Fills = new List <Fill>(); }