Use default parameters for DrawdownResult

This commit is contained in:
Matthias 2024-05-14 19:50:35 +02:00
parent 94786454b7
commit bcb59265b5
2 changed files with 7 additions and 16 deletions

View File

@ -163,21 +163,12 @@ def calculate_underwater(
@dataclass()
class DrawDownResult:
__slots__ = [
"drawdown_abs",
"high_date",
"low_date",
"high_value",
"low_value",
"relative_account_drawdown",
]
drawdown_abs: float
high_date: datetime
low_date: datetime
high_value: float
low_value: float
relative_account_drawdown: float
drawdown_abs: float = 0.0
high_date: datetime = None
low_date: datetime = None
high_value: float = 0.0
low_value: float = 0.0
relative_account_drawdown: float = 0.0
def calc_max_drawdown(

View File

@ -596,7 +596,7 @@ class RPC:
expectancy, expectancy_ratio = calculate_expectancy(trades_df)
drawdown = DrawDownResult(0.0, 0.0, None, None, 0.0)
drawdown = DrawDownResult()
if len(trades_df) > 0:
try:
drawdown = calc_max_drawdown(