Merge pull request #3086 from freqtrade/ftx_cancel_order
Ftx cancel order
This commit is contained in:
commit
d1bfe12bde
@ -891,6 +891,9 @@ class FreqtradeBot:
|
|||||||
if order['status'] != 'canceled':
|
if order['status'] != 'canceled':
|
||||||
reason = "cancelled due to timeout"
|
reason = "cancelled due to timeout"
|
||||||
corder = self.exchange.cancel_order(trade.open_order_id, trade.pair)
|
corder = self.exchange.cancel_order(trade.open_order_id, trade.pair)
|
||||||
|
# Some exchanges don't return a dict here.
|
||||||
|
if not isinstance(corder, dict):
|
||||||
|
corder = {}
|
||||||
logger.info('Buy order %s for %s.', reason, trade)
|
logger.info('Buy order %s for %s.', reason, trade)
|
||||||
else:
|
else:
|
||||||
# Order was cancelled already, so we can reuse the existing dict
|
# Order was cancelled already, so we can reuse the existing dict
|
||||||
|
@ -2228,10 +2228,16 @@ def test_handle_timedout_limit_buy(mocker, default_conf, limit_buy_order) -> Non
|
|||||||
assert cancel_order_mock.call_count == 1
|
assert cancel_order_mock.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_handle_timedout_limit_buy_corder_empty(mocker, default_conf, limit_buy_order) -> None:
|
@pytest.mark.parametrize('cancelorder', [
|
||||||
|
{},
|
||||||
|
'String Return value',
|
||||||
|
123
|
||||||
|
])
|
||||||
|
def test_handle_timedout_limit_buy_corder_empty(mocker, default_conf, limit_buy_order,
|
||||||
|
cancelorder) -> None:
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
cancel_order_mock = MagicMock(return_value={})
|
cancel_order_mock = MagicMock(return_value=cancelorder)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
'freqtrade.exchange.Exchange',
|
||||||
cancel_order=cancel_order_mock
|
cancel_order=cancel_order_mock
|
||||||
|
Loading…
Reference in New Issue
Block a user