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:
@@ -362,12 +362,15 @@ class UpdowStrategy(BaseStrategy):
|
||||
return sc[len(self._ENTRY_TAG_PREFIX) :]
|
||||
return ""
|
||||
|
||||
def _load_holdings_from_db(self) -> None:
|
||||
super()._load_holdings_from_db()
|
||||
def _after_holdings_sync(self) -> None:
|
||||
for _code, h in self.holdings.items():
|
||||
ek = self._parse_entry_bar_key(h)
|
||||
if ek:
|
||||
h["updow_entry_bar_key"] = ek
|
||||
self._runtime.setdefault(_code, {})["updow_entry_bar_key"] = ek
|
||||
|
||||
def _load_holdings_from_db(self, *, log_restore: bool = False) -> None:
|
||||
super()._load_holdings_from_db(log_restore=log_restore)
|
||||
|
||||
def _submit_buy(self, signal: Dict):
|
||||
code = signal.get("code") or ""
|
||||
@@ -388,6 +391,7 @@ class UpdowStrategy(BaseStrategy):
|
||||
self.holdings[code]["box_low"] = float(ef["box_low"])
|
||||
if ef.get("box_high"):
|
||||
self.holdings[code]["box_high"] = float(ef["box_high"])
|
||||
self._capture_runtime_overlay()
|
||||
return result
|
||||
|
||||
def _merged_cfg(self, code: str) -> Dict:
|
||||
|
||||
Reference in New Issue
Block a user