Skip to content

Commit

Permalink
Update IdentityDataConsolidator to track last processed time (#8510)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosueNina authored Jan 9, 2025
1 parent 3569a1f commit c448196
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Common/Data/Consolidators/IdentityDataConsolidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ namespace QuantConnect.Data.Consolidators
public class IdentityDataConsolidator<T> : DataConsolidator<T>
where T : IBaseData
{
private static readonly bool IsTick = typeof (T) == typeof (Tick);
private static readonly bool IsTick = typeof(T) == typeof(Tick);

private T _last;

/// <summary>
/// Stores the timestamp of the last processed data item.
/// </summary>
private DateTime _lastTime;

/// <summary>
/// Gets a clone of the data being currently consolidated
/// </summary>
Expand All @@ -43,7 +48,7 @@ public override IBaseData WorkingData
/// </summary>
public override Type OutputType
{
get { return typeof (T); }
get { return typeof(T); }
}

/// <summary>
Expand All @@ -52,10 +57,11 @@ public override Type OutputType
/// <param name="data">The new data for the consolidator</param>
public override void Update(T data)
{
if (IsTick || _last == null || _last.EndTime != data.EndTime)
if (IsTick || _last == null || data.EndTime != _lastTime)
{
OnDataConsolidated(data);
_last = data;
_lastTime = data.EndTime;
}
}

Expand Down

0 comments on commit c448196

Please sign in to comment.