From 95a33ab2e639d8510c45e731946c5ed2a9189493 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 7 Sep 2022 06:34:03 +0200 Subject: [PATCH] Add amount_to_contract helper in the exchange --- freqtrade/exchange/exchange.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index c3dca43a8..af072d555 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -446,6 +446,15 @@ class Exchange: contract_size = self.get_contract_size(pair) 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: if exchange_config.get('sandbox'): if api.urls.get('test'):