Merge pull request #5541 from arunavo4/feat/short
[Feat/Short] Added Ftx Interest Calculation
This commit is contained in:
commit
b83689f9ea
@ -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")
|
||||
|
@ -22,9 +22,10 @@ twentyfive_hours = Decimal(25.0)
|
||||
('kraken', 0.00025, five_hours, 0.045),
|
||||
('kraken', 0.00025, twentyfive_hours, 0.12),
|
||||
# FTX
|
||||
# TODO-lev: - implement FTX tests
|
||||
# ('ftx', Decimal(0.0005), ten_mins, 0.06),
|
||||
# ('ftx', Decimal(0.0005), five_hours, 0.045),
|
||||
('ftx', 0.0005, ten_mins, 0.00125),
|
||||
('ftx', 0.00025, ten_mins, 0.000625),
|
||||
('ftx', 0.00025, five_hours, 0.003125),
|
||||
('ftx', 0.00025, twentyfive_hours, 0.015625),
|
||||
])
|
||||
def test_interest(exchange, interest_rate, hours, expected):
|
||||
borrowed = Decimal(60.0)
|
Loading…
Reference in New Issue
Block a user