Пример #1
0
 /// <summary>
 /// Cloner Constructor - Return a new instance with the same values as this original
 /// </summary>
 /// <param name="original"></param>
 public TradeBar(TradeBar original) 
 {
     base.Time = new DateTime(original.Time.Ticks);
     base.Symbol = original.Symbol;
     base.Value = original.Close;
     this.Open = original.Open;
     this.High = original.High;
     this.Low = original.Low;
     this.Close = original.Close;
     this.Volume = original.Volume;
 }
Пример #2
0
        /******************************************************** 
        * CLASS METHODS
        *********************************************************/
        /// <summary>
        /// TradeBar Reader: Fetch the data from the QC storage and feed it line by line into the engine.
        /// </summary>
        /// <param name="datafeed">Destination for the this datafeed - live or backtesting</param>
        /// <param name="config">Symbols, Resolution, DataType, </param>
        /// <param name="line">Line from the data file requested</param>
        /// <param name="date">Date of this reader request</param>
        /// <returns>Enumerable iterator for returning each line of the required data.</returns>
        public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, DataFeedEndpoint datafeed) 
        {
            //Initialize:
            TradeBar _tradeBar = new TradeBar();

            //Select the URL source of the data depending on where the system is trading.
            switch (datafeed)
            {
                //Amazon S3 Backtesting Data:
                case DataFeedEndpoint.Backtesting:
                    //Create a new instance of our tradebar:
                    _tradeBar = new TradeBar(config, line, date, datafeed);
                    break;

                //Localhost Data Source
                case DataFeedEndpoint.FileSystem:
                    //Create a new instance of our tradebar:
                    _tradeBar = new TradeBar(config, line, date, datafeed);
                    break;

                //QuantConnect Live Tick Stream:
                case DataFeedEndpoint.LiveTrading:
                    break;
            }

            //Return initialized TradeBar:
            return _tradeBar;
        }