aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ccxt_wrapper.py4
-rw-r--r--tests/test_portfolio.py13
2 files changed, 12 insertions, 5 deletions
diff --git a/tests/test_ccxt_wrapper.py b/tests/test_ccxt_wrapper.py
index 9ddfbc1..c326f0a 100644
--- a/tests/test_ccxt_wrapper.py
+++ b/tests/test_ccxt_wrapper.py
@@ -545,3 +545,7 @@ class poloniexETest(unittest.TestCase):
545 self.assertEqual("0.0000001", self.s.price_to_precision("BAR", D("0.0000001"))) 545 self.assertEqual("0.0000001", self.s.price_to_precision("BAR", D("0.0000001")))
546 self.assertEqual("0", self.s.price_to_precision("FOO", D("0.000001"))) 546 self.assertEqual("0", self.s.price_to_precision("FOO", D("0.000001")))
547 547
548 def test_is_dust_trade(self):
549 self.assertTrue(self.s.is_dust_trade(D("0.0000009"), D("1000")))
550 self.assertTrue(self.s.is_dust_trade(D("0.000001"), D("10")))
551 self.assertFalse(self.s.is_dust_trade(D("0.000001"), D("100")))
diff --git a/tests/test_portfolio.py b/tests/test_portfolio.py
index 4d78996..969f5d4 100644
--- a/tests/test_portfolio.py
+++ b/tests/test_portfolio.py
@@ -823,14 +823,16 @@ class OrderTest(WebMockTestCase):
823 order.cancel() 823 order.cancel()
824 self.m.ccxt.cancel_order.assert_not_called() 824 self.m.ccxt.cancel_order.assert_not_called()
825 825
826 def test_dust_amount_remaining(self): 826 def test_mark_dust_amount_remaining(self):
827 order = portfolio.Order("buy", portfolio.Amount("ETH", 10), 827 order = portfolio.Order("buy", portfolio.Amount("ETH", 10),
828 D("0.1"), "BTC", "long", self.m, "trade") 828 D("0.1"), "BTC", "long", self.m, "trade")
829 order.remaining_amount = mock.Mock(return_value=portfolio.Amount("ETH", 1)) 829 self.m.ccxt.is_dust_trade.return_value = False
830 self.assertFalse(order.dust_amount_remaining()) 830 order.mark_dust_amount_remaining_order()
831 self.assertEqual("pending", order.status)
831 832
832 order.remaining_amount = mock.Mock(return_value=portfolio.Amount("ETH", D("0.0001"))) 833 self.m.ccxt.is_dust_trade.return_value = True
833 self.assertTrue(order.dust_amount_remaining()) 834 order.mark_dust_amount_remaining_order()
835 self.assertEqual("closed_dust_remaining", order.status)
834 836
835 @mock.patch.object(portfolio.Order, "fetch") 837 @mock.patch.object(portfolio.Order, "fetch")
836 @mock.patch.object(portfolio.Order, "filled_amount", return_value=portfolio.Amount("ETH", 1)) 838 @mock.patch.object(portfolio.Order, "filled_amount", return_value=portfolio.Amount("ETH", 1))
@@ -965,6 +967,7 @@ class OrderTest(WebMockTestCase):
965 "status": "foo", 967 "status": "foo",
966 "datetime": "timestamp" 968 "datetime": "timestamp"
967 } 969 }
970 self.m.ccxt.is_dust_trade.return_value = False
968 order.fetch() 971 order.fetch()
969 972
970 self.m.ccxt.fetch_order.assert_called_once_with(45) 973 self.m.ccxt.fetch_order.assert_called_once_with(45)