feat: Add new files and enhance backtesting functionality

Changes:
- Introduced new files for strategy definitions and study names.
- Enhanced `backtest_web.py` with functions to handle integer display prices and trade data formatting.
- Updated backtesting logic to incorporate end-of-day (EOD) parameters for breakout and momentum strategies.
- Added EOD configuration options in the database and parameter search files.

Impact:
- These changes improve the modularity and usability of the backtesting framework, allowing for better integration of EOD strategies and clearer trade data presentation.
This commit is contained in:
2026-07-06 19:11:34 +09:00
parent 336d637b72
commit 78edb75e01
33 changed files with 1479 additions and 303 deletions

View File

@@ -238,6 +238,16 @@ def params_to_tail_env_patch(p: Dict[str, Any]) -> Dict[str, str]:
_set("TAIL_TIME_END", int(float(p["time_end_hm"])))
if "max_daily" in p and p["max_daily"] is not None:
_set("TAIL_MAX_DAILY", int(float(p["max_daily"])))
if "eod_enabled" in p:
v = p.get("eod_enabled")
patch["TAIL_EOD_ENABLED"] = (
"1" if str(v).strip().lower() in ("1", "true", "t", "y", "yes", "on") else "0"
)
if "eod_hm" in p and p["eod_hm"] is not None:
eod_s = str(p["eod_hm"]).strip()
if eod_s and ":" not in eod_s and len(eod_s) == 4 and eod_s.isdigit():
eod_s = f"{eod_s[:2]}:{eod_s[2:]}"
patch["TAIL_EOD_HM"] = eod_s
if "min_price" in p and p["min_price"] is not None:
_set("TAIL_MIN_PRICE", float(p["min_price"]))
if "slot_money" in p and p["slot_money"] is not None:
@@ -374,6 +384,11 @@ def web_body_to_tail_env_patch(body: Dict[str, Any]) -> Dict[str, str]:
p[k] = v
if "ratchet_tiers" in body:
p["ratchet_tiers"] = str(body.get("ratchet_tiers") or "").strip()
if "eod_enabled" in body:
p["eod_enabled"] = body.get("eod_enabled")
eod_hm = _get("eod_hm")
if eod_hm is not None:
p["eod_hm"] = str(eod_hm).strip()
mdloss = _get("min_drop_pct_for_loss_cut")
if mdloss is not None:
p["min_drop_pct_for_loss_cut"] = float(mdloss)