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

@@ -25,8 +25,8 @@ from ..engine.limit_entry_common import (
should_cancel_unfilled_limit,
tail_limit_params,
)
from ..utils.env import get_env_bool, get_env_float, get_env_int
from .base import BaseStrategy
from ..utils.env import get_env_bool, get_env_float, get_env_from_db, get_env_int
from .base import BaseStrategy, is_live_eod_now
class TailCatchStrategy(BaseStrategy):
@@ -63,6 +63,8 @@ class TailCatchStrategy(BaseStrategy):
self._engine_params = p
except Exception as e:
self.logger.debug("tail_engine defaults 조회 실패: %s", e)
self.eod_enabled = get_env_bool("TAIL_EOD_ENABLED", True)
self.eod_hm = get_env_from_db("TAIL_EOD_HM", "15:25")
def _candidate_filter(self, candidate: Dict) -> bool:
"""tail_on 이 True 인 후보만 대상 (SCALP 과 분리)."""
@@ -377,7 +379,12 @@ class TailCatchStrategy(BaseStrategy):
return []
now = dt.now()
is_eod = (now.hour == 15 and now.minute >= 25) or now.hour > 15
is_eod = is_live_eod_now(
getattr(self, "eod_enabled", True),
getattr(self, "eod_hm", "15:25"),
now,
default_hm="15:25",
)
try:
params = te.get_tail_defaults_from_db(self.db)
except Exception: