Convert amount to contracts before comparing for close

closes #7279
This commit is contained in:
Matthias
2022-08-22 20:48:02 +02:00
parent 78b161e14c
commit fe7108ae75
5 changed files with 22 additions and 11 deletions

View File

@@ -9,7 +9,8 @@ from freqtrade.exchange.bitpanda import Bitpanda
from freqtrade.exchange.bittrex import Bittrex
from freqtrade.exchange.bybit import Bybit
from freqtrade.exchange.coinbasepro import Coinbasepro
from freqtrade.exchange.exchange import (amount_to_precision, available_exchanges, ccxt_exchanges,
from freqtrade.exchange.exchange import (amount_to_contracts, amount_to_precision,
available_exchanges, ccxt_exchanges, contracts_to_amount,
date_minus_candles, is_exchange_known_ccxt,
is_exchange_officially_supported, market_is_active,
price_to_precision, timeframe_to_minutes,

View File

@@ -2892,7 +2892,7 @@ def market_is_active(market: Dict) -> bool:
return market.get('active', True) is not False
def amount_to_contracts(amount: float, contract_size: float) -> float:
def amount_to_contracts(amount: float, contract_size: Optional[float]) -> float:
"""
Convert amount to contracts.
:param amount: amount to convert
@@ -2905,7 +2905,7 @@ def amount_to_contracts(amount: float, contract_size: float) -> float:
return amount
def contracts_to_amount(num_contracts: float, contract_size: float) -> float:
def contracts_to_amount(num_contracts: float, contract_size: Optional[float]) -> float:
"""
Takes num-contracts and converts it to contract size
:param num_contracts: number of contracts