From d07c7f7f275af5169b4ba3ac6ca25974c687998f Mon Sep 17 00:00:00 2001 From: Arunavo Ray Date: Tue, 7 Sep 2021 12:28:23 +0530 Subject: [PATCH] Added Ftx interest rate calculation --- freqtrade/leverage/interest.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/freqtrade/leverage/interest.py b/freqtrade/leverage/interest.py index aacbb3532..c687c8b5b 100644 --- a/freqtrade/leverage/interest.py +++ b/freqtrade/leverage/interest.py @@ -20,7 +20,7 @@ def interest( :param exchange_name: The exchanged being trading on :param borrowed: The amount of currency being borrowed - :param rate: The rate of interest + :param rate: The rate of interest (i.e daily interest rate) :param hours: The time in hours that the currency has been borrowed for Raises: @@ -36,7 +36,8 @@ def interest( # Rounded based on https://kraken-fees-calculator.github.io/ return borrowed * rate * (one+ceil(hours/four)) elif exchange_name == "ftx": - # TODO-lev: Add FTX interest formula - raise OperationalException(f"Leverage not available on {exchange_name} with freqtrade") + # As Explained under #Interest rates section in + # https://help.ftx.com/hc/en-us/articles/360053007671-Spot-Margin-Trading-Explainer + return borrowed * rate * ceil(hours)/twenty_four else: - raise OperationalException(f"Leverage not available on {exchange_name} with freqtrade") + raise OperationalException(f"Leverage not available on {exchange_name} with freqtrade") \ No newline at end of file