aboutsummaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-01-21 15:57:13 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-01-21 15:57:36 +0100
commitc2644ba8db6e3890458af6a244aa3217e2ac4797 (patch)
tree9f569244f534f49c1850ab4c30e171380f7850f7 /test.py
parentdeb8924cc60f0d64575657399f4fe112ff1cfb31 (diff)
downloadTrader-c2644ba8db6e3890458af6a244aa3217e2ac4797.tar.gz
Trader-c2644ba8db6e3890458af6a244aa3217e2ac4797.tar.zst
Trader-c2644ba8db6e3890458af6a244aa3217e2ac4797.zip
Store currency conversion rate and use it in trade computations
Diffstat (limited to 'test.py')
-rw-r--r--test.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/test.py b/test.py
index a9baadf..edf6d01 100644
--- a/test.py
+++ b/test.py
@@ -40,6 +40,9 @@ class AmountTest(unittest.TestCase):
40 converted_amount = amount.in_currency("ETH", None, compute_value="ask") 40 converted_amount = amount.in_currency("ETH", None, compute_value="ask")
41 self.assertEqual(D("4"), converted_amount.value) 41 self.assertEqual(D("4"), converted_amount.value)
42 42
43 converted_amount = amount.in_currency("ETH", None, rate=D("0.02"))
44 self.assertEqual(D("0.2"), converted_amount.value)
45
43 def test__abs(self): 46 def test__abs(self):
44 amount = portfolio.Amount("SC", -120) 47 amount = portfolio.Amount("SC", -120)
45 self.assertEqual(120, abs(amount).value) 48 self.assertEqual(120, abs(amount).value)