Documentation

This commit is contained in:
Miha Kralj
2024-10-16 18:28:06 -07:00
parent e5a1948fc0
commit fbe4046b5d
17 changed files with 2619 additions and 286 deletions
+3 -3
View File
@@ -25,7 +25,7 @@ public class BarIndicatorTests
private static readonly ITValue[] indicators = new ITValue[]
{
new Atr(period: 14),
new Jvolty(period: 14)
// Add other TBar-based indicators here
};
@@ -80,14 +80,14 @@ public class BarIndicatorTests
if (methods.Count > 0)
{
// Prefer the method with TBar parameter
var method = methods.FirstOrDefault(m =>
var method = methods.Find(m =>
{
var parameters = m.GetParameters();
return parameters.Length == 1 && parameters[0].ParameterType == typeof(TBar);
});
// If not found, return the first method
return method ?? methods.First();
return method ?? methods[0];
}
type = type.BaseType!;
+1 -2
View File
@@ -13,7 +13,7 @@ namespace QuanTAlib
{
public class QuantowerTests
{
private void TestIndicator<T>(string fieldName = "ma") where T : Indicator, new()
private static void TestIndicator<T>(string fieldName = "ma") where T : Indicator, new()
{
var indicator = new T();
try
@@ -95,7 +95,6 @@ namespace QuanTAlib
// Volatility Indicators
[Fact] public void Atr() => TestIndicator<AtrIndicator>("atr");
[Fact] public void Jvolty() => TestIndicator<JvoltyIndicator>("jvolty");
[Fact] public void Historical() => TestIndicator<HistoricalIndicator>("historical");
[Fact] public void Realized() => TestIndicator<RealizedIndicator>("realized");
-15
View File
@@ -57,21 +57,6 @@ public class VolatilityUpdateTests
Assert.Equal(initialValue, finalValue, precision);
}
[Fact]
public void Jvolty_Update()
{
var indicator = new Jvolty(period: 14);
double initialValue = indicator.Calc(new TBar(DateTime.Now, ReferenceValue, ReferenceValue, ReferenceValue, ReferenceValue, 1000, IsNew: true));
for (int i = 0; i < RandomUpdates; i++)
{
indicator.Calc(GetRandomBar(false));
}
double finalValue = indicator.Calc(new TBar(DateTime.Now, ReferenceValue, ReferenceValue, ReferenceValue, ReferenceValue, 1000, IsNew: false));
Assert.Equal(initialValue, finalValue, precision);
}
[Fact]
public void Realized_Update()
{