aboutsummaryrefslogtreecommitdiff
path: root/tests/test_portfolio.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_portfolio.py')
-rw-r--r--tests/test_portfolio.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_portfolio.py b/tests/test_portfolio.py
index bc69921..d4e5ab9 100644
--- a/tests/test_portfolio.py
+++ b/tests/test_portfolio.py
@@ -26,6 +26,12 @@ class ComputationTest(WebMockTestCase):
26 portfolio.Computation.compute_value("foo", "bid", compute_value="test") 26 portfolio.Computation.compute_value("foo", "bid", compute_value="test")
27 compute.assert_called_with("foo", "bid") 27 compute.assert_called_with("foo", "bid")
28 28
29 def test_eat_several(self):
30 self.m.ccxt.fetch_nth_order_book.return_value = D("0.00001275")
31
32 self.assertEqual(D("0.00001275"), portfolio.Computation.eat_several(self.m)({ "symbol": "BTC/HUC" }, "ask"))
33
34
29@unittest.skipUnless("unit" in limits, "Unit skipped") 35@unittest.skipUnless("unit" in limits, "Unit skipped")
30class TradeTest(WebMockTestCase): 36class TradeTest(WebMockTestCase):
31 37
@@ -506,6 +512,25 @@ class TradeTest(WebMockTestCase):
506 trade.orders = [] 512 trade.orders = []
507 self.m.report.log_order.reset_mock() 513 self.m.report.log_order.reset_mock()
508 514
515 with self.subTest(tick=22):
516 trade.update_order(order_mock, 22)
517 order_mock.cancel.assert_called()
518 new_order_mock.run.assert_called()
519 prepare_order.assert_called_with(compute_value=mock.ANY)
520 self.m.report.log_order.assert_called()
521 self.assertEqual(2, self.m.report.log_order.call_count)
522 calls = [
523 mock.call(order_mock, 22, update="market_adjust_eat",
524 compute_value=mock.ANY,
525 new_order=new_order_mock),
526 mock.call(order_mock, 22, new_order=new_order_mock),
527 ]
528 self.m.report.log_order.assert_has_calls(calls)
529
530 order_mock.reset_mock()
531 new_order_mock.reset_mock()
532 trade.orders = []
533 self.m.report.log_order.reset_mock()
509 534
510 def test_print_with_order(self): 535 def test_print_with_order(self):
511 value_from = portfolio.Amount("BTC", "0.5") 536 value_from = portfolio.Amount("BTC", "0.5")