diff options
Diffstat (limited to 'stdlib/source/library/lux/world/finance/market/price.lux')
-rw-r--r-- | stdlib/source/library/lux/world/finance/market/price.lux | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/stdlib/source/library/lux/world/finance/market/price.lux b/stdlib/source/library/lux/world/finance/market/price.lux index 58c4216d8..c7b6e8e8c 100644 --- a/stdlib/source/library/lux/world/finance/market/price.lux +++ b/stdlib/source/library/lux/world/finance/market/price.lux @@ -9,39 +9,48 @@ ["%" \\format]]] [math [number + ["n" nat] ["i" int]]] [meta [type ["[0]" nominal]]]]] [/// - [money (.only Money) + ["[0]" money (.only Money) ["[0]" currency (.only Currency)]]]) (type .public (Price $) (Money $)) +(def .public (free $) + (All (_ $) + (-> (Currency $) + (Price $))) + (money.money $ 0)) + ... https://en.wikipedia.org/wiki/Price_action_trading (nominal.def .public (Action $) (Record [#currency (Currency $) #movement Int]) - (def .public (action currency movement) + (def .public (action from to) (All (_ $) - (-> (Currency $) Int + (-> (Price $) (Price $) (Action $))) (nominal.abstraction - [#currency currency - #movement movement])) + [#currency (money.currency from) + #movement (.int (n.- (money.amount from) + (money.amount to)))])) (with_template [<*> <name>] [(def .public (<name> currency it) (All (_ $) (-> (Currency $) Int (Action $))) - (action currency - (<*> (.int (currency.sub_divisions currency)) - it)))] + (nominal.abstraction + [#currency currency + #movement (<*> (.int (currency.sub_divisions currency)) + it)]))] [i.* of_units] [i.% of_sub_units] |