Beispiel #1
0
        /// <summary>Return the candles over the given index range</summary>
        public IEnumerable <Candle> ReadCandles(RangeI index_range)
        {
            // Read from the database. Order by timestamp so that the oldest is first, and the newest is at the end.
            var candles = DB.Query <Candle>(
                $"select * from {TimeFrame}\n" +
                $"order by [{nameof(Candle.Timestamp)}] limit @start,@count",
                new { start = index_range.Beg, count = index_range.Size });

            if (Model.BackTesting)
            {
                var latest_time = new TimeFrameTime(Model.UtcNow, TimeFrame).IntgTicks;
                candles = candles.Select(x => x.Timestamp < latest_time ? x : x.SubCandle(Model.UtcNow, TimeFrame));
            }

            return(candles);
        }
Beispiel #2
0
 public TimeFrameTime(TimeFrameTime tft, ETimeFrame tf)
     : this(tft.ExactTicks, tf)
 {
 }
Beispiel #3
0
 public bool Equals(TimeFrameTime rhs)
 {
     return(ExactTicks == rhs.ExactTicks && TimeFrame == rhs.TimeFrame);
 }