Add amount_to_contract helper in the exchange
This commit is contained in:
parent
dc4a4bdf09
commit
95a33ab2e6
@ -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'):
|
||||||
|
Loading…
Reference in New Issue
Block a user