chore: don't use deprecated resmapling frequency

This commit is contained in:
Matthias
2026-04-12 13:02:51 +02:00
parent c60d96922d
commit 33211c8eb1
2 changed files with 4 additions and 4 deletions

View File

@@ -340,7 +340,7 @@ def generate_strategy_comparison(bt_stats: dict) -> list[dict]:
def _get_resample_from_period(period: str) -> str:
if period == "day":
return "1d"
return "1D"
if period == "week":
# Weekly defaulting to Monday.
return "1W-MON"
@@ -530,8 +530,8 @@ def generate_daily_stats(results: DataFrame) -> dict[str, Any]:
"losing_days": 0,
"daily_profit_list": [],
}
daily_profit_rel = results.resample("1d", on="close_date")["profit_ratio"].sum()
daily_profit = results.resample("1d", on="close_date")["profit_abs"].sum().round(10)
daily_profit_rel = results.resample("1D", on="close_date")["profit_ratio"].sum()
daily_profit = results.resample("1D", on="close_date")["profit_abs"].sum().round(10)
worst_rel = min(daily_profit_rel)
best_rel = max(daily_profit_rel)
worst = min(daily_profit)

View File

@@ -713,7 +713,7 @@ def test_generate_periodic_breakdown_stats(testdatadir):
def test__get_resample_from_period():
assert _get_resample_from_period("day") == "1d"
assert _get_resample_from_period("day") == "1D"
assert _get_resample_from_period("week") == "1W-MON"
assert _get_resample_from_period("month") == "1ME"
assert _get_resample_from_period("weekday") == "weekday"