mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Refactor pairlist-tests
This commit is contained in:
parent
18ad3388b4
commit
0929f59680
|
@ -15,7 +15,7 @@ DEFAULT_DB_DRYRUN_URL = 'sqlite://'
|
|||
UNLIMITED_STAKE_AMOUNT = 'unlimited'
|
||||
REQUIRED_ORDERTYPES = ['buy', 'sell', 'stoploss', 'stoploss_on_exchange']
|
||||
ORDERTYPE_POSSIBILITIES = ['limit', 'market']
|
||||
|
||||
AVAILABLE_PAIRLISTS = ['StaticPairList', 'VolumePairList']
|
||||
|
||||
TICKER_INTERVAL_MINUTES = {
|
||||
'1m': 1,
|
||||
|
@ -127,7 +127,7 @@ CONF_SCHEMA = {
|
|||
'whitelist': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'method': {'type': 'string'},
|
||||
'method': {'type': 'string', 'enum': AVAILABLE_PAIRLISTS},
|
||||
'config': {'type': 'object'}
|
||||
},
|
||||
'required': ['method']
|
||||
|
|
0
freqtrade/tests/pairlist/__init__.py
Normal file
0
freqtrade/tests/pairlist/__init__.py
Normal file
|
@ -3,6 +3,7 @@
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
from freqtrade import OperationalException
|
||||
from freqtrade.constants import AVAILABLE_PAIRLISTS
|
||||
from freqtrade.tests.conftest import get_patched_freqtradebot
|
||||
import pytest
|
||||
|
||||
|
@ -22,6 +23,9 @@ def whitelist_conf(default_conf):
|
|||
default_conf['exchange']['pair_blacklist'] = [
|
||||
'BLK/BTC'
|
||||
]
|
||||
default_conf['whitelist'] = {'method': 'StaticPairList',
|
||||
'config': {'number_assets': 3}
|
||||
}
|
||||
|
||||
return default_conf
|
||||
|
||||
|
@ -118,3 +122,11 @@ def test_gen_pair_whitelist_not_supported(mocker, default_conf, tickers) -> None
|
|||
|
||||
with pytest.raises(OperationalException):
|
||||
get_patched_freqtradebot(mocker, default_conf)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("pairlist", AVAILABLE_PAIRLISTS)
|
||||
def test_pairlist_class(mocker, whitelist_conf, pairlist):
|
||||
whitelist_conf['whitelist']['method'] = pairlist
|
||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
||||
assert freqtrade.pairlists.name == pairlist
|
||||
# TODO: add more tests
|
Loading…
Reference in New Issue
Block a user