Beispiel #1
0
        /// <summary>
        /// </summary>
        /// <returns>Deep clone of Trade</returns>
        public TradePage Clone()
        {
            TradePage newPage = (TradePage)this.MemberwiseClone();

            foreach (Fill fill in this.Fills)
            {
                newPage.Fills.Add(fill.Clone());
            }
            return(newPage);
        }
Beispiel #2
0
 void IStringifiable.AddSubElement(IStringifiable subElement)
 {
     if (subElement is PriceLeg)
     {
         m_Legs.Add((PriceLeg)subElement);
     }
     else if (subElement is TradePage)
     {
         TradePage page = (TradePage)subElement;
         if (page.PageType == TradePageType.Entry)
         {
             this.Entry.Add(page.InstrumentName, page);
         }
     }
 }
Beispiel #3
0
        // 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()