add list_available_pairs endpoint

This commit is contained in:
Matthias
2020-08-01 17:49:59 +02:00
parent 6a59740f83
commit 1de248fe38
3 changed files with 65 additions and 1 deletions

View File

@@ -146,6 +146,7 @@ def get_patched_freqtradebot(mocker, config) -> FreqtradeBot:
:return: FreqtradeBot
"""
patch_freqtradebot(mocker, config)
config['datadir'] = Path(config['datadir'])
return FreqtradeBot(config)

View File

@@ -878,3 +878,29 @@ def test_api_strategies(botclient):
assert_response(rc)
assert rc.json == {'strategies': ['DefaultStrategy', 'TestStrategyLegacy']}
def test_list_available_pairs(botclient):
ftbot, client = botclient
rc = client_get(client, f"{BASE_URI}/available_pairs")
assert_response(rc)
assert rc.json['length'] == 12
assert isinstance(rc.json['pairs'], list)
rc = client_get(client, f"{BASE_URI}/available_pairs?timeframe=5m")
assert_response(rc)
assert rc.json['length'] == 12
rc = client_get(client, f"{BASE_URI}/available_pairs?stake_currency=ETH")
assert_response(rc)
assert rc.json['length'] == 1
assert rc.json['pairs'] == ['XRP/ETH']
assert len(rc.json['pair_interval']) == 2
rc = client_get(client, f"{BASE_URI}/available_pairs?stake_currency=ETH&timeframe=5m")
assert_response(rc)
assert rc.json['length'] == 1
assert rc.json['pairs'] == ['XRP/ETH']
assert len(rc.json['pair_interval']) == 1