Skip to content

Commit

Permalink
Fix issue with regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JosueNina committed Dec 20, 2024
1 parent 7597d3c commit 87bb775
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions Indicators/IndicatorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ protected IndicatorBase(string name)
/// <returns>True if this indicator is ready, false otherwise</returns>
public override bool Update(IBaseData input)
{
if (typeof(T) == typeof(IndicatorDataPoint))
/* if (typeof(T) == typeof(IndicatorDataPoint))
{
input = new IndicatorDataPoint(input.EndTime, input.Value);
}
input = (input.GetType() == typeof(IndicatorDataPoint)) ? input : new IndicatorDataPoint(input.EndTime, input.Value);
} */
T _previousSymbolInput = default(T);
if (_previousInput.TryGetValue(input.Symbol.ID, out _previousSymbolInput) && input.EndTime < _previousSymbolInput.EndTime)
{
Expand All @@ -275,7 +275,14 @@ public override bool Update(IBaseData input)

if (!(input is T))
{
throw new ArgumentException($"IndicatorBase.Update() 'input' expected to be of type {typeof(T)} but is of type {input.GetType()}");
if (typeof(T) == typeof(IndicatorDataPoint))
{
input = new IndicatorDataPoint(input.EndTime, input.Value);
}
else
{
throw new ArgumentException($"IndicatorBase.Update() 'input' expected to be of type {typeof(T)} but is of type {input.GetType()}");
}
}
_previousInput[input.Symbol.ID] = (T)input;

Expand Down
2 changes: 1 addition & 1 deletion Tests/Indicators/SqueezeMomentumTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override IndicatorBase<IBaseDataBar> CreateIndicator()
VolumeRenkoBarSize = 0.5m;
return new SqueezeMomentum("SM", 20, 2, 20, 1.5m);
}
protected override string TestFileName => "spy_smi.csv";
protected override string TestFileName => "spy_sm.csv";

protected override string TestColumnName => "squeeze on";
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/QuantConnect.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@
<Content Include="TestData\spy_hurst_exponent.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\spy_smi.csv">
<Content Include="TestData\spy_sm.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
Expand Down
File renamed without changes.

0 comments on commit 87bb775

Please sign in to comment.