Updated LocalTrade.calc_close_trade_value formula for shorting futures

This commit is contained in:
Sam Germain 2021-10-11 05:56:27 -06:00
parent d5a1385fdc
commit ae3688a18a

View File

@ -709,7 +709,10 @@ class LocalTrade():
elif (trading_mode == TradingMode.FUTURES): elif (trading_mode == TradingMode.FUTURES):
funding_fees = self.funding_fees or 0.0 funding_fees = self.funding_fees or 0.0
return float(self._calc_base_close(amount, rate, fee)) + funding_fees if self.is_short:
return float(self._calc_base_close(amount, rate, fee)) - funding_fees
else:
return float(self._calc_base_close(amount, rate, fee)) + funding_fees
else: else:
raise OperationalException( raise OperationalException(
f"{self.trading_mode.value} trading is not yet available using freqtrade") f"{self.trading_mode.value} trading is not yet available using freqtrade")