if status == "error_disappeared":
self.report.log_error("follow_orders",
message="{} disappeared, recreating it".format(order))
- order.trade.prepare_order(
+ new_order = order.trade.prepare_order(
compute_value=order.trade.tick_actions_recreate(tick))
+ new_order.run()
+ self.report.log_order(order, tick, new_order=new_order)
self.report.log_stage("follow_orders_end")
order_mock2.trade = trade_mock
trade_mock.tick_actions_recreate.return_value = "tick1"
+ new_order_mock = mock.Mock()
+ trade_mock.prepare_order.return_value = new_order_mock
m.follow_orders()
trade_mock.tick_actions_recreate.assert_called_once_with(2)
trade_mock.prepare_order.assert_called_once_with(compute_value="tick1")
m.report.log_error.assert_called_once_with("follow_orders", message=mock.ANY)
+ m.report.log_order.assert_called_with(order_mock2, 2, new_order=new_order_mock)
+ new_order_mock.run.assert_called_once_with()
@mock.patch.object(market.BalanceStore, "fetch_balances")
def test_move_balance(self, fetch_balances):