improve cancel_order handling
This commit is contained in:
parent
9aac080414
commit
a5bd4e329a
@ -839,7 +839,8 @@ class FreqtradeBot:
|
|||||||
trade.stake_amount = trade.amount * trade.open_rate
|
trade.stake_amount = trade.amount * trade.open_rate
|
||||||
# verify if fees were taken from amount to avoid problems during selling
|
# verify if fees were taken from amount to avoid problems during selling
|
||||||
try:
|
try:
|
||||||
new_amount = self.get_real_amount(trade, order, trade.amount)
|
new_amount = self.get_real_amount(trade, corder if 'fee' in corder else order,
|
||||||
|
trade.amount)
|
||||||
if not isclose(order['amount'], new_amount, abs_tol=constants.MATH_CLOSE_PREC):
|
if not isclose(order['amount'], new_amount, abs_tol=constants.MATH_CLOSE_PREC):
|
||||||
trade.amount = new_amount
|
trade.amount = new_amount
|
||||||
# Fee was applied, so set to 0
|
# Fee was applied, so set to 0
|
||||||
|
@ -1804,7 +1804,7 @@ def test_close_trade(default_conf, ticker, limit_buy_order, limit_sell_order,
|
|||||||
def test_check_handle_timedout_buy(default_conf, ticker, limit_buy_order_old, open_trade,
|
def test_check_handle_timedout_buy(default_conf, ticker, limit_buy_order_old, open_trade,
|
||||||
fee, mocker) -> None:
|
fee, mocker) -> None:
|
||||||
rpc_mock = patch_RPCManager(mocker)
|
rpc_mock = patch_RPCManager(mocker)
|
||||||
cancel_order_mock = MagicMock()
|
cancel_order_mock = MagicMock(return_value=limit_buy_order_old)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
'freqtrade.exchange.Exchange',
|
||||||
|
Loading…
Reference in New Issue
Block a user