mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 12:51:14 +00:00
Ensure get_fee returns something in tests
This commit is contained in:
@@ -241,6 +241,7 @@ def patch_exchange(
|
|||||||
if api_mock:
|
if api_mock:
|
||||||
mocker.patch(f'{EXMS}._init_ccxt', return_value=api_mock)
|
mocker.patch(f'{EXMS}._init_ccxt', return_value=api_mock)
|
||||||
else:
|
else:
|
||||||
|
mocker.patch(f'{EXMS}.get_fee', return_value=0.025)
|
||||||
mocker.patch(f'{EXMS}._init_ccxt', MagicMock())
|
mocker.patch(f'{EXMS}._init_ccxt', MagicMock())
|
||||||
mocker.patch(f'{EXMS}.timeframes', PropertyMock(
|
mocker.patch(f'{EXMS}.timeframes', PropertyMock(
|
||||||
return_value=['5m', '15m', '1h', '1d']))
|
return_value=['5m', '15m', '1h', '1d']))
|
||||||
|
|||||||
@@ -1121,12 +1121,12 @@ def test_create_dry_run_order_fees(
|
|||||||
price_side,
|
price_side,
|
||||||
fee,
|
fee,
|
||||||
):
|
):
|
||||||
|
exchange = get_patched_exchange(mocker, default_conf)
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
f'{EXMS}.get_fee',
|
f'{EXMS}.get_fee',
|
||||||
side_effect=lambda symbol, taker_or_maker: 2.0 if taker_or_maker == 'taker' else 1.0
|
side_effect=lambda symbol, taker_or_maker: 2.0 if taker_or_maker == 'taker' else 1.0
|
||||||
)
|
)
|
||||||
mocker.patch(f'{EXMS}._dry_is_price_crossed', return_value=price_side == 'other')
|
mocker.patch(f'{EXMS}._dry_is_price_crossed', return_value=price_side == 'other')
|
||||||
exchange = get_patched_exchange(mocker, default_conf)
|
|
||||||
|
|
||||||
order = exchange.create_dry_run_order(
|
order = exchange.create_dry_run_order(
|
||||||
pair='LTC/USDT',
|
pair='LTC/USDT',
|
||||||
|
|||||||
@@ -921,12 +921,12 @@ def test_backtest_results(default_conf, mocker, caplog, data: BTContainer) -> No
|
|||||||
default_conf["use_exit_signal"] = data.use_exit_signal
|
default_conf["use_exit_signal"] = data.use_exit_signal
|
||||||
default_conf["max_open_trades"] = 10
|
default_conf["max_open_trades"] = 10
|
||||||
|
|
||||||
|
patch_exchange(mocker)
|
||||||
mocker.patch(f"{EXMS}.get_fee", return_value=0.0)
|
mocker.patch(f"{EXMS}.get_fee", return_value=0.0)
|
||||||
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
mocker.patch(f"{EXMS}.get_min_pair_stake_amount", return_value=0.00001)
|
||||||
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
mocker.patch(f"{EXMS}.get_max_pair_stake_amount", return_value=float('inf'))
|
||||||
mocker.patch(f"{EXMS}.get_max_leverage", return_value=100)
|
mocker.patch(f"{EXMS}.get_max_leverage", return_value=100)
|
||||||
mocker.patch(f"{EXMS}.calculate_funding_fees", return_value=0)
|
mocker.patch(f"{EXMS}.calculate_funding_fees", return_value=0)
|
||||||
patch_exchange(mocker)
|
|
||||||
frame = _build_backtest_dataframe(data.data)
|
frame = _build_backtest_dataframe(data.data)
|
||||||
backtesting = Backtesting(default_conf)
|
backtesting = Backtesting(default_conf)
|
||||||
# TODO: Should we initialize this properly??
|
# TODO: Should we initialize this properly??
|
||||||
|
|||||||
Reference in New Issue
Block a user