wrote exchange.get_max_amount_tradable

This commit is contained in:
Sam Germain
2022-01-29 03:22:08 -06:00
parent 179947fa72
commit f3b42b0ef3
2 changed files with 161 additions and 0 deletions

View File

@@ -2119,6 +2119,20 @@ class Exchange:
raise OperationalException(
"Freqtrade only supports isolated futures for leverage trading")
def get_max_amount_tradable(self, pair: str) -> float:
'''
Gets the maximum amount of a currency that the exchange will let you trade
'''
market = self.markets[pair]
contractSize = market['contractSize']
if not contractSize or market['spot']:
contractSize = 1
maxAmount = market['limits']['amount']['max']
if maxAmount:
return maxAmount * contractSize
else:
return float('inf')
def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool:
return exchange_name in ccxt_exchanges(ccxt_module)