Add offline workflow and coverage tests

This commit is contained in:
Yuxuan Yan
2026-06-16 17:37:16 +08:00
parent 8d908477e2
commit 31baa18ce5
16 changed files with 2104 additions and 9 deletions
+4 -3
View File
@@ -160,7 +160,8 @@ def reversal_vol(data_path, output_dir, lookback, vol_window):
@alpha.command("eval")
@click.option("--alpha-path", required=True, help="Path to alpha parquet file")
@click.option("--data-path", required=True, help="Path to data parquet (for price data)")
def eval_(alpha_path, data_path):
@click.option("--report-dir", default="reports", help="Directory to save JSON report")
def eval_(alpha_path, data_path, report_dir):
"""Evaluate an alpha's performance (return, Sharpe, turnover).
Alphas are interpreted as position WEIGHTS, not return predictors.
@@ -183,9 +184,9 @@ def eval_(alpha_path, data_path):
click.echo("=" * 50)
# Also dump JSON
os.makedirs("reports", exist_ok=True)
os.makedirs(report_dir, exist_ok=True)
alpha_name = alpha_df["alpha_name"].iloc[0]
json_path = f"reports/{alpha_name}_eval.json"
json_path = os.path.join(report_dir, f"{alpha_name}_eval.json")
with open(json_path, "w") as f:
json.dump(metrics, f, indent=2)
click.echo(f"\nReport saved: {json_path}")