All persistence margin tests pass

Flake8 compliant, passed mypy, ran isort .
This commit is contained in:
Sam Germain
2021-07-07 21:14:08 -06:00
parent 52def4e826
commit b0476ebd3e
7 changed files with 135 additions and 115 deletions

View File

@@ -1,16 +1,20 @@
from enum import Enum, auto
from decimal import Decimal
from enum import Enum
from freqtrade.exceptions import OperationalException
one = Decimal(1.0)
four = Decimal(4.0)
twenty_four = Decimal(24.0)
class InterestMode(Enum):
"""Equations to calculate interest"""
HOURSPERDAY = "HOURSPERDAY"
HOURSPER4 = "HOURSPER4" # Hours per 4 hour segment
NONE = "NONE"
def __call__(self, *args, **kwargs):
@@ -21,4 +25,4 @@ class InterestMode(Enum):
elif self.name == "HOURSPER4":
return borrowed * rate * (1 + max(0, (hours-four)/four))
else:
raise OperationalException(f"Leverage not available on this exchange with freqtrade")
raise OperationalException("Leverage not available on this exchange with freqtrade")