mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-20 14:00:38 +00:00
fix: DecimalParameter shouldn't have floating point errors
closes #12152
This commit is contained in:
@@ -225,7 +225,6 @@ class RealParameter(NumericParameter):
|
||||
|
||||
class DecimalParameter(NumericParameter):
|
||||
default: float
|
||||
value: float
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -259,6 +258,14 @@ class DecimalParameter(NumericParameter):
|
||||
low=low, high=high, default=default, space=space, optimize=optimize, load=load, **kwargs
|
||||
)
|
||||
|
||||
@property
|
||||
def value(self) -> float:
|
||||
return self._value
|
||||
|
||||
@value.setter
|
||||
def value(self, new_value: float):
|
||||
self._value = round(new_value, self._decimals)
|
||||
|
||||
def get_space(self, name: str) -> "SKDecimal":
|
||||
"""
|
||||
Create optimization space.
|
||||
|
||||
Reference in New Issue
Block a user