Beispiel #1
0
        /// <summary>
        /// The constructor takes snapshot from manager.
        /// </summary>
        /// <param name="snapshot">a snapshot instance</param>
        /// <param name="storage"></param>
        /// <param name="symbol"></param>
        /// <param name="periodicity"></param>
        /// <param name="priceType"></param>
        /// <exception cref="System.ArgumentNullException">if snapshot is null</exception>
        public Snapshot(Snapshot snapshot, DataFeedStorage storage, string symbol, BarPeriod periodicity, PriceType priceType)
        {
            if (snapshot == null)
                throw new ArgumentNullException(nameof(snapshot));

            if (storage == null)
                throw new ArgumentNullException(nameof(storage));

            this.IsFeedLoggedOn = snapshot.IsFeedLoggedOn;
            this.IsTradeLoggedOn = snapshot.IsTradeLoggedOn;
            this.AccountInfo = snapshot.AccountInfo;
            this.FeedSessionInfo = snapshot.FeedSessionInfo;
            this.TradeSessionInfo = snapshot.TradeSessionInfo;
            this.TradeRecords = snapshot.TradeRecords;
            this.Positions = snapshot.Positions;
            this.Quotes = snapshot.Quotes;
            this.Symbols = snapshot.Symbols;

            this.storage = storage;
            this.symbol = symbol;
            this.periodicity = periodicity;
            this.priceType = priceType;

            this.synchronizer = snapshot.synchronizer;
        }
Beispiel #2
0
 /// <summary>
 /// The method takes the full snapshot of the manager state.
 /// </summary>
 /// <returns></returns>
 public Snapshot TakeSnapshot(string symbol, PriceType priceType, BarPeriod periodicity)
 {
     lock (this.synchronizer)
     {
         var result = new Snapshot(this.Snapshot, this.storage, symbol, periodicity, priceType);
         return result;
     }
 }