Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 5 additions & 3 deletions scripts/research_hk_equity_combo_backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 5 additions & 4 deletions scripts/research_hk_global_etf_tactical_rotation_backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading