mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-23 04:58:08 +00:00
code reviews
This commit is contained in:
@@ -184,7 +184,8 @@ public class JerkIndicatorTests
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
// Cubic trend: changing acceleration = non-zero jerk
|
||||
// Cubic trend: f(x) = x³ has third derivative = 6
|
||||
// Using f(i) = i³, the discrete third differences converge to 6
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
double price = 100 + i * i * i; // cubic growth
|
||||
@@ -193,7 +194,8 @@ public class JerkIndicatorTests
|
||||
}
|
||||
|
||||
double lastJerk = indicator.LinesSeries[0].GetValue(0);
|
||||
Assert.True(lastJerk != 0);
|
||||
// For f(x) = x³, discrete third difference = 6
|
||||
Assert.Equal(6.0, lastJerk, 6);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -215,4 +217,4 @@ public class JerkIndicatorTests
|
||||
double lastJerk = indicator.LinesSeries[0].GetValue(0);
|
||||
Assert.Equal(0, lastJerk, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using Xunit;
|
||||
|
||||
namespace QuanTAlib.Tests;
|
||||
|
||||
public class JerkTests
|
||||
@@ -302,4 +304,4 @@ public class JerkTests
|
||||
Assert.Equal(jerkResults[i], chainResults[i], precision: 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user