Skip to content

Commit d530527

Browse files
committed
test: add test for exchange.features
1 parent 8af8260 commit d530527

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

freqtrade/exchange/exchange.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112

113113

114114
logger = logging.getLogger(__name__)
115+
115116
T = TypeVar("T")
116117

117118

tests/exchange/test_exchange.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6259,3 +6259,26 @@ def test_price_to_precision_with_default_conf(default_conf, mocker):
62596259
prec_price = patched_ex.price_to_precision("XRP/USDT", 1.0000000101)
62606260
assert prec_price == 1.00000001
62616261
assert prec_price == 1.00000001
6262+
6263+
6264+
def test_exchange_features(default_conf, mocker):
6265+
conf = copy.deepcopy(default_conf)
6266+
exchange = get_patched_exchange(mocker, conf)
6267+
exchange._api_async.features = {
6268+
"spot": {
6269+
"fetchOHLCV": {
6270+
"limit": 995,
6271+
}
6272+
},
6273+
"swap": {
6274+
"linear": {
6275+
"fetchOHLCV": {
6276+
"limit": 997,
6277+
}
6278+
}
6279+
},
6280+
}
6281+
assert exchange.features("spot", "fetchOHLCV", "limit", 500) == 995
6282+
assert exchange.features("futures", "fetchOHLCV", "limit", 500) == 997
6283+
# Fall back to default
6284+
assert exchange.features("futures", "fetchOHLCV_else", "limit", 601) == 601

0 commit comments

Comments
 (0)