mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-13 16:18:05 +00:00
Documentation
This commit is contained in:
+3
-3
@@ -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!;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user