Volatility-targeting overlay with strictly-prior EWMA and financing
Implement a daily volatility-targeting overlay with EWMA vol estimated strictly from prior data, a leverage cap, financing at the risk-free rate plus a spread, and turnover accounting.
instruction.md
What the agent sees (CONVENTIONS.md is appended automatically)
Volatility targeting overlay
Underlying: the IPS policy portfolio rebalanced daily to target weights (frictionless). Overlay: exposure_t = min(1.5, 0.10 / sigma_hat_{t-1}) where sigma_hat is the annualised EWMA (lambda = 0.94) of the underlying's daily returns using data through t-1, initialised with the sample variance (ddof=0) of the first 60 returns; the first exposure applies on return day 61.
Exposure changes trade at the close of t at 2 bps of the change in notional. Unlevered cash earns daily rf from factors.csv; leverage above 1 is financed at rf + 50 bps annualised (divided by 252).
Write /app/output/equity.csv (date, exposure, underlying_return, overlay_return, financing, cost) and /app/output/stats.json including realised annualised vol and average exposure.
Verification
reward.json metrics · weights sum to 1.00
| Metric | Weight | Check |
|---|---|---|
| equity | 0.6 | overlay_return rel 1e-6 every day. |
| stats | 0.25 | rel 1e-6. |
| first_exposure_date | 0.15 | Exact. |
Harbor scaffold
Generated from this record — task.toml, Dockerfile, verifier, oracle stub
schema_version = "1.4" [task] name = "portfolio-agent-evals/pf-bt-vol-target-overlay" version = "1.0.0" description = "Implement a daily volatility-targeting overlay with EWMA vol estimated strictly from prior data, a leverage cap, financing at the risk-free rate plus a spread, and turnover accounting." keywords = ["etf", "portfolio", "backtest", "backtest-engine", "overlay-strategies", "ewma", "financing-math"] [metadata] author_name = "portfolio-agent-evals" difficulty = "hard" category = "quant-finance" tags = ["backtest-engine", "tier-3", "backtest", "multi-metric"] theme = "Backtest Engine Correctness" tier = 3 reward_type = "multi-metric" [agent] timeout_sec = 1800.0 [verifier] timeout_sec = 180.0 [environment] # Offline by design: all data is synthetic and generated at build time. network_mode = "none" cpus = 2 memory_mb = 4096 storage_mb = 10240 build_timeout_sec = 900.0
Traps
Each must carry signal: a trap-blind solution must lose credit
- Using sigma_hat_t instead of sigma_hat_{t-1} (look-ahead of one day).
- EWMA initialisation and the day-61 start.
- Financing spread applies only to the excess over 1.0 exposure.
- Cost is charged on the change in exposure, not gross exposure.
Inputs
Fixtures mounted in the environment
- /app/data/prices/
- /app/policy/ips.yaml
- /app/data/factors.csv
- /app/data/dividends.csv
- /app/CONVENTIONS.md
Outputs
What the verifier reads from /app/output
- /app/output/equity.csvCSVDaily overlay ledger.
- /app/output/stats.jsonJSONStats plus realised vol and average exposure.
Anti-gaming
Seeded data; the vol regime schedule differs per trial.
Oracle notes
solution/solve.sh must score 1.0 on five seeds
Vectorisable except the EWMA recursion.
Reviews (0)
Design review before a task is marked ready