Update more exchange mocks to use EXMS
This commit is contained in:
parent
bcdf4e0fe8
commit
2ca8b0b12e
@ -953,7 +953,7 @@ def test_start_list_freqAI_models(capsys):
|
|||||||
|
|
||||||
def test_start_test_pairlist(mocker, caplog, tickers, default_conf, capsys):
|
def test_start_test_pairlist(mocker, caplog, tickers, default_conf, capsys):
|
||||||
patch_exchange(mocker, mock_markets=True)
|
patch_exchange(mocker, mock_markets=True)
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
)
|
)
|
||||||
|
@ -301,7 +301,7 @@ def test_current_whitelist(mocker, default_conf, tickers):
|
|||||||
# patch default conf to volumepairlist
|
# patch default conf to volumepairlist
|
||||||
default_conf['pairlists'][0] = {'method': 'VolumePairList', "number_assets": 5}
|
default_conf['pairlists'][0] = {'method': 'VolumePairList', "number_assets": 5}
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers)
|
get_tickers=tickers)
|
||||||
exchange = get_patched_exchange(mocker, default_conf)
|
exchange = get_patched_exchange(mocker, default_conf)
|
||||||
|
@ -1234,7 +1234,7 @@ def test_create_dry_run_order_limit_fill(default_conf, mocker, side, price, fill
|
|||||||
exchange_name, order_book_l2_usd, converted):
|
exchange_name, order_book_l2_usd, converted):
|
||||||
default_conf['dry_run'] = True
|
default_conf['dry_run'] = True
|
||||||
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
|
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
fetch_l2_order_book=order_book_l2_usd,
|
fetch_l2_order_book=order_book_l2_usd,
|
||||||
)
|
)
|
||||||
@ -1296,7 +1296,7 @@ def test_create_dry_run_order_market_fill(default_conf, mocker, side, rate, amou
|
|||||||
exchange_name, order_book_l2_usd):
|
exchange_name, order_book_l2_usd):
|
||||||
default_conf['dry_run'] = True
|
default_conf['dry_run'] = True
|
||||||
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
|
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
fetch_l2_order_book=order_book_l2_usd,
|
fetch_l2_order_book=order_book_l2_usd,
|
||||||
)
|
)
|
||||||
@ -3238,7 +3238,7 @@ def test_fetch_order_or_stoploss_order(default_conf, mocker):
|
|||||||
exchange = get_patched_exchange(mocker, default_conf, id='binance')
|
exchange = get_patched_exchange(mocker, default_conf, id='binance')
|
||||||
fetch_order_mock = MagicMock()
|
fetch_order_mock = MagicMock()
|
||||||
fetch_stoploss_order_mock = MagicMock()
|
fetch_stoploss_order_mock = MagicMock()
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
fetch_order=fetch_order_mock,
|
fetch_order=fetch_order_mock,
|
||||||
fetch_stoploss_order=fetch_stoploss_order_mock,
|
fetch_stoploss_order=fetch_stoploss_order_mock,
|
||||||
)
|
)
|
||||||
@ -3367,7 +3367,7 @@ def test_stoploss_order_unsupported_exchange(default_conf, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_merge_ft_has_dict(default_conf, mocker):
|
def test_merge_ft_has_dict(default_conf, mocker):
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
_init_ccxt=MagicMock(return_value=MagicMock()),
|
_init_ccxt=MagicMock(return_value=MagicMock()),
|
||||||
_load_async_markets=MagicMock(),
|
_load_async_markets=MagicMock(),
|
||||||
validate_pairs=MagicMock(),
|
validate_pairs=MagicMock(),
|
||||||
@ -3402,7 +3402,7 @@ def test_merge_ft_has_dict(default_conf, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_valid_pair_combination(default_conf, mocker, markets):
|
def test_get_valid_pair_combination(default_conf, mocker, markets):
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
_init_ccxt=MagicMock(return_value=MagicMock()),
|
_init_ccxt=MagicMock(return_value=MagicMock()),
|
||||||
_load_async_markets=MagicMock(),
|
_load_async_markets=MagicMock(),
|
||||||
validate_pairs=MagicMock(),
|
validate_pairs=MagicMock(),
|
||||||
@ -3494,7 +3494,7 @@ def test_get_markets(default_conf, mocker, markets_static,
|
|||||||
spot_only, futures_only, expected_keys,
|
spot_only, futures_only, expected_keys,
|
||||||
test_comment # Here for debugging purposes (Not used within method)
|
test_comment # Here for debugging purposes (Not used within method)
|
||||||
):
|
):
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
_init_ccxt=MagicMock(return_value=MagicMock()),
|
_init_ccxt=MagicMock(return_value=MagicMock()),
|
||||||
_load_async_markets=MagicMock(),
|
_load_async_markets=MagicMock(),
|
||||||
validate_pairs=MagicMock(),
|
validate_pairs=MagicMock(),
|
||||||
@ -5071,7 +5071,7 @@ def test_get_liquidation_price1(mocker, default_conf):
|
|||||||
]
|
]
|
||||||
api_mock.fetch_positions = MagicMock(return_value=positions)
|
api_mock.fetch_positions = MagicMock(return_value=positions)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
)
|
)
|
||||||
default_conf['dry_run'] = False
|
default_conf['dry_run'] = False
|
||||||
|
@ -924,7 +924,7 @@ def test_backtest_results(default_conf, fee, mocker, caplog, data: BTContainer)
|
|||||||
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("freqtrade.exchange.Binance.get_max_leverage", return_value=100)
|
mocker.patch('freqtrade.exchange.binance.Binance.get_max_leverage', return_value=100)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
frame = _build_backtest_dataframe(data.data)
|
frame = _build_backtest_dataframe(data.data)
|
||||||
backtesting = Backtesting(default_conf)
|
backtesting = Backtesting(default_conf)
|
||||||
|
@ -116,7 +116,7 @@ def static_pl_conf(whitelist_conf):
|
|||||||
|
|
||||||
|
|
||||||
def test_log_cached(mocker, static_pl_conf, markets, tickers):
|
def test_log_cached(mocker, static_pl_conf, markets, tickers):
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -180,7 +180,7 @@ def test_refresh_market_pair_not_in_whitelist(mocker, markets, static_pl_conf):
|
|||||||
def test_refresh_static_pairlist(mocker, markets, static_pl_conf):
|
def test_refresh_static_pairlist(mocker, markets, static_pl_conf):
|
||||||
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
)
|
)
|
||||||
@ -204,7 +204,7 @@ def test_refresh_static_pairlist_noexist(mocker, markets, static_pl_conf, pairs,
|
|||||||
static_pl_conf['exchange']['pair_whitelist'] += pairs
|
static_pl_conf['exchange']['pair_whitelist'] += pairs
|
||||||
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
)
|
)
|
||||||
@ -221,7 +221,7 @@ def test_invalid_blacklist(mocker, markets, static_pl_conf, caplog):
|
|||||||
static_pl_conf['exchange']['pair_blacklist'] = ['*/BTC']
|
static_pl_conf['exchange']['pair_blacklist'] = ['*/BTC']
|
||||||
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
)
|
)
|
||||||
@ -237,7 +237,7 @@ def test_remove_logs_for_pairs_already_in_blacklist(mocker, markets, static_pl_c
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
)
|
)
|
||||||
@ -264,14 +264,14 @@ def test_remove_logs_for_pairs_already_in_blacklist(mocker, markets, static_pl_c
|
|||||||
def test_refresh_pairlist_dynamic(mocker, shitcoinmarkets, tickers, whitelist_conf):
|
def test_refresh_pairlist_dynamic(mocker, shitcoinmarkets, tickers, whitelist_conf):
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
)
|
)
|
||||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
||||||
# Remock markets with shitcoinmarkets since get_patched_freqtradebot uses the markets fixture
|
# Remock markets with shitcoinmarkets since get_patched_freqtradebot uses the markets fixture
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=shitcoinmarkets),
|
markets=PropertyMock(return_value=shitcoinmarkets),
|
||||||
)
|
)
|
||||||
# argument: use the whitelist dynamically by exchange-volume
|
# argument: use the whitelist dynamically by exchange-volume
|
||||||
@ -291,7 +291,7 @@ def test_refresh_pairlist_dynamic_2(mocker, shitcoinmarkets, tickers, whitelist_
|
|||||||
tickers_dict = tickers()
|
tickers_dict = tickers()
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
)
|
)
|
||||||
# Remove caching of ticker data to emulate changing volume by the time of second call
|
# Remove caching of ticker data to emulate changing volume by the time of second call
|
||||||
@ -302,7 +302,7 @@ def test_refresh_pairlist_dynamic_2(mocker, shitcoinmarkets, tickers, whitelist_
|
|||||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf_2)
|
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf_2)
|
||||||
# Remock markets with shitcoinmarkets since get_patched_freqtradebot uses the markets fixture
|
# Remock markets with shitcoinmarkets since get_patched_freqtradebot uses the markets fixture
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=shitcoinmarkets),
|
markets=PropertyMock(return_value=shitcoinmarkets),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ def test_refresh_pairlist_dynamic_2(mocker, shitcoinmarkets, tickers, whitelist_
|
|||||||
|
|
||||||
def test_VolumePairList_refresh_empty(mocker, markets_empty, whitelist_conf):
|
def test_VolumePairList_refresh_empty(mocker, markets_empty, whitelist_conf):
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
)
|
)
|
||||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
||||||
@ -526,12 +526,12 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
|
|||||||
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
||||||
|
|
||||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
markets=PropertyMock(return_value=shitcoinmarkets)
|
markets=PropertyMock(return_value=shitcoinmarkets)
|
||||||
)
|
)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
refresh_latest_ohlcv=MagicMock(return_value=ohlcv_data),
|
refresh_latest_ohlcv=MagicMock(return_value=ohlcv_data),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -675,7 +675,7 @@ def test_VolumePairList_range(mocker, whitelist_conf, shitcoinmarkets, tickers,
|
|||||||
else:
|
else:
|
||||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
markets=PropertyMock(return_value=shitcoinmarkets)
|
markets=PropertyMock(return_value=shitcoinmarkets)
|
||||||
)
|
)
|
||||||
@ -687,7 +687,7 @@ def test_VolumePairList_range(mocker, whitelist_conf, shitcoinmarkets, tickers,
|
|||||||
ohlcv_data = []
|
ohlcv_data = []
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
refresh_latest_ohlcv=MagicMock(return_value=ohlcv_data),
|
refresh_latest_ohlcv=MagicMock(return_value=ohlcv_data),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -806,7 +806,7 @@ def test_PerformanceFilter_keep_mid_order(mocker, default_conf_usdt, fee, caplog
|
|||||||
def test_gen_pair_whitelist_not_supported(mocker, default_conf, tickers) -> None:
|
def test_gen_pair_whitelist_not_supported(mocker, default_conf, tickers) -> None:
|
||||||
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10}]
|
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
exchange_has=MagicMock(return_value=False),
|
exchange_has=MagicMock(return_value=False),
|
||||||
)
|
)
|
||||||
@ -819,7 +819,7 @@ def test_gen_pair_whitelist_not_supported(mocker, default_conf, tickers) -> None
|
|||||||
def test_pair_whitelist_not_supported_Spread(mocker, default_conf, tickers) -> None:
|
def test_pair_whitelist_not_supported_Spread(mocker, default_conf, tickers) -> None:
|
||||||
default_conf['pairlists'] = [{'method': 'StaticPairList'}, {'method': 'SpreadFilter'}]
|
default_conf['pairlists'] = [{'method': 'StaticPairList'}, {'method': 'SpreadFilter'}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
exchange_has=MagicMock(return_value=False),
|
exchange_has=MagicMock(return_value=False),
|
||||||
)
|
)
|
||||||
@ -832,7 +832,7 @@ def test_pair_whitelist_not_supported_Spread(mocker, default_conf, tickers) -> N
|
|||||||
@pytest.mark.parametrize("pairlist", TESTABLE_PAIRLISTS)
|
@pytest.mark.parametrize("pairlist", TESTABLE_PAIRLISTS)
|
||||||
def test_pairlist_class(mocker, whitelist_conf, markets, pairlist):
|
def test_pairlist_class(mocker, whitelist_conf, markets, pairlist):
|
||||||
whitelist_conf['pairlists'][0]['method'] = pairlist
|
whitelist_conf['pairlists'][0]['method'] = pairlist
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True)
|
exchange_has=MagicMock(return_value=True)
|
||||||
)
|
)
|
||||||
@ -861,7 +861,7 @@ def test_pairlist_class(mocker, whitelist_conf, markets, pairlist):
|
|||||||
def test__whitelist_for_active_markets(mocker, whitelist_conf, markets, pairlist, whitelist, caplog,
|
def test__whitelist_for_active_markets(mocker, whitelist_conf, markets, pairlist, whitelist, caplog,
|
||||||
log_message, tickers):
|
log_message, tickers):
|
||||||
whitelist_conf['pairlists'][0]['method'] = pairlist
|
whitelist_conf['pairlists'][0]['method'] = pairlist
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -884,7 +884,7 @@ def test__whitelist_for_active_markets_empty(mocker, whitelist_conf, pairlist, t
|
|||||||
mocker.patch(f'{EXMS}.exchange_has', return_value=True)
|
mocker.patch(f'{EXMS}.exchange_has', return_value=True)
|
||||||
|
|
||||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=None),
|
markets=PropertyMock(return_value=None),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
)
|
)
|
||||||
@ -905,7 +905,7 @@ def test_volumepairlist_invalid_sortvalue(mocker, whitelist_conf):
|
|||||||
|
|
||||||
def test_volumepairlist_caching(mocker, markets, whitelist_conf, tickers):
|
def test_volumepairlist_caching(mocker, markets, whitelist_conf, tickers):
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -925,7 +925,7 @@ def test_agefilter_min_days_listed_too_small(mocker, default_conf, markets, tick
|
|||||||
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
||||||
{'method': 'AgeFilter', 'min_days_listed': -1}]
|
{'method': 'AgeFilter', 'min_days_listed': -1}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -941,7 +941,7 @@ def test_agefilter_max_days_lower_than_min_days(mocker, default_conf, markets, t
|
|||||||
{'method': 'AgeFilter', 'min_days_listed': 3,
|
{'method': 'AgeFilter', 'min_days_listed': 3,
|
||||||
"max_days_listed": 2}]
|
"max_days_listed": 2}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -956,7 +956,7 @@ def test_agefilter_min_days_listed_too_large(mocker, default_conf, markets, tick
|
|||||||
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
||||||
{'method': 'AgeFilter', 'min_days_listed': 99999}]
|
{'method': 'AgeFilter', 'min_days_listed': 99999}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -976,7 +976,7 @@ def test_agefilter_caching(mocker, markets, whitelist_conf_agefilter, tickers, o
|
|||||||
('LTC/BTC', '1d', CandleType.SPOT): ohlcv_history,
|
('LTC/BTC', '1d', CandleType.SPOT): ohlcv_history,
|
||||||
}
|
}
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
@ -1044,7 +1044,7 @@ def test_rangestabilityfilter_checks(mocker, default_conf, markets, tickers):
|
|||||||
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
||||||
{'method': 'RangeStabilityFilter', 'lookback_days': 99999}]
|
{'method': 'RangeStabilityFilter', 'lookback_days': 99999}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -1074,7 +1074,7 @@ def test_rangestabilityfilter_caching(mocker, markets, default_conf, tickers, oh
|
|||||||
'min_rate_of_change': min_rate_of_change,
|
'min_rate_of_change': min_rate_of_change,
|
||||||
"max_rate_of_change": max_rate_of_change}]
|
"max_rate_of_change": max_rate_of_change}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -1088,7 +1088,7 @@ def test_rangestabilityfilter_caching(mocker, markets, default_conf, tickers, oh
|
|||||||
('BLK/BTC', '1d', CandleType.SPOT): ohlcv_history,
|
('BLK/BTC', '1d', CandleType.SPOT): ohlcv_history,
|
||||||
}
|
}
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
refresh_latest_ohlcv=MagicMock(return_value=ohlcv_data),
|
refresh_latest_ohlcv=MagicMock(return_value=ohlcv_data),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1109,7 +1109,7 @@ def test_spreadfilter_invalid_data(mocker, default_conf, markets, tickers, caplo
|
|||||||
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
default_conf['pairlists'] = [{'method': 'VolumePairList', 'number_assets': 10},
|
||||||
{'method': 'SpreadFilter', 'max_spread_ratio': 0.1}]
|
{'method': 'SpreadFilter', 'max_spread_ratio': 0.1}]
|
||||||
|
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
get_tickers=tickers
|
get_tickers=tickers
|
||||||
@ -1123,7 +1123,7 @@ def test_spreadfilter_invalid_data(mocker, default_conf, markets, tickers, caplo
|
|||||||
tickers.return_value['ETH/BTC']['ask'] = 0.0
|
tickers.return_value['ETH/BTC']['ask'] = 0.0
|
||||||
del tickers.return_value['TKN/BTC']
|
del tickers.return_value['TKN/BTC']
|
||||||
del tickers.return_value['LTC/BTC']
|
del tickers.return_value['LTC/BTC']
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange', get_tickers=tickers)
|
mocker.patch.multiple(EXMS, get_tickers=tickers)
|
||||||
|
|
||||||
ftbot.pairlists.refresh_pairlist()
|
ftbot.pairlists.refresh_pairlist()
|
||||||
assert log_has_re(r'Removed .* invalid ticker data.*', caplog)
|
assert log_has_re(r'Removed .* invalid ticker data.*', caplog)
|
||||||
@ -1197,7 +1197,7 @@ def test_spreadfilter_invalid_data(mocker, default_conf, markets, tickers, caplo
|
|||||||
])
|
])
|
||||||
def test_pricefilter_desc(mocker, whitelist_conf, markets, pairlistconfig,
|
def test_pricefilter_desc(mocker, whitelist_conf, markets, pairlistconfig,
|
||||||
desc_expected, exception_expected):
|
desc_expected, exception_expected):
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True)
|
exchange_has=MagicMock(return_value=True)
|
||||||
)
|
)
|
||||||
@ -1269,11 +1269,11 @@ def test_performance_filter(mocker, whitelist_conf, pairlists, pair_allowlist, o
|
|||||||
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
||||||
|
|
||||||
freqtrade = get_patched_freqtradebot(mocker, allowlist_conf)
|
freqtrade = get_patched_freqtradebot(mocker, allowlist_conf)
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
get_tickers=tickers,
|
get_tickers=tickers,
|
||||||
markets=PropertyMock(return_value=markets)
|
markets=PropertyMock(return_value=markets)
|
||||||
)
|
)
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
get_historic_ohlcv=MagicMock(return_value=ohlcv_history_list),
|
get_historic_ohlcv=MagicMock(return_value=ohlcv_history_list),
|
||||||
)
|
)
|
||||||
mocker.patch.multiple('freqtrade.persistence.Trade',
|
mocker.patch.multiple('freqtrade.persistence.Trade',
|
||||||
@ -1389,7 +1389,7 @@ def test_ProducerPairlist_no_emc(mocker, whitelist_conf):
|
|||||||
|
|
||||||
def test_ProducerPairlist(mocker, whitelist_conf, markets):
|
def test_ProducerPairlist(mocker, whitelist_conf, markets):
|
||||||
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple(EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
exchange_has=MagicMock(return_value=True),
|
exchange_has=MagicMock(return_value=True),
|
||||||
)
|
)
|
||||||
|
@ -96,7 +96,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
}
|
}
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(side_effect=[False, True]),
|
_dry_is_price_crossed=MagicMock(side_effect=[False, True]),
|
||||||
@ -197,7 +197,7 @@ def test_rpc_status_table(default_conf, ticker, fee, mocker) -> None:
|
|||||||
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -264,7 +264,7 @@ def test__rpc_timeunit_profit(default_conf_usdt, ticker, fee,
|
|||||||
limit_buy_order, limit_sell_order, markets, mocker) -> None:
|
limit_buy_order, limit_sell_order, markets, mocker) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
markets=PropertyMock(return_value=markets)
|
markets=PropertyMock(return_value=markets)
|
||||||
@ -305,7 +305,7 @@ def test__rpc_timeunit_profit(default_conf_usdt, ticker, fee,
|
|||||||
def test_rpc_trade_history(mocker, default_conf, markets, fee, is_short):
|
def test_rpc_trade_history(mocker, default_conf, markets, fee, is_short):
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets)
|
markets=PropertyMock(return_value=markets)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ def test_rpc_delete_trade(mocker, default_conf, fee, markets, caplog, is_short):
|
|||||||
stoploss_mock = MagicMock()
|
stoploss_mock = MagicMock()
|
||||||
cancel_mock = MagicMock()
|
cancel_mock = MagicMock()
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
cancel_order=cancel_mock,
|
cancel_order=cancel_mock,
|
||||||
cancel_stoploss_order=stoploss_mock,
|
cancel_stoploss_order=stoploss_mock,
|
||||||
@ -384,7 +384,7 @@ def test_rpc_trade_statistics(default_conf_usdt, ticker, fee, mocker) -> None:
|
|||||||
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=1.1)
|
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=1.1)
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -455,7 +455,7 @@ def test_rpc_balance_handle_error(default_conf, mocker):
|
|||||||
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=mock_balance),
|
get_balances=MagicMock(return_value=mock_balance),
|
||||||
get_tickers=MagicMock(side_effect=TemporaryError('Could not load ticker due to xxx'))
|
get_tickers=MagicMock(side_effect=TemporaryError('Could not load ticker due to xxx'))
|
||||||
)
|
)
|
||||||
@ -518,7 +518,7 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
validate_trading_mode_and_margin_mode=MagicMock(),
|
validate_trading_mode_and_margin_mode=MagicMock(),
|
||||||
get_balances=MagicMock(return_value=mock_balance),
|
get_balances=MagicMock(return_value=mock_balance),
|
||||||
fetch_positions=MagicMock(return_value=mock_pos),
|
fetch_positions=MagicMock(return_value=mock_pos),
|
||||||
@ -595,7 +595,7 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
|
|||||||
def test_rpc_start(mocker, default_conf) -> None:
|
def test_rpc_start(mocker, default_conf) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock()
|
fetch_ticker=MagicMock()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -616,7 +616,7 @@ def test_rpc_start(mocker, default_conf) -> None:
|
|||||||
def test_rpc_stop(mocker, default_conf) -> None:
|
def test_rpc_stop(mocker, default_conf) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock()
|
fetch_ticker=MagicMock()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ def test_rpc_stop(mocker, default_conf) -> None:
|
|||||||
def test_rpc_stopentry(mocker, default_conf) -> None:
|
def test_rpc_stopentry(mocker, default_conf) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock()
|
fetch_ticker=MagicMock()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -658,7 +658,7 @@ def test_rpc_force_exit(default_conf, ticker, fee, mocker) -> None:
|
|||||||
|
|
||||||
cancel_order_mock = MagicMock()
|
cancel_order_mock = MagicMock()
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
cancel_order=cancel_order_mock,
|
cancel_order=cancel_order_mock,
|
||||||
fetch_order=MagicMock(
|
fetch_order=MagicMock(
|
||||||
@ -787,7 +787,7 @@ def test_rpc_force_exit(default_conf, ticker, fee, mocker) -> None:
|
|||||||
def test_performance_handle(default_conf_usdt, ticker, fee, mocker) -> None:
|
def test_performance_handle(default_conf_usdt, ticker, fee, mocker) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -810,7 +810,7 @@ def test_enter_tag_performance_handle(default_conf, ticker, fee, mocker) -> None
|
|||||||
|
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -842,7 +842,7 @@ def test_enter_tag_performance_handle(default_conf, ticker, fee, mocker) -> None
|
|||||||
def test_enter_tag_performance_handle_2(mocker, default_conf, markets, fee):
|
def test_enter_tag_performance_handle_2(mocker, default_conf, markets, fee):
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets)
|
markets=PropertyMock(return_value=markets)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -871,7 +871,7 @@ def test_enter_tag_performance_handle_2(mocker, default_conf, markets, fee):
|
|||||||
def test_exit_reason_performance_handle(default_conf_usdt, ticker, fee, mocker) -> None:
|
def test_exit_reason_performance_handle(default_conf_usdt, ticker, fee, mocker) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -898,7 +898,7 @@ def test_exit_reason_performance_handle(default_conf_usdt, ticker, fee, mocker)
|
|||||||
def test_exit_reason_performance_handle_2(mocker, default_conf, markets, fee):
|
def test_exit_reason_performance_handle_2(mocker, default_conf, markets, fee):
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets)
|
markets=PropertyMock(return_value=markets)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -927,7 +927,7 @@ def test_exit_reason_performance_handle_2(mocker, default_conf, markets, fee):
|
|||||||
def test_mix_tag_performance_handle(default_conf, ticker, fee, mocker) -> None:
|
def test_mix_tag_performance_handle(default_conf, ticker, fee, mocker) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -951,7 +951,7 @@ def test_mix_tag_performance_handle(default_conf, ticker, fee, mocker) -> None:
|
|||||||
def test_mix_tag_performance_handle_2(mocker, default_conf, markets, fee):
|
def test_mix_tag_performance_handle_2(mocker, default_conf, markets, fee):
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets)
|
markets=PropertyMock(return_value=markets)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -981,7 +981,7 @@ def test_mix_tag_performance_handle_2(mocker, default_conf, markets, fee):
|
|||||||
def test_rpc_count(mocker, default_conf, ticker, fee) -> None:
|
def test_rpc_count(mocker, default_conf, ticker, fee) -> None:
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -1006,7 +1006,7 @@ def test_rpc_force_entry(mocker, default_conf, ticker, fee, limit_buy_order_open
|
|||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
buy_mm = MagicMock(return_value=limit_buy_order_open)
|
buy_mm = MagicMock(return_value=limit_buy_order_open)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
|
@ -507,7 +507,7 @@ def test_api_count(botclient, mocker, ticker, fee, markets, is_short):
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot)
|
patch_get_signal(ftbot)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -594,7 +594,7 @@ def test_api_daily(botclient, mocker, ticker, fee, markets):
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot)
|
patch_get_signal(ftbot)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -613,7 +613,7 @@ def test_api_trades(botclient, mocker, fee, markets, is_short):
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot)
|
patch_get_signal(ftbot)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets)
|
markets=PropertyMock(return_value=markets)
|
||||||
)
|
)
|
||||||
rc = client_get(client, f"{BASE_URI}/trades")
|
rc = client_get(client, f"{BASE_URI}/trades")
|
||||||
@ -644,7 +644,7 @@ def test_api_trade_single(botclient, mocker, fee, ticker, markets, is_short):
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot, enter_long=not is_short, enter_short=is_short)
|
patch_get_signal(ftbot, enter_long=not is_short, enter_short=is_short)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
)
|
)
|
||||||
@ -668,7 +668,7 @@ def test_api_delete_trade(botclient, mocker, fee, markets, is_short):
|
|||||||
stoploss_mock = MagicMock()
|
stoploss_mock = MagicMock()
|
||||||
cancel_mock = MagicMock()
|
cancel_mock = MagicMock()
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
cancel_order=cancel_mock,
|
cancel_order=cancel_mock,
|
||||||
cancel_stoploss_order=stoploss_mock,
|
cancel_stoploss_order=stoploss_mock,
|
||||||
@ -713,7 +713,7 @@ def test_api_delete_open_order(botclient, mocker, fee, markets, ticker, is_short
|
|||||||
stoploss_mock = MagicMock()
|
stoploss_mock = MagicMock()
|
||||||
cancel_mock = MagicMock()
|
cancel_mock = MagicMock()
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
markets=PropertyMock(return_value=markets),
|
markets=PropertyMock(return_value=markets),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
cancel_order=cancel_mock,
|
cancel_order=cancel_mock,
|
||||||
@ -780,7 +780,7 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets):
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot)
|
patch_get_signal(ftbot)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -842,7 +842,7 @@ def test_api_profit(botclient, mocker, ticker, fee, markets, is_short, expected)
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot)
|
patch_get_signal(ftbot)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -900,7 +900,7 @@ def test_api_stats(botclient, mocker, ticker, fee, markets, is_short):
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot, enter_long=not is_short, enter_short=is_short)
|
patch_get_signal(ftbot, enter_long=not is_short, enter_short=is_short)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -981,7 +981,7 @@ def test_api_status(botclient, mocker, ticker, fee, markets, is_short,
|
|||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
patch_get_signal(ftbot)
|
patch_get_signal(ftbot)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -1274,7 +1274,7 @@ def test_api_force_entry(botclient, mocker, fee, endpoint):
|
|||||||
def test_api_forceexit(botclient, mocker, ticker, fee, markets):
|
def test_api_forceexit(botclient, mocker, ticker, fee, markets):
|
||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value=ticker),
|
get_balances=MagicMock(return_value=ticker),
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
|
@ -240,7 +240,7 @@ def test_telegram_status_multi_entry(default_conf, update, mocker, fee) -> None:
|
|||||||
default_conf['telegram']['chat_id'] = "123"
|
default_conf['telegram']['chat_id'] = "123"
|
||||||
default_conf['position_adjustment_enable'] = True
|
default_conf['position_adjustment_enable'] = True
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_order=MagicMock(return_value=None),
|
fetch_order=MagicMock(return_value=None),
|
||||||
get_rate=MagicMock(return_value=0.22),
|
get_rate=MagicMock(return_value=0.22),
|
||||||
)
|
)
|
||||||
@ -292,7 +292,7 @@ def test_telegram_status_closed_trade(default_conf, update, mocker, fee) -> None
|
|||||||
default_conf['telegram']['chat_id'] = "123"
|
default_conf['telegram']['chat_id'] = "123"
|
||||||
default_conf['position_adjustment_enable'] = True
|
default_conf['position_adjustment_enable'] = True
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_order=MagicMock(return_value=None),
|
fetch_order=MagicMock(return_value=None),
|
||||||
get_rate=MagicMock(return_value=0.22),
|
get_rate=MagicMock(return_value=0.22),
|
||||||
)
|
)
|
||||||
@ -314,7 +314,7 @@ def test_telegram_status_closed_trade(default_conf, update, mocker, fee) -> None
|
|||||||
def test_status_handle(default_conf, update, ticker, fee, mocker) -> None:
|
def test_status_handle(default_conf, update, ticker, fee, mocker) -> None:
|
||||||
default_conf['max_open_trades'] = 3
|
default_conf['max_open_trades'] = 3
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=True),
|
_dry_is_price_crossed=MagicMock(return_value=True),
|
||||||
@ -391,7 +391,7 @@ def test_status_handle(default_conf, update, ticker, fee, mocker) -> None:
|
|||||||
|
|
||||||
def test_status_table_handle(default_conf, update, ticker, fee, mocker) -> None:
|
def test_status_table_handle(default_conf, update, ticker, fee, mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -436,7 +436,7 @@ def test_daily_handle(default_conf_usdt, update, ticker, fee, mocker, time_machi
|
|||||||
return_value=1.1
|
return_value=1.1
|
||||||
)
|
)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -491,7 +491,7 @@ def test_daily_handle(default_conf_usdt, update, ticker, fee, mocker, time_machi
|
|||||||
|
|
||||||
def test_daily_wrong_input(default_conf, update, ticker, mocker) -> None:
|
def test_daily_wrong_input(default_conf, update, ticker, mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker
|
fetch_ticker=ticker
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ def test_weekly_handle(default_conf_usdt, update, ticker, fee, mocker, time_mach
|
|||||||
return_value=1.1
|
return_value=1.1
|
||||||
)
|
)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -595,7 +595,7 @@ def test_monthly_handle(default_conf_usdt, update, ticker, fee, mocker, time_mac
|
|||||||
return_value=1.1
|
return_value=1.1
|
||||||
)
|
)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -676,7 +676,7 @@ def test_profit_handle(default_conf_usdt, update, ticker_usdt, ticker_sell_up, f
|
|||||||
limit_sell_order_usdt, mocker) -> None:
|
limit_sell_order_usdt, mocker) -> None:
|
||||||
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=1.1)
|
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=1.1)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -739,7 +739,7 @@ def test_profit_handle(default_conf_usdt, update, ticker_usdt, ticker_sell_up, f
|
|||||||
def test_telegram_stats(default_conf, update, ticker, fee, mocker, is_short) -> None:
|
def test_telegram_stats(default_conf, update, ticker, fee, mocker, is_short) -> None:
|
||||||
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -930,7 +930,7 @@ def test_telegram_forceexit_handle(default_conf, update, ticker, fee,
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
patch_whitelist(mocker, default_conf)
|
patch_whitelist(mocker, default_conf)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=True),
|
_dry_is_price_crossed=MagicMock(return_value=True),
|
||||||
@ -999,7 +999,7 @@ def test_telegram_force_exit_down_handle(default_conf, update, ticker, fee,
|
|||||||
patch_whitelist(mocker, default_conf)
|
patch_whitelist(mocker, default_conf)
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=True),
|
_dry_is_price_crossed=MagicMock(return_value=True),
|
||||||
@ -1015,7 +1015,7 @@ def test_telegram_force_exit_down_handle(default_conf, update, ticker, fee,
|
|||||||
|
|
||||||
# Decrease the price and sell it
|
# Decrease the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_sell_down
|
fetch_ticker=ticker_sell_down
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1070,7 +1070,7 @@ def test_forceexit_all_handle(default_conf, update, ticker, fee, mocker) -> None
|
|||||||
mocker.patch('freqtrade.rpc.telegram.Telegram._init', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram._init', MagicMock())
|
||||||
patch_whitelist(mocker, default_conf)
|
patch_whitelist(mocker, default_conf)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=True),
|
_dry_is_price_crossed=MagicMock(return_value=True),
|
||||||
@ -1155,7 +1155,7 @@ def test_forceexit_handle_invalid(default_conf, update, mocker) -> None:
|
|||||||
def test_force_exit_no_pair(default_conf, update, ticker, fee, mocker) -> None:
|
def test_force_exit_no_pair(default_conf, update, ticker, fee, mocker) -> None:
|
||||||
default_conf['max_open_trades'] = 4
|
default_conf['max_open_trades'] = 4
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=True),
|
_dry_is_price_crossed=MagicMock(return_value=True),
|
||||||
@ -1282,7 +1282,7 @@ def test_force_enter_no_pair(default_conf, update, mocker) -> None:
|
|||||||
def test_telegram_performance_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
|
def test_telegram_performance_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -1300,7 +1300,7 @@ def test_telegram_performance_handle(default_conf_usdt, update, ticker, fee, moc
|
|||||||
def test_telegram_entry_tag_performance_handle(
|
def test_telegram_entry_tag_performance_handle(
|
||||||
default_conf_usdt, update, ticker, fee, mocker) -> None:
|
default_conf_usdt, update, ticker, fee, mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -1331,7 +1331,7 @@ def test_telegram_entry_tag_performance_handle(
|
|||||||
def test_telegram_exit_reason_performance_handle(default_conf_usdt, update, ticker, fee,
|
def test_telegram_exit_reason_performance_handle(default_conf_usdt, update, ticker, fee,
|
||||||
mocker) -> None:
|
mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -1362,7 +1362,7 @@ def test_telegram_exit_reason_performance_handle(default_conf_usdt, update, tick
|
|||||||
def test_telegram_mix_tag_performance_handle(default_conf_usdt, update, ticker, fee,
|
def test_telegram_mix_tag_performance_handle(default_conf_usdt, update, ticker, fee,
|
||||||
mocker) -> None:
|
mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -1394,7 +1394,7 @@ def test_telegram_mix_tag_performance_handle(default_conf_usdt, update, ticker,
|
|||||||
|
|
||||||
def test_count_handle(default_conf, update, ticker, fee, mocker) -> None:
|
def test_count_handle(default_conf, update, ticker, fee, mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -1423,7 +1423,7 @@ def test_count_handle(default_conf, update, ticker, fee, mocker) -> None:
|
|||||||
|
|
||||||
def test_telegram_lock_handle(default_conf, update, ticker, fee, mocker) -> None:
|
def test_telegram_lock_handle(default_conf, update, ticker, fee, mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -1685,7 +1685,7 @@ def test_telegram_delete_trade(mocker, update, default_conf, fee, is_short):
|
|||||||
def test_telegram_delete_open_order(mocker, update, default_conf, fee, is_short, ticker):
|
def test_telegram_delete_open_order(mocker, update, default_conf, fee, is_short, ticker):
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
)
|
)
|
||||||
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||||
|
@ -165,7 +165,7 @@ def test_check_available_stake_amount(
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||||
get_fee=fee
|
get_fee=fee
|
||||||
@ -235,7 +235,7 @@ def test_edge_overrides_stoploss(limit_order, fee, caplog, mocker,
|
|||||||
'last': enter_price,
|
'last': enter_price,
|
||||||
}
|
}
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value=ticker_val),
|
fetch_ticker=MagicMock(return_value=ticker_val),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -270,7 +270,7 @@ def test_total_open_trades_stakes(mocker, default_conf_usdt, ticker_usdt, fee) -
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
default_conf_usdt['max_open_trades'] = 2
|
default_conf_usdt['max_open_trades'] = 2
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=False),
|
_dry_is_price_crossed=MagicMock(return_value=False),
|
||||||
@ -305,7 +305,7 @@ def test_create_trade(default_conf_usdt, ticker_usdt, limit_order,
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=False),
|
_dry_is_price_crossed=MagicMock(return_value=False),
|
||||||
@ -341,7 +341,7 @@ def test_create_trade_no_stake_amount(default_conf_usdt, ticker_usdt, fee, mocke
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
patch_wallet(mocker, free=default_conf_usdt['stake_amount'] * 0.5)
|
patch_wallet(mocker, free=default_conf_usdt['stake_amount'] * 0.5)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -367,7 +367,7 @@ def test_create_trade_minimal_amount(
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
enter_mock = MagicMock(return_value=limit_order_open[entry_side(is_short)])
|
enter_mock = MagicMock(return_value=limit_order_open[entry_side(is_short)])
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=enter_mock,
|
create_order=enter_mock,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -402,7 +402,7 @@ def test_enter_positions_no_pairs_left(default_conf_usdt, ticker_usdt, limit_buy
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -429,7 +429,7 @@ def test_enter_positions_global_pairlock(default_conf_usdt, ticker_usdt, limit_b
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value={'id': limit_buy_order_usdt['id']}),
|
create_order=MagicMock(return_value={'id': limit_buy_order_usdt['id']}),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -480,7 +480,7 @@ def test_create_trade_no_signal(default_conf_usdt, fee, mocker) -> None:
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
default_conf_usdt['stake_amount'] = 10
|
default_conf_usdt['stake_amount'] = 10
|
||||||
@ -503,7 +503,7 @@ def test_create_trades_multiple_trades(
|
|||||||
default_conf_usdt['dry_run_wallet'] = 60.0 * max_open
|
default_conf_usdt['dry_run_wallet'] = 60.0 * max_open
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -525,7 +525,7 @@ def test_create_trades_preopen(default_conf_usdt, ticker_usdt, fee, mocker,
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
default_conf_usdt['max_open_trades'] = 4
|
default_conf_usdt['max_open_trades'] = 4
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -559,7 +559,7 @@ def test_process_trade_creation(default_conf_usdt, ticker_usdt, limit_order, lim
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_order_open[entry_side(is_short)]),
|
create_order=MagicMock(return_value=limit_order_open[entry_side(is_short)]),
|
||||||
fetch_order=MagicMock(return_value=limit_order[entry_side(is_short)]),
|
fetch_order=MagicMock(return_value=limit_order[entry_side(is_short)]),
|
||||||
@ -595,7 +595,7 @@ def test_process_exchange_failures(default_conf_usdt, ticker_usdt, mocker) -> No
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(side_effect=TemporaryError)
|
create_order=MagicMock(side_effect=TemporaryError)
|
||||||
)
|
)
|
||||||
@ -612,7 +612,7 @@ def test_process_operational_exception(default_conf_usdt, ticker_usdt, mocker) -
|
|||||||
msg_mock = patch_RPCManager(mocker)
|
msg_mock = patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(side_effect=OperationalException)
|
create_order=MagicMock(side_effect=OperationalException)
|
||||||
)
|
)
|
||||||
@ -631,7 +631,7 @@ def test_process_trade_handling(default_conf_usdt, ticker_usdt, limit_buy_order_
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||||
fetch_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
fetch_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||||
@ -658,7 +658,7 @@ def test_process_trade_no_whitelist_pair(default_conf_usdt, ticker_usdt, limit_b
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value={'id': limit_buy_order_usdt['id']}),
|
create_order=MagicMock(return_value={'id': limit_buy_order_usdt['id']}),
|
||||||
fetch_order=MagicMock(return_value=limit_buy_order_usdt),
|
fetch_order=MagicMock(return_value=limit_buy_order_usdt),
|
||||||
@ -706,7 +706,7 @@ def test_process_informative_pairs_added(default_conf_usdt, ticker_usdt, mocker)
|
|||||||
|
|
||||||
refresh_mock = MagicMock()
|
refresh_mock = MagicMock()
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(side_effect=TemporaryError),
|
create_order=MagicMock(side_effect=TemporaryError),
|
||||||
refresh_latest_ohlcv=refresh_mock,
|
refresh_latest_ohlcv=refresh_mock,
|
||||||
@ -797,7 +797,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
|
|||||||
enter_rate_mock = MagicMock(return_value=bid)
|
enter_rate_mock = MagicMock(return_value=bid)
|
||||||
enter_mm = MagicMock(return_value=open_order)
|
enter_mm = MagicMock(return_value=open_order)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_rate=enter_rate_mock,
|
get_rate=enter_rate_mock,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
@ -946,7 +946,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
|
|||||||
freqtrade.strategy.custom_entry_price = lambda **kwargs: None
|
freqtrade.strategy.custom_entry_price = lambda **kwargs: None
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_rate=MagicMock(return_value=10),
|
get_rate=MagicMock(return_value=10),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -976,7 +976,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
|
|||||||
order['id'] = '55672'
|
order['id'] = '55672'
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_max_pair_stake_amount=MagicMock(return_value=500),
|
get_max_pair_stake_amount=MagicMock(return_value=500),
|
||||||
)
|
)
|
||||||
freqtrade.exchange.get_max_pair_stake_amount = MagicMock(return_value=500)
|
freqtrade.exchange.get_max_pair_stake_amount = MagicMock(return_value=500)
|
||||||
@ -999,7 +999,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
|
|||||||
def test_execute_entry_confirm_error(mocker, default_conf_usdt, fee, limit_order, is_short) -> None:
|
def test_execute_entry_confirm_error(mocker, default_conf_usdt, fee, limit_order, is_short) -> None:
|
||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1034,7 +1034,7 @@ def test_execute_entry_min_leverage(mocker, default_conf_usdt, fee, limit_order,
|
|||||||
default_conf_usdt['margin_mode'] = 'isolated'
|
default_conf_usdt['margin_mode'] = 'isolated'
|
||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1096,7 +1096,7 @@ def test_handle_stoploss_on_exchange(mocker, default_conf_usdt, fee, caplog, is_
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1250,7 +1250,7 @@ def test_handle_sle_cancel_cant_recreate(mocker, default_conf_usdt, fee, caplog,
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1297,7 +1297,7 @@ def test_create_stoploss_order_invalid_order(
|
|||||||
{'id': order['id']}
|
{'id': order['id']}
|
||||||
])
|
])
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1346,7 +1346,7 @@ def test_create_stoploss_order_insufficient_funds(
|
|||||||
|
|
||||||
mock_insuf = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.handle_insufficient_funds')
|
mock_insuf = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.handle_insufficient_funds')
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1397,7 +1397,7 @@ def test_handle_stoploss_on_exchange_trailing(
|
|||||||
stoploss = MagicMock(return_value={'id': 13434334})
|
stoploss = MagicMock(return_value={'id': 13434334})
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 2.19,
|
'bid': 2.19,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1522,7 +1522,7 @@ def test_handle_stoploss_on_exchange_trailing_error(
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1586,8 +1586,8 @@ def test_handle_stoploss_on_exchange_trailing_error(
|
|||||||
# Fail creating stoploss order
|
# Fail creating stoploss order
|
||||||
trade.stoploss_last_update = arrow.utcnow().shift(minutes=-601).datetime
|
trade.stoploss_last_update = arrow.utcnow().shift(minutes=-601).datetime
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
cancel_mock = mocker.patch("freqtrade.exchange.Binance.cancel_stoploss_order", MagicMock())
|
cancel_mock = mocker.patch('freqtrade.exchange.binance.Binance.cancel_stoploss_order')
|
||||||
mocker.patch("freqtrade.exchange.Binance.create_stoploss", side_effect=ExchangeError())
|
mocker.patch('freqtrade.exchange.binance.Binance.create_stoploss', side_effect=ExchangeError())
|
||||||
freqtrade.handle_trailing_stoploss_on_exchange(trade, stoploss_order_hanging)
|
freqtrade.handle_trailing_stoploss_on_exchange(trade, stoploss_order_hanging)
|
||||||
assert cancel_mock.call_count == 1
|
assert cancel_mock.call_count == 1
|
||||||
assert log_has_re(r"Could not create trailing stoploss order for pair ETH/USDT\..*", caplog)
|
assert log_has_re(r"Could not create trailing stoploss order for pair ETH/USDT\..*", caplog)
|
||||||
@ -1597,7 +1597,7 @@ def test_stoploss_on_exchange_price_rounding(
|
|||||||
mocker, default_conf_usdt, fee, open_trade_usdt) -> None:
|
mocker, default_conf_usdt, fee, open_trade_usdt) -> None:
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
price_mock = MagicMock(side_effect=lambda p, s: int(s))
|
price_mock = MagicMock(side_effect=lambda p, s: int(s))
|
||||||
@ -1630,7 +1630,7 @@ def test_handle_stoploss_on_exchange_custom_stop(
|
|||||||
stoploss = MagicMock(return_value={'id': 13434334})
|
stoploss = MagicMock(return_value={'id': 13434334})
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -1758,7 +1758,7 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, limit_orde
|
|||||||
edge_conf['dry_run_wallet'] = 999.9
|
edge_conf['dry_run_wallet'] = 999.9
|
||||||
edge_conf['exchange']['name'] = 'binance'
|
edge_conf['exchange']['name'] = 'binance'
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 2.19,
|
'bid': 2.19,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -2145,7 +2145,7 @@ def test_handle_trade(
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 2.19,
|
'bid': 2.19,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -2198,7 +2198,7 @@ def test_handle_overlapping_signals(
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(side_effect=[
|
create_order=MagicMock(side_effect=[
|
||||||
open_order,
|
open_order,
|
||||||
@ -2276,7 +2276,7 @@ def test_handle_trade_roi(default_conf_usdt, ticker_usdt, limit_order_open, fee,
|
|||||||
|
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(side_effect=[
|
create_order=MagicMock(side_effect=[
|
||||||
open_order,
|
open_order,
|
||||||
@ -2319,7 +2319,7 @@ def test_handle_trade_use_exit_signal(
|
|||||||
caplog.set_level(logging.DEBUG)
|
caplog.set_level(logging.DEBUG)
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(side_effect=[
|
create_order=MagicMock(side_effect=[
|
||||||
enter_open_order,
|
enter_open_order,
|
||||||
@ -2359,7 +2359,7 @@ def test_close_trade(
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=open_order),
|
create_order=MagicMock(return_value=open_order),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -2416,7 +2416,7 @@ def test_manage_open_orders_entry_usercustom(
|
|||||||
|
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=old_order),
|
fetch_order=MagicMock(return_value=old_order),
|
||||||
cancel_order=cancel_order_mock,
|
cancel_order=cancel_order_mock,
|
||||||
@ -2477,7 +2477,7 @@ def test_manage_open_orders_entry(
|
|||||||
cancel_order_mock = MagicMock(return_value=limit_buy_cancel)
|
cancel_order_mock = MagicMock(return_value=limit_buy_cancel)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=old_order),
|
fetch_order=MagicMock(return_value=old_order),
|
||||||
cancel_order_with_result=cancel_order_mock,
|
cancel_order_with_result=cancel_order_mock,
|
||||||
@ -2516,7 +2516,7 @@ def test_adjust_entry_cancel(
|
|||||||
limit_buy_cancel['status'] = 'canceled'
|
limit_buy_cancel['status'] = 'canceled'
|
||||||
cancel_order_mock = MagicMock(return_value=limit_buy_cancel)
|
cancel_order_mock = MagicMock(return_value=limit_buy_cancel)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=old_order),
|
fetch_order=MagicMock(return_value=old_order),
|
||||||
cancel_order_with_result=cancel_order_mock,
|
cancel_order_with_result=cancel_order_mock,
|
||||||
@ -2557,7 +2557,7 @@ def test_adjust_entry_maintain_replace(
|
|||||||
limit_buy_cancel['status'] = 'canceled'
|
limit_buy_cancel['status'] = 'canceled'
|
||||||
cancel_order_mock = MagicMock(return_value=limit_buy_cancel)
|
cancel_order_mock = MagicMock(return_value=limit_buy_cancel)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=old_order),
|
fetch_order=MagicMock(return_value=old_order),
|
||||||
cancel_order_with_result=cancel_order_mock,
|
cancel_order_with_result=cancel_order_mock,
|
||||||
@ -2609,7 +2609,7 @@ def test_check_handle_cancelled_buy(
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
old_order.update({"status": "canceled", 'filled': 0.0})
|
old_order.update({"status": "canceled", 'filled': 0.0})
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=old_order),
|
fetch_order=MagicMock(return_value=old_order),
|
||||||
cancel_order=cancel_order_mock,
|
cancel_order=cancel_order_mock,
|
||||||
@ -2639,7 +2639,7 @@ def test_manage_open_orders_buy_exception(
|
|||||||
cancel_order_mock = MagicMock()
|
cancel_order_mock = MagicMock()
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
validate_pairs=MagicMock(),
|
validate_pairs=MagicMock(),
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(side_effect=ExchangeError),
|
fetch_order=MagicMock(side_effect=ExchangeError),
|
||||||
@ -2680,7 +2680,7 @@ def test_manage_open_orders_exit_usercustom(
|
|||||||
mocker.patch(f'{EXMS}.get_min_pair_stake_amount', return_value=0.0)
|
mocker.patch(f'{EXMS}.get_min_pair_stake_amount', return_value=0.0)
|
||||||
et_mock = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.execute_trade_exit')
|
et_mock = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.execute_trade_exit')
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=limit_sell_order_old),
|
fetch_order=MagicMock(return_value=limit_sell_order_old),
|
||||||
cancel_order=cancel_order_mock
|
cancel_order=cancel_order_mock
|
||||||
@ -2758,7 +2758,7 @@ def test_manage_open_orders_exit(
|
|||||||
limit_sell_order_old['side'] = 'buy' if is_short else 'sell'
|
limit_sell_order_old['side'] = 'buy' if is_short else 'sell'
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=limit_sell_order_old),
|
fetch_order=MagicMock(return_value=limit_sell_order_old),
|
||||||
cancel_order=cancel_order_mock,
|
cancel_order=cancel_order_mock,
|
||||||
@ -2800,7 +2800,7 @@ def test_check_handle_cancelled_exit(
|
|||||||
|
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=limit_sell_order_old),
|
fetch_order=MagicMock(return_value=limit_sell_order_old),
|
||||||
cancel_order_with_result=cancel_order_mock
|
cancel_order_with_result=cancel_order_mock
|
||||||
@ -2841,7 +2841,7 @@ def test_manage_open_orders_partial(
|
|||||||
cancel_order_mock = MagicMock(return_value=limit_buy_canceled)
|
cancel_order_mock = MagicMock(return_value=limit_buy_canceled)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=limit_buy_order_old_partial),
|
fetch_order=MagicMock(return_value=limit_buy_order_old_partial),
|
||||||
cancel_order_with_result=cancel_order_mock
|
cancel_order_with_result=cancel_order_mock
|
||||||
@ -2881,7 +2881,7 @@ def test_manage_open_orders_partial_fee(
|
|||||||
mocker.patch('freqtrade.wallets.Wallets.get_free', MagicMock(return_value=0))
|
mocker.patch('freqtrade.wallets.Wallets.get_free', MagicMock(return_value=0))
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=limit_buy_order_old_partial),
|
fetch_order=MagicMock(return_value=limit_buy_order_old_partial),
|
||||||
cancel_order_with_result=cancel_order_mock,
|
cancel_order_with_result=cancel_order_mock,
|
||||||
@ -2929,7 +2929,7 @@ def test_manage_open_orders_partial_except(
|
|||||||
cancel_order_mock = MagicMock(return_value=limit_buy_order_old_partial_canceled)
|
cancel_order_mock = MagicMock(return_value=limit_buy_order_old_partial_canceled)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(return_value=limit_buy_order_old_partial),
|
fetch_order=MagicMock(return_value=limit_buy_order_old_partial),
|
||||||
cancel_order_with_result=cancel_order_mock,
|
cancel_order_with_result=cancel_order_mock,
|
||||||
@ -2975,7 +2975,7 @@ def test_manage_open_orders_exception(default_conf_usdt, ticker_usdt, open_trade
|
|||||||
handle_cancel_exit=MagicMock(),
|
handle_cancel_exit=MagicMock(),
|
||||||
)
|
)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
fetch_order=MagicMock(side_effect=ExchangeError('Oh snap')),
|
fetch_order=MagicMock(side_effect=ExchangeError('Oh snap')),
|
||||||
cancel_order=cancel_order_mock
|
cancel_order=cancel_order_mock
|
||||||
@ -3086,7 +3086,7 @@ def test_handle_cancel_enter_corder_empty(mocker, default_conf_usdt, limit_order
|
|||||||
l_order = limit_order[entry_side(is_short)]
|
l_order = limit_order[entry_side(is_short)]
|
||||||
cancel_order_mock = MagicMock(return_value=cancelorder)
|
cancel_order_mock = MagicMock(return_value=cancelorder)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
cancel_order=cancel_order_mock,
|
cancel_order=cancel_order_mock,
|
||||||
fetch_order=MagicMock(side_effect=InvalidOrderException)
|
fetch_order=MagicMock(side_effect=InvalidOrderException)
|
||||||
)
|
)
|
||||||
@ -3116,7 +3116,7 @@ def test_handle_cancel_exit_limit(mocker, default_conf_usdt, fee) -> None:
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
cancel_order_mock = MagicMock()
|
cancel_order_mock = MagicMock()
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
cancel_order=cancel_order_mock,
|
cancel_order=cancel_order_mock,
|
||||||
)
|
)
|
||||||
mocker.patch(f'{EXMS}.get_rate', return_value=0.245441)
|
mocker.patch(f'{EXMS}.get_rate', return_value=0.245441)
|
||||||
@ -3245,7 +3245,7 @@ def test_execute_trade_exit_up(default_conf_usdt, ticker_usdt, fee, ticker_usdt_
|
|||||||
rpc_mock = patch_RPCManager(mocker)
|
rpc_mock = patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=False),
|
_dry_is_price_crossed=MagicMock(return_value=False),
|
||||||
@ -3266,7 +3266,7 @@ def test_execute_trade_exit_up(default_conf_usdt, ticker_usdt, fee, ticker_usdt_
|
|||||||
|
|
||||||
# Increase the price and sell it
|
# Increase the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_down if is_short else ticker_usdt_sell_up
|
fetch_ticker=ticker_usdt_sell_down if is_short else ticker_usdt_sell_up
|
||||||
)
|
)
|
||||||
# Prevented sell ...
|
# Prevented sell ...
|
||||||
@ -3328,7 +3328,7 @@ def test_execute_trade_exit_down(default_conf_usdt, ticker_usdt, fee, ticker_usd
|
|||||||
rpc_mock = patch_RPCManager(mocker)
|
rpc_mock = patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=False),
|
_dry_is_price_crossed=MagicMock(return_value=False),
|
||||||
@ -3346,7 +3346,7 @@ def test_execute_trade_exit_down(default_conf_usdt, ticker_usdt, fee, ticker_usd
|
|||||||
|
|
||||||
# Decrease the price and sell it
|
# Decrease the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_up if is_short else ticker_usdt_sell_down
|
fetch_ticker=ticker_usdt_sell_up if is_short else ticker_usdt_sell_down
|
||||||
)
|
)
|
||||||
freqtrade.execute_trade_exit(
|
freqtrade.execute_trade_exit(
|
||||||
@ -3397,7 +3397,7 @@ def test_execute_trade_exit_custom_exit_price(
|
|||||||
rpc_mock = patch_RPCManager(mocker)
|
rpc_mock = patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=False),
|
_dry_is_price_crossed=MagicMock(return_value=False),
|
||||||
@ -3420,7 +3420,7 @@ def test_execute_trade_exit_custom_exit_price(
|
|||||||
|
|
||||||
# Increase the price and sell it
|
# Increase the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_up
|
fetch_ticker=ticker_usdt_sell_up
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -3478,7 +3478,7 @@ def test_execute_trade_exit_down_stoploss_on_exchange_dry_run(
|
|||||||
rpc_mock = patch_RPCManager(mocker)
|
rpc_mock = patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=False),
|
_dry_is_price_crossed=MagicMock(return_value=False),
|
||||||
@ -3496,7 +3496,7 @@ def test_execute_trade_exit_down_stoploss_on_exchange_dry_run(
|
|||||||
|
|
||||||
# Decrease the price and sell it
|
# Decrease the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_up if is_short else ticker_usdt_sell_down
|
fetch_ticker=ticker_usdt_sell_up if is_short else ticker_usdt_sell_down
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -3554,7 +3554,7 @@ def test_execute_trade_exit_sloe_cancel_exception(
|
|||||||
])
|
])
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
create_order=create_order_mock,
|
create_order=create_order_mock,
|
||||||
@ -3592,7 +3592,7 @@ def test_execute_trade_exit_with_stoploss_on_exchange(
|
|||||||
|
|
||||||
cancel_order = MagicMock(return_value=True)
|
cancel_order = MagicMock(return_value=True)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
amount_to_precision=lambda s, x, y: y,
|
amount_to_precision=lambda s, x, y: y,
|
||||||
@ -3619,7 +3619,7 @@ def test_execute_trade_exit_with_stoploss_on_exchange(
|
|||||||
|
|
||||||
# Increase the price and sell it
|
# Increase the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_up
|
fetch_ticker=ticker_usdt_sell_up
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -3643,7 +3643,7 @@ def test_may_execute_trade_exit_after_stoploss_on_exchange_hit(
|
|||||||
rpc_mock = patch_RPCManager(mocker)
|
rpc_mock = patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
amount_to_precision=lambda s, x, y: y,
|
amount_to_precision=lambda s, x, y: y,
|
||||||
@ -3740,7 +3740,7 @@ def test_execute_trade_exit_market_order(
|
|||||||
rpc_mock = patch_RPCManager(mocker)
|
rpc_mock = patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=True),
|
_dry_is_price_crossed=MagicMock(return_value=True),
|
||||||
@ -3759,7 +3759,7 @@ def test_execute_trade_exit_market_order(
|
|||||||
|
|
||||||
# Increase the price and sell it
|
# Increase the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_up,
|
fetch_ticker=ticker_usdt_sell_up,
|
||||||
_dry_is_price_crossed=MagicMock(return_value=False),
|
_dry_is_price_crossed=MagicMock(return_value=False),
|
||||||
)
|
)
|
||||||
@ -3815,7 +3815,7 @@ def test_execute_trade_exit_insufficient_funds_error(default_conf_usdt, ticker_u
|
|||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
mock_insuf = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.handle_insufficient_funds')
|
mock_insuf = mocker.patch('freqtrade.freqtradebot.FreqtradeBot.handle_insufficient_funds')
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
create_order=MagicMock(side_effect=[
|
create_order=MagicMock(side_effect=[
|
||||||
@ -3834,7 +3834,7 @@ def test_execute_trade_exit_insufficient_funds_error(default_conf_usdt, ticker_u
|
|||||||
|
|
||||||
# Increase the price and sell it
|
# Increase the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_up
|
fetch_ticker=ticker_usdt_sell_up
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -3869,7 +3869,7 @@ def test_exit_profit_only(
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
eside = entry_side(is_short)
|
eside = entry_side(is_short)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': bid,
|
'bid': bid,
|
||||||
'ask': ask,
|
'ask': ask,
|
||||||
@ -3920,7 +3920,7 @@ def test_sell_not_enough_balance(default_conf_usdt, limit_order, limit_order_ope
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 0.00002172,
|
'bid': 0.00002172,
|
||||||
'ask': 0.00002173,
|
'ask': 0.00002173,
|
||||||
@ -3997,7 +3997,7 @@ def test_locked_pairs(default_conf_usdt, ticker_usdt, fee,
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -4013,7 +4013,7 @@ def test_locked_pairs(default_conf_usdt, ticker_usdt, fee,
|
|||||||
|
|
||||||
# Decrease the price and sell it
|
# Decrease the price and sell it
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt_sell_down
|
fetch_ticker=ticker_usdt_sell_down
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -4042,7 +4042,7 @@ def test_ignore_roi_if_entry_signal(default_conf_usdt, limit_order, limit_order_
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
eside = entry_side(is_short)
|
eside = entry_side(is_short)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 2.19,
|
'bid': 2.19,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -4093,7 +4093,7 @@ def test_trailing_stop_loss(default_conf_usdt, limit_order_open,
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 2.0,
|
'bid': 2.0,
|
||||||
'ask': 2.0,
|
'ask': 2.0,
|
||||||
@ -4163,7 +4163,7 @@ def test_trailing_stop_loss_positive(
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
eside = entry_side(is_short)
|
eside = entry_side(is_short)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': enter_price - (-0.01 if is_short else 0.01),
|
'bid': enter_price - (-0.01 if is_short else 0.01),
|
||||||
'ask': enter_price - (-0.01 if is_short else 0.01),
|
'ask': enter_price - (-0.01 if is_short else 0.01),
|
||||||
@ -4261,7 +4261,7 @@ def test_disable_ignore_roi_if_entry_signal(default_conf_usdt, limit_order, limi
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
eside = entry_side(is_short)
|
eside = entry_side(is_short)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 2.0,
|
'bid': 2.0,
|
||||||
'ask': 2.0,
|
'ask': 2.0,
|
||||||
@ -4738,7 +4738,7 @@ def test_order_book_depth_of_market(
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch(f'{EXMS}.fetch_l2_order_book', order_book_l2)
|
mocker.patch(f'{EXMS}.fetch_l2_order_book', order_book_l2)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_order_open[entry_side(is_short)]),
|
create_order=MagicMock(return_value=limit_order_open[entry_side(is_short)]),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -4784,7 +4784,7 @@ def test_order_book_entry_pricing1(mocker, default_conf_usdt, order_book_l2, exc
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
ticker_usdt_mock = MagicMock(return_value={'ask': ask, 'last': last})
|
ticker_usdt_mock = MagicMock(return_value={'ask': ask, 'last': last})
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_l2_order_book=MagicMock(return_value=order_book) if order_book else order_book_l2,
|
fetch_l2_order_book=MagicMock(return_value=order_book) if order_book else order_book_l2,
|
||||||
fetch_ticker=ticker_usdt_mock,
|
fetch_ticker=ticker_usdt_mock,
|
||||||
)
|
)
|
||||||
@ -4812,7 +4812,7 @@ def test_check_depth_of_market(default_conf_usdt, mocker, order_book_l2) -> None
|
|||||||
"""
|
"""
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_l2_order_book=order_book_l2
|
fetch_l2_order_book=order_book_l2
|
||||||
)
|
)
|
||||||
default_conf_usdt['telegram']['enabled'] = False
|
default_conf_usdt['telegram']['enabled'] = False
|
||||||
@ -4841,7 +4841,7 @@ def test_order_book_exit_pricing(
|
|||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
'ask': 2.2,
|
'ask': 2.2,
|
||||||
@ -4918,7 +4918,7 @@ def test_sync_wallet_dry_run(mocker, default_conf_usdt, ticker_usdt, fee, limit_
|
|||||||
default_conf_usdt['tradable_balance_ratio'] = 1.0
|
default_conf_usdt['tradable_balance_ratio'] = 1.0
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
create_order=MagicMock(return_value=limit_buy_order_usdt_open),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
@ -5430,7 +5430,7 @@ def test_update_funding_fees(
|
|||||||
mocker.patch(f'{EXMS}.refresh_latest_ohlcv', side_effect=refresh_latest_ohlcv_mock)
|
mocker.patch(f'{EXMS}.refresh_latest_ohlcv', side_effect=refresh_latest_ohlcv_mock)
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_rate=enter_rate_mock,
|
get_rate=enter_rate_mock,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 1.9,
|
'bid': 1.9,
|
||||||
@ -5509,7 +5509,7 @@ def test_position_adjust(mocker, default_conf_usdt, fee) -> None:
|
|||||||
stake_amount = 10
|
stake_amount = 10
|
||||||
buy_rate_mock = MagicMock(return_value=bid)
|
buy_rate_mock = MagicMock(return_value=bid)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_rate=buy_rate_mock,
|
get_rate=buy_rate_mock,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 10,
|
'bid': 10,
|
||||||
@ -5789,7 +5789,7 @@ def test_position_adjust2(mocker, default_conf_usdt, fee) -> None:
|
|||||||
amount = 100
|
amount = 100
|
||||||
buy_rate_mock = MagicMock(return_value=bid)
|
buy_rate_mock = MagicMock(return_value=bid)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_rate=buy_rate_mock,
|
get_rate=buy_rate_mock,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 10,
|
'bid': 10,
|
||||||
@ -5980,7 +5980,7 @@ def test_position_adjust3(mocker, default_conf_usdt, fee, data) -> None:
|
|||||||
price = order[2]
|
price = order[2]
|
||||||
price_mock = MagicMock(return_value=price)
|
price_mock = MagicMock(return_value=price)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_rate=price_mock,
|
get_rate=price_mock,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 10,
|
'bid': 10,
|
||||||
@ -6066,7 +6066,7 @@ def test_check_and_call_adjust_trade_position(mocker, default_conf_usdt, fee, ca
|
|||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
buy_rate_mock = MagicMock(return_value=10)
|
buy_rate_mock = MagicMock(return_value=10)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_rate=buy_rate_mock,
|
get_rate=buy_rate_mock,
|
||||||
fetch_ticker=MagicMock(return_value={
|
fetch_ticker=MagicMock(return_value={
|
||||||
'bid': 10,
|
'bid': 10,
|
||||||
|
@ -58,7 +58,7 @@ def test_may_execute_exit_stoploss_on_exchange_multi(default_conf, ticker, fee,
|
|||||||
cancel_order_mock = MagicMock()
|
cancel_order_mock = MagicMock()
|
||||||
mocker.patch('freqtrade.exchange.binance.Binance.create_stoploss', stoploss)
|
mocker.patch('freqtrade.exchange.binance.Binance.create_stoploss', stoploss)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
amount_to_precision=lambda s, x, y: y,
|
amount_to_precision=lambda s, x, y: y,
|
||||||
@ -147,7 +147,7 @@ def test_forcebuy_last_unlimited(default_conf, ticker, fee, mocker, balance_rati
|
|||||||
default_conf['telegram']['enabled'] = True
|
default_conf['telegram']['enabled'] = True
|
||||||
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
amount_to_precision=lambda s, x, y: y,
|
amount_to_precision=lambda s, x, y: y,
|
||||||
@ -217,7 +217,7 @@ def test_dca_buying(default_conf_usdt, ticker_usdt, fee, mocker) -> None:
|
|||||||
|
|
||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@ -286,7 +286,7 @@ def test_dca_short(default_conf_usdt, ticker_usdt, fee, mocker) -> None:
|
|||||||
|
|
||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
amount_to_precision=lambda s, x, y: round(y, 4),
|
amount_to_precision=lambda s, x, y: round(y, 4),
|
||||||
@ -361,7 +361,7 @@ def test_dca_order_adjust(default_conf_usdt, ticker_usdt, leverage, fee, mocker)
|
|||||||
|
|
||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
amount_to_precision=lambda s, x, y: y,
|
amount_to_precision=lambda s, x, y: y,
|
||||||
@ -477,7 +477,7 @@ def test_dca_exiting(default_conf_usdt, ticker_usdt, fee, mocker, caplog, levera
|
|||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
freqtrade.trading_mode = TradingMode.FUTURES
|
freqtrade.trading_mode = TradingMode.FUTURES
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker_usdt,
|
fetch_ticker=ticker_usdt,
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
amount_to_precision=lambda s, x, y: y,
|
amount_to_precision=lambda s, x, y: y,
|
||||||
|
@ -6,13 +6,13 @@ import pytest
|
|||||||
|
|
||||||
from freqtrade.constants import UNLIMITED_STAKE_AMOUNT
|
from freqtrade.constants import UNLIMITED_STAKE_AMOUNT
|
||||||
from freqtrade.exceptions import DependencyException
|
from freqtrade.exceptions import DependencyException
|
||||||
from tests.conftest import create_mock_trades, get_patched_freqtradebot, patch_wallet
|
from tests.conftest import EXMS, create_mock_trades, get_patched_freqtradebot, patch_wallet
|
||||||
|
|
||||||
|
|
||||||
def test_sync_wallet_at_boot(mocker, default_conf):
|
def test_sync_wallet_at_boot(mocker, default_conf):
|
||||||
default_conf['dry_run'] = False
|
default_conf['dry_run'] = False
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value={
|
get_balances=MagicMock(return_value={
|
||||||
"BNT": {
|
"BNT": {
|
||||||
"free": 1.0,
|
"free": 1.0,
|
||||||
@ -45,7 +45,7 @@ def test_sync_wallet_at_boot(mocker, default_conf):
|
|||||||
assert 'USDT' in freqtrade.wallets._wallets
|
assert 'USDT' in freqtrade.wallets._wallets
|
||||||
assert freqtrade.wallets._last_wallet_refresh > 0
|
assert freqtrade.wallets._last_wallet_refresh > 0
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value={
|
get_balances=MagicMock(return_value={
|
||||||
"BNT": {
|
"BNT": {
|
||||||
"free": 1.2,
|
"free": 1.2,
|
||||||
@ -87,7 +87,7 @@ def test_sync_wallet_at_boot(mocker, default_conf):
|
|||||||
def test_sync_wallet_missing_data(mocker, default_conf):
|
def test_sync_wallet_missing_data(mocker, default_conf):
|
||||||
default_conf['dry_run'] = False
|
default_conf['dry_run'] = False
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value={
|
get_balances=MagicMock(return_value={
|
||||||
"BNT": {
|
"BNT": {
|
||||||
"free": 1.0,
|
"free": 1.0,
|
||||||
@ -136,7 +136,7 @@ def test_get_trade_stake_amount_unlimited_amount(default_conf, ticker, balance_r
|
|||||||
result1, result2, limit_buy_order_open,
|
result1, result2, limit_buy_order_open,
|
||||||
fee, mocker) -> None:
|
fee, mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
fetch_ticker=ticker,
|
fetch_ticker=ticker,
|
||||||
create_order=MagicMock(return_value=limit_buy_order_open),
|
create_order=MagicMock(return_value=limit_buy_order_open),
|
||||||
get_fee=fee
|
get_fee=fee
|
||||||
@ -312,7 +312,7 @@ def test_sync_wallet_futures_live(mocker, default_conf):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
EXMS,
|
||||||
get_balances=MagicMock(return_value={
|
get_balances=MagicMock(return_value={
|
||||||
"USDT": {
|
"USDT": {
|
||||||
"free": 900,
|
"free": 900,
|
||||||
|
Loading…
Reference in New Issue
Block a user