Skip to content

Commit dee16c5

Browse files
committed
Address review comments
1 parent 3dd885f commit dee16c5

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

Common/Data/Consolidators/MarketHourAwareConsolidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class MarketHourAwareConsolidator : ConsolidatorBase, IDataConsolidator
4040
/// <summary>
4141
/// The consolidator instance
4242
/// </summary>
43-
protected IDataConsolidator Consolidator { get; }
43+
private IDataConsolidator Consolidator { get; }
4444

4545
/// <summary>
4646
/// Delegates the rolling window to the inner consolidator to avoid duplication.

Common/Data/Consolidators/SequentialConsolidator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public IDataConsolidator Second
4545
/// <summary>
4646
/// Delegates the rolling window to the second (inner) consolidator to avoid duplication.
4747
/// </summary>
48-
public override RollingWindow<IBaseData> Window => (Second as ConsolidatorBase)?.Window;
48+
public override RollingWindow<IBaseData> Window => (Second as ConsolidatorBase)?.Window ?? base.Window;
4949

5050
/// <summary>
5151
/// Gets a clone of the data being currently consolidated
@@ -124,6 +124,10 @@ public SequentialConsolidator(IDataConsolidator first, IDataConsolidator second)
124124
/// <param name="consolidated">The newly consolidated data</param>
125125
protected virtual void OnDataConsolidated(IBaseData consolidated)
126126
{
127+
if (Second is not ConsolidatorBase)
128+
{
129+
Consolidated = consolidated;
130+
}
127131
var handler = DataConsolidated;
128132
if (handler != null) handler(this, consolidated);
129133
}

Common/WindowBase.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,11 @@ protected set
9090
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
9191

9292
/// <summary>
93-
/// Resets the rolling window, clearing all stored values without allocating a new window
94-
/// if it has not yet been created.
93+
/// Resets the rolling window, clearing all stored values.
9594
/// </summary>
9695
protected void ResetWindow()
9796
{
98-
_window?.Reset();
97+
Window.Reset();
9998
}
10099
}
101100
}

Indicators/IndicatorBase.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ public abstract partial class IndicatorBase : WindowBase<IndicatorDataPoint>, II
3838
/// Gets the previous state of this indicator. If the state has not been updated
3939
/// then the time on the value will equal DateTime.MinValue.
4040
/// </summary>
41-
public override IndicatorDataPoint Previous
42-
{
43-
get
44-
{
45-
return Window.Count > 1 ? Window[1] : new IndicatorDataPoint(DateTime.MinValue, 0);
46-
}
47-
}
41+
public override IndicatorDataPoint Previous => base.Previous ?? new IndicatorDataPoint(DateTime.MinValue, 0);
4842

4943
/// <summary>
5044
/// Gets a name for this indicator

0 commit comments

Comments
 (0)