aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2022-12-12 18:55:00 -0400
committerEduardo Julian2022-12-12 18:55:00 -0400
commit549cb9623c560fec165b9e88f112a406614f598e (patch)
treed085b6dddf0a7ff5078c19e0f13b48d82bee55d0 /stdlib/source/test/lux/world
parentfe9a58dfcd5732ef0c5e5c4b7e85370cdc0db45a (diff)
Added accumulation/distribution oscillator.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/world.lux6
-rw-r--r--stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux31
-rw-r--r--stdlib/source/test/lux/world/time/series.lux7
3 files changed, 40 insertions, 4 deletions
diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux
index bf9ff3c7f..3793d49ee 100644
--- a/stdlib/source/test/lux/world.lux
+++ b/stdlib/source/test/lux/world.lux
@@ -16,7 +16,10 @@
["[1][0]" finance
["[1]/[0]" money]
["[1]/[0]" trade
- ["[1]/[0]" session]]]
+ ["[1]/[0]" session]]
+ ["[1]/[0]" market
+ ["[1]/[0]" analysis
+ ["[1]/[0]" accumulation_distribution]]]]
["[1][0]" net]
["[1][0]" time]
["[1][0]" locale]
@@ -35,6 +38,7 @@
/finance/money.test
/finance/trade/session.test
+ /finance/market/analysis/accumulation_distribution.test
/net.test
/time.test
diff --git a/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux
new file mode 100644
index 000000000..74b502140
--- /dev/null
+++ b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux
@@ -0,0 +1,31 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["f" frac]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" / (.only)
+ [////
+ [money
+ ["[0]" currency]]]]]
+ [////
+ [trade
+ ["[0]T" session]]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [session (sessionT.random currency.usd)])
+ (all _.and
+ (_.coverage [/.oscillation]
+ (let [it (/.oscillation session)]
+ (and (f.<= +1.0 it)
+ (f.>= -1.0 it))))
+ )))
diff --git a/stdlib/source/test/lux/world/time/series.lux b/stdlib/source/test/lux/world/time/series.lux
index 47432df08..ef42a994e 100644
--- a/stdlib/source/test/lux/world/time/series.lux
+++ b/stdlib/source/test/lux/world/time/series.lux
@@ -3,10 +3,11 @@
[lux (.except)
[abstract
[monad (.only do)]
+ ["[0]" functor
+ ["[1]T" \\test (.only Injection)]]
[\\specification
["[0]S" equivalence]
- ["[0]S" mix]
- ["[0]S" functor (.only Injection)]]]
+ ["[0]S" mix]]]
[control
["|" pipe]
["[0]" try (.use "[1]#[0]" functor)]
@@ -79,7 +80,7 @@
(_.for [/.mix]
(mixS.spec (..injection expected_start expected_interval) /.equivalence /.mix))
(_.for [/.functor]
- (functorS.spec (..injection expected_start expected_interval) /.equivalence /.functor))
+ (functorT.spec (..injection expected_start expected_interval) /.equivalence /.functor))
(_.coverage [/.size]
(n.= expected_size