Add amount_to_contract helper in the exchange

This commit is contained in:
Matthias 2022-09-07 06:34:03 +02:00
parent dc4a4bdf09
commit 95a33ab2e6

View File

@ -446,6 +446,15 @@ class Exchange:
contract_size = self.get_contract_size(pair) contract_size = self.get_contract_size(pair)
return contracts_to_amount(num_contracts, contract_size) return contracts_to_amount(num_contracts, contract_size)
def amount_to_contract_precision(self, pair: str, amount: float) -> float:
"""
Helper wrapper around amount_to_contract_precision
"""
contract_size = self.get_contract_size(pair)
return amount_to_contract_precision(amount, self.get_precision_amount(pair),
self.precisionMode, contract_size)
def set_sandbox(self, api: ccxt.Exchange, exchange_config: dict, name: str) -> None: def set_sandbox(self, api: ccxt.Exchange, exchange_config: dict, name: str) -> None:
if exchange_config.get('sandbox'): if exchange_config.get('sandbox'):
if api.urls.get('test'): if api.urls.get('test'):