Use FtPrecise in interest calculation
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
from decimal import Decimal
|
||||
from math import isclose
|
||||
|
||||
import pytest
|
||||
|
||||
from freqtrade.leverage import interest
|
||||
from freqtrade.util import FtPrecise
|
||||
|
||||
|
||||
ten_mins = Decimal(1 / 6)
|
||||
five_hours = Decimal(5.0)
|
||||
twentyfive_hours = Decimal(25.0)
|
||||
ten_mins = FtPrecise(1 / 6)
|
||||
five_hours = FtPrecise(5.0)
|
||||
twentyfive_hours = FtPrecise(25.0)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('exchange,interest_rate,hours,expected', [
|
||||
@@ -28,11 +28,11 @@ twentyfive_hours = Decimal(25.0)
|
||||
('ftx', 0.00025, twentyfive_hours, 0.015625),
|
||||
])
|
||||
def test_interest(exchange, interest_rate, hours, expected):
|
||||
borrowed = Decimal(60.0)
|
||||
borrowed = FtPrecise(60.0)
|
||||
|
||||
assert isclose(interest(
|
||||
exchange_name=exchange,
|
||||
borrowed=borrowed,
|
||||
rate=Decimal(interest_rate),
|
||||
rate=FtPrecise(interest_rate),
|
||||
hours=hours
|
||||
), expected)
|
||||
|
Reference in New Issue
Block a user