diff options
-rw-r--r-- | market.py | 4 | ||||
-rw-r--r-- | tests/test_market.py | 4 |
2 files changed, 7 insertions, 1 deletions
@@ -201,8 +201,10 @@ class Market: | |||
201 | if status == "error_disappeared": | 201 | if status == "error_disappeared": |
202 | self.report.log_error("follow_orders", | 202 | self.report.log_error("follow_orders", |
203 | message="{} disappeared, recreating it".format(order)) | 203 | message="{} disappeared, recreating it".format(order)) |
204 | order.trade.prepare_order( | 204 | new_order = order.trade.prepare_order( |
205 | compute_value=order.trade.tick_actions_recreate(tick)) | 205 | compute_value=order.trade.tick_actions_recreate(tick)) |
206 | new_order.run() | ||
207 | self.report.log_order(order, tick, new_order=new_order) | ||
206 | 208 | ||
207 | self.report.log_stage("follow_orders_end") | 209 | self.report.log_stage("follow_orders_end") |
208 | 210 | ||
diff --git a/tests/test_market.py b/tests/test_market.py index 0211638..6a9ea76 100644 --- a/tests/test_market.py +++ b/tests/test_market.py | |||
@@ -381,12 +381,16 @@ class MarketTest(WebMockTestCase): | |||
381 | order_mock2.trade = trade_mock | 381 | order_mock2.trade = trade_mock |
382 | 382 | ||
383 | trade_mock.tick_actions_recreate.return_value = "tick1" | 383 | trade_mock.tick_actions_recreate.return_value = "tick1" |
384 | new_order_mock = mock.Mock() | ||
385 | trade_mock.prepare_order.return_value = new_order_mock | ||
384 | 386 | ||
385 | m.follow_orders() | 387 | m.follow_orders() |
386 | 388 | ||
387 | trade_mock.tick_actions_recreate.assert_called_once_with(2) | 389 | trade_mock.tick_actions_recreate.assert_called_once_with(2) |
388 | trade_mock.prepare_order.assert_called_once_with(compute_value="tick1") | 390 | trade_mock.prepare_order.assert_called_once_with(compute_value="tick1") |
389 | m.report.log_error.assert_called_once_with("follow_orders", message=mock.ANY) | 391 | m.report.log_error.assert_called_once_with("follow_orders", message=mock.ANY) |
392 | m.report.log_order.assert_called_with(order_mock2, 2, new_order=new_order_mock) | ||
393 | new_order_mock.run.assert_called_once_with() | ||
390 | 394 | ||
391 | @mock.patch.object(market.BalanceStore, "fetch_balances") | 395 | @mock.patch.object(market.BalanceStore, "fetch_balances") |
392 | def test_move_balance(self, fetch_balances): | 396 | def test_move_balance(self, fetch_balances): |