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 exchange_name: The exchanged being trading on
|
||||||
:param borrowed: The amount of currency being borrowed
|
: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
|
:param hours: The time in hours that the currency has been borrowed for
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
@ -36,7 +36,8 @@ def interest(
|
|||||||
# Rounded based on https://kraken-fees-calculator.github.io/
|
# Rounded based on https://kraken-fees-calculator.github.io/
|
||||||
return borrowed * rate * (one+ceil(hours/four))
|
return borrowed * rate * (one+ceil(hours/four))
|
||||||
elif exchange_name == "ftx":
|
elif exchange_name == "ftx":
|
||||||
# TODO-lev: Add FTX interest formula
|
# As Explained under #Interest rates section in
|
||||||
raise OperationalException(f"Leverage not available on {exchange_name} with freqtrade")
|
# https://help.ftx.com/hc/en-us/articles/360053007671-Spot-Margin-Trading-Explainer
|
||||||
|
return borrowed * rate * ceil(hours)/twenty_four
|
||||||
else:
|
else:
|
||||||
raise OperationalException(f"Leverage not available on {exchange_name} with freqtrade")
|
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, five_hours, 0.045),
|
||||||
('kraken', 0.00025, twentyfive_hours, 0.12),
|
('kraken', 0.00025, twentyfive_hours, 0.12),
|
||||||
# FTX
|
# FTX
|
||||||
# TODO-lev: - implement FTX tests
|
('ftx', 0.0005, ten_mins, 0.00125),
|
||||||
# ('ftx', Decimal(0.0005), ten_mins, 0.06),
|
('ftx', 0.00025, ten_mins, 0.000625),
|
||||||
# ('ftx', Decimal(0.0005), five_hours, 0.045),
|
('ftx', 0.00025, five_hours, 0.003125),
|
||||||
|
('ftx', 0.00025, twentyfive_hours, 0.015625),
|
||||||
])
|
])
|
||||||
def test_interest(exchange, interest_rate, hours, expected):
|
def test_interest(exchange, interest_rate, hours, expected):
|
||||||
borrowed = Decimal(60.0)
|
borrowed = Decimal(60.0)
|
Loading…
Reference in New Issue
Block a user