mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-21 03:58:04 +00:00
clean code fixes
This commit is contained in:
+11
-5
@@ -1,22 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>QuanTAlib.Tests</RootNamespace>
|
||||
<AssemblyName>QuanTAlib.Tests</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0-pre.35">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.9.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
|
||||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
|
||||
|
||||
<PackageReference Include="Skender.Stock.Indicators" Version="2.5.0" />
|
||||
<PackageReference Include="TALib.NETCore" Version="0.4.4" />
|
||||
<PackageReference Include="Tulip.NETCore" Version="0.8.0.1" />
|
||||
@@ -29,6 +34,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
<ProjectReference Include="..\lib\quantalib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
+3
-3
@@ -17,14 +17,14 @@ public class BarIndicatorTests
|
||||
rnd = new Random((int)DateTime.Now.Ticks);
|
||||
}
|
||||
|
||||
private static readonly iTValue[] indicators = new iTValue[]
|
||||
private static readonly ITValue[] indicators = new ITValue[]
|
||||
{
|
||||
new Atr(period: 14),
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(GetIndicators))]
|
||||
public void IndicatorIsNew(iTValue indicator)
|
||||
public void IndicatorIsNew(ITValue indicator)
|
||||
{
|
||||
var indicator1 = indicator;
|
||||
var indicator2 = indicator;
|
||||
@@ -32,7 +32,7 @@ public class BarIndicatorTests
|
||||
MethodInfo calcMethod = indicator.GetType().GetMethod("Calc")!;
|
||||
if (calcMethod == null)
|
||||
{
|
||||
throw new Exception($"Calc method not found for indicator type: {indicator.GetType().Name}");
|
||||
throw new InvalidOperationException($"Calc method not found for indicator type: {indicator.GetType().Name}");
|
||||
}
|
||||
|
||||
for (int i = 0; i < SeriesLen; i++)
|
||||
|
||||
@@ -17,8 +17,8 @@ public class IndicatorTests
|
||||
rnd = new Random((int)DateTime.Now.Ticks);
|
||||
}
|
||||
|
||||
private static readonly iTValue[] indicators =
|
||||
[
|
||||
private static readonly ITValue[] indicators =
|
||||
{
|
||||
new Ema(period: 10, useSma: true),
|
||||
new Alma(period: 14, offset: 0.85, sigma: 6),
|
||||
new Afirma(periods: 4, taps: 4, window: Afirma.WindowType.Blackman),
|
||||
@@ -60,11 +60,11 @@ public class IndicatorTests
|
||||
new Variance(period: 14),
|
||||
new Zscore(period: 14)
|
||||
|
||||
];
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(GetIndicators))]
|
||||
public void IndicatorIsNew(iTValue indicator)
|
||||
public void IndicatorIsNew(ITValue indicator)
|
||||
{
|
||||
var indicator1 = indicator;
|
||||
var indicator2 = indicator;
|
||||
@@ -72,7 +72,7 @@ public class IndicatorTests
|
||||
MethodInfo calcMethod = indicator.GetType().GetMethod("Calc")!;
|
||||
if (calcMethod == null)
|
||||
{
|
||||
throw new Exception($"Calc method not found for indicator type: {indicator.GetType().Name}");
|
||||
throw new InvalidOperationException($"Calc method not found for indicator type: {indicator.GetType().Name}");
|
||||
}
|
||||
|
||||
for (int i = 0; i < SeriesLen; i++)
|
||||
|
||||
@@ -12,7 +12,8 @@ public class SkenderTests
|
||||
private readonly GbmFeed feed;
|
||||
private readonly Random rnd;
|
||||
private readonly double range;
|
||||
private int period, iterations;
|
||||
private int period;
|
||||
private readonly int iterations;
|
||||
private readonly IEnumerable<Quote> quotes;
|
||||
|
||||
|
||||
@@ -338,7 +339,7 @@ public class SkenderTests
|
||||
var SK = quotes.GetAtr(lookbackPeriods: period).Select(i => i.Atr.Null2NaN()!);
|
||||
Assert.Equal(QL.Length, QL.Length);
|
||||
|
||||
for (int i = QL.Length - 1; i > period +500; i--)
|
||||
for (int i = QL.Length - 1; i > period + 500; i--)
|
||||
{
|
||||
Assert.InRange(SK.ElementAt(i) - QL[i].Value, -range, range);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user