QuantConnect/Lean

IdentityDataConsolidator Does Not Handle Fill Forward Correctly

Closed this issue · 0 comments

Expected Behavior

IdentityDataConsolidator does not call OnDataConsolidated on fill forward data.

Actual Behavior

IdentityDataConsolidator uses _last.EndTime != data.EndTime which doesn't handle fill forward data.

Potential Solution

N/A

Reproducing the Problem

The EMA is updated every minute despite QQQ uses daily data. QQQ is fill forwarded because of SPY.

namespace QuantConnect.Algorithm.CSharp
{
    public class BasicTemplateAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
    {
        private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
        private ExponentialMovingAverage _ema;

        public override void Initialize()
        {
            SetStartDate(2013, 10, 07);  //Set Start Date
            SetEndDate(2013, 10, 11);    //Set End Date
            SetCash(100000);             //Set Strategy Cash

            AddEquity("SPY", Resolution.Minute);
            AddEquity("QQQ", Resolution.Daily);
            _ema = EMA("QQQ", 200, Resolution.Daily);
            WarmUpIndicator("QQQ", _ema);
        }

        public override void OnData(Slice slice)
        {
            if (slice.Bars.TryGetValue("QQQ", out var bar))
            {
                Log($"ema: {_ema.Current.Value} samples: {_ema.Samples} qqq: {bar.Close}; {bar.EndTime}");
            }
        }

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue