mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 04:41:15 +00:00
test: add test for exchange.features
This commit is contained in:
@@ -112,6 +112,7 @@ from freqtrade.util.periodic_cache import PeriodicCache
|
|||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6259,3 +6259,26 @@ def test_price_to_precision_with_default_conf(default_conf, mocker):
|
|||||||
prec_price = patched_ex.price_to_precision("XRP/USDT", 1.0000000101)
|
prec_price = patched_ex.price_to_precision("XRP/USDT", 1.0000000101)
|
||||||
assert prec_price == 1.00000001
|
assert prec_price == 1.00000001
|
||||||
assert prec_price == 1.00000001
|
assert prec_price == 1.00000001
|
||||||
|
|
||||||
|
|
||||||
|
def test_exchange_features(default_conf, mocker):
|
||||||
|
conf = copy.deepcopy(default_conf)
|
||||||
|
exchange = get_patched_exchange(mocker, conf)
|
||||||
|
exchange._api_async.features = {
|
||||||
|
"spot": {
|
||||||
|
"fetchOHLCV": {
|
||||||
|
"limit": 995,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"swap": {
|
||||||
|
"linear": {
|
||||||
|
"fetchOHLCV": {
|
||||||
|
"limit": 997,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
assert exchange.features("spot", "fetchOHLCV", "limit", 500) == 995
|
||||||
|
assert exchange.features("futures", "fetchOHLCV", "limit", 500) == 997
|
||||||
|
# Fall back to default
|
||||||
|
assert exchange.features("futures", "fetchOHLCV_else", "limit", 601) == 601
|
||||||
|
|||||||
Reference in New Issue
Block a user