Update dry-run order handling to use realistic fill prices

closes #3389
This commit is contained in:
Matthias
2021-06-03 20:55:18 +02:00
parent a0893b291a
commit 1e988c97ad
5 changed files with 84 additions and 19 deletions

View File

@@ -2117,6 +2117,7 @@ def test_get_historic_trades_notsupported(default_conf, mocker, caplog, exchange
def test_cancel_order_dry_run(default_conf, mocker, exchange_name):
default_conf['dry_run'] = True
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
mocker.patch('freqtrade.exchange.Exchange.dry_limit_order_filled', return_value=True)
assert exchange.cancel_order(order_id='123', pair='TKN/BTC') == {}
assert exchange.cancel_stoploss_order(order_id='123', pair='TKN/BTC') == {}

View File

@@ -996,7 +996,8 @@ def test_api_forcesell(botclient, mocker, ticker, fee, markets):
get_balances=MagicMock(return_value=ticker),
fetch_ticker=ticker,
get_fee=fee,
markets=PropertyMock(return_value=markets)
markets=PropertyMock(return_value=markets),
dry_limit_order_filled=MagicMock(return_value=True),
)
patch_get_signal(ftbot, (True, False))

View File

@@ -225,6 +225,7 @@ def test_status_handle(default_conf, update, ticker, fee, mocker) -> None:
'freqtrade.exchange.Exchange',
fetch_ticker=ticker,
get_fee=fee,
dry_limit_order_filled=MagicMock(return_value=True),
)
status_table = MagicMock()
mocker.patch.multiple(
@@ -671,6 +672,7 @@ def test_telegram_forcesell_handle(default_conf, update, ticker, fee,
'freqtrade.exchange.Exchange',
fetch_ticker=ticker,
get_fee=fee,
dry_limit_order_filled=MagicMock(return_value=True),
)
freqtradebot = FreqtradeBot(default_conf)
@@ -729,6 +731,7 @@ def test_telegram_forcesell_down_handle(default_conf, update, ticker, fee,
'freqtrade.exchange.Exchange',
fetch_ticker=ticker,
get_fee=fee,
dry_limit_order_filled=MagicMock(return_value=True),
)
freqtradebot = FreqtradeBot(default_conf)
@@ -789,6 +792,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None
'freqtrade.exchange.Exchange',
fetch_ticker=ticker,
get_fee=fee,
dry_limit_order_filled=MagicMock(return_value=True),
)
default_conf['max_open_trades'] = 4
freqtradebot = FreqtradeBot(default_conf)

View File

@@ -2750,6 +2750,7 @@ def test_execute_sell_with_stoploss_on_exchange(default_conf, ticker, fee, ticke
price_to_precision=lambda s, x, y: y,
stoploss=stoploss,
cancel_stoploss_order=cancel_order,
dry_limit_order_filled=MagicMock(return_value=True),
)
freqtrade = FreqtradeBot(default_conf)
@@ -2792,6 +2793,7 @@ def test_may_execute_sell_after_stoploss_on_exchange_hit(default_conf, ticker, f
get_fee=fee,
amount_to_precision=lambda s, x, y: y,
price_to_precision=lambda s, x, y: y,
dry_limit_order_filled=MagicMock(return_value=True),
)
stoploss = MagicMock(return_value={