mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-20 14:00:38 +00:00
Update "exchange_has" validation with new fallbacks
This commit is contained in:
@@ -60,16 +60,17 @@ SUPPORTED_EXCHANGES = [
|
||||
'okx',
|
||||
]
|
||||
|
||||
EXCHANGE_HAS_REQUIRED = [
|
||||
# either the main, or replacement methods (array) is required
|
||||
EXCHANGE_HAS_REQUIRED = {
|
||||
# Required / private
|
||||
'fetchOrder',
|
||||
'cancelOrder',
|
||||
'createOrder',
|
||||
'fetchBalance',
|
||||
'fetchOrder': ['fetchOpenOrder', 'fetchClosedOrder'],
|
||||
'cancelOrder': [],
|
||||
'createOrder': [],
|
||||
'fetchBalance': [],
|
||||
|
||||
# Public endpoints
|
||||
'fetchOHLCV',
|
||||
]
|
||||
'fetchOHLCV': [],
|
||||
}
|
||||
|
||||
EXCHANGE_HAS_OPTIONAL = [
|
||||
# Private
|
||||
|
||||
@@ -49,7 +49,11 @@ def validate_exchange(exchange: str) -> Tuple[bool, str]:
|
||||
reason = ''
|
||||
if not ex_mod or not ex_mod.has:
|
||||
return False, ''
|
||||
missing = [k for k in EXCHANGE_HAS_REQUIRED if ex_mod.has.get(k) is not True]
|
||||
missing = [
|
||||
k for k, v in EXCHANGE_HAS_REQUIRED.items()
|
||||
if ex_mod.has.get(k) is not True
|
||||
and not (all(ex_mod.has.get(x) for x in v))
|
||||
]
|
||||
if missing:
|
||||
result = False
|
||||
reason += f"missing: {', '.join(missing)}"
|
||||
|
||||
Reference in New Issue
Block a user