diff --git a/pyproject.toml b/pyproject.toml index f04943e..da0c5b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" requires-python = ">=3.11" dependencies = [ "pandas>=2.0", - "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@53b2ca73a5a50257b5d1a3c769b75c40924e4ba6", + "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@69a0256934d081b5ef309a885384b9eb9f62cf90", ] [project.optional-dependencies] diff --git a/scripts/research_hk_equity_combo_backtest.py b/scripts/research_hk_equity_combo_backtest.py index fea0970..b1c66b1 100644 --- a/scripts/research_hk_equity_combo_backtest.py +++ b/scripts/research_hk_equity_combo_backtest.py @@ -250,6 +250,7 @@ def run_combo( rotation: RotationConfig | None = None, combo: ComboConfig | None = None, *, + legacy: bool = False, orchestrator: bool = False, ) -> dict[str, Any]: """Run static and dynamic combo backtests and return full results. @@ -268,7 +269,7 @@ def run_combo( rotation = rotation or RotationConfig() combo = combo or ComboConfig() - if orchestrator: + if not legacy: from hk_equity_strategies.backtest.orchestrator_research import run_combo_profile_backtest from hk_equity_strategies.backtest.yfinance_market_data import download_market_history from hk_equity_strategies.strategies.hk_equity_combo import PROFILE_NAME @@ -408,14 +409,15 @@ def main() -> None: description="Backtest HK equity combo (ETF rotation + dividend snapshot)." ) parser.add_argument("--json-output", type=Path) + parser.add_argument("--legacy", "--analysis", dest="legacy", action="store_true", help="Run the legacy research-analysis path instead of BacktestOrchestrator.") parser.add_argument( "--orchestrator", action="store_true", - help="Run combo via HkEquityComboBacktestRunner (BacktestOrchestrator path).", + help="Deprecated compatibility flag; default path already uses BacktestOrchestrator.", ) args = parser.parse_args() - payload = run_combo(orchestrator=args.orchestrator) + payload = run_combo(legacy=args.legacy) text = json.dumps(payload, indent=2, sort_keys=True) if args.json_output: diff --git a/scripts/research_hk_global_etf_tactical_rotation_backtest.py b/scripts/research_hk_global_etf_tactical_rotation_backtest.py index 762ccdc..83defac 100755 --- a/scripts/research_hk_global_etf_tactical_rotation_backtest.py +++ b/scripts/research_hk_global_etf_tactical_rotation_backtest.py @@ -201,8 +201,8 @@ def _slice(series: pd.Series, start: str | None, end: str | None) -> pd.Series: return output -def run(config: BacktestConfig, rotation: RotationConfig, *, orchestrator: bool = False) -> dict[str, Any]: - if orchestrator: +def run(config: BacktestConfig, rotation: RotationConfig, *, legacy: bool = False) -> dict[str, Any]: + if not legacy: market_history = download_market_history(start=config.start, end=config.end) payload = run_etf_rotation_profile_backtest( "hk_global_etf_tactical_rotation", @@ -269,13 +269,14 @@ def run(config: BacktestConfig, rotation: RotationConfig, *, orchestrator: bool def main() -> None: parser = argparse.ArgumentParser(description="Backtest a HK-listed global ETF rotation research candidate.") parser.add_argument("--json-output", type=Path) + parser.add_argument("--legacy", "--analysis", dest="legacy", action="store_true", help="Run the legacy research-analysis path instead of BacktestOrchestrator.") parser.add_argument( "--orchestrator", action="store_true", - help="Run strategy leg via HkEtfRotationBacktestRunner (BacktestOrchestrator path).", + help="Deprecated compatibility flag; default path already uses BacktestOrchestrator.", ) args = parser.parse_args() - payload = run(BacktestConfig(), RotationConfig(), orchestrator=args.orchestrator) + payload = run(BacktestConfig(), RotationConfig(), legacy=args.legacy) text = json.dumps(payload, indent=2, sort_keys=True, default=str) if args.json_output: args.json_output.write_text(text + "\n") diff --git a/uv.lock b/uv.lock index 3c27441..197cca8 100644 --- a/uv.lock +++ b/uv.lock @@ -40,7 +40,7 @@ test = [ requires-dist = [ { name = "pandas", specifier = ">=2.0" }, { name = "pytest", marker = "extra == 'test'", specifier = ">=8" }, - { name = "quant-platform-kit", git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=53b2ca73a5a50257b5d1a3c769b75c40924e4ba6" }, + { name = "quant-platform-kit", git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=69a0256934d081b5ef309a885384b9eb9f62cf90" }, ] provides-extras = ["test"] @@ -315,7 +315,7 @@ wheels = [ [[package]] name = "quant-platform-kit" version = "0.10.0" -source = { git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=53b2ca73a5a50257b5d1a3c769b75c40924e4ba6#53b2ca73a5a50257b5d1a3c769b75c40924e4ba6" } +source = { git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=69a0256934d081b5ef309a885384b9eb9f62cf90#69a0256934d081b5ef309a885384b9eb9f62cf90" } [[package]] name = "six"