examples/harnesses/trading, a harness for systematic trading strategies, and examples/trading, a task on it. The task is deliberately small: three synthetic instruments with a trend in them, a 20/100 moving-average cross that scores a Sharpe of 0.14 out of sample (measured by us on the example’s evaluator when the example was recorded), a brief that asks for 1.0. A faster cross or a volatility-targeted momentum signal gets there, so there is room, and every discipline of the domain has something to catch.
The harness
examples/harnesses/trading/harness.yaml
kapso harness check examples/harnesses/trading prints check ok (7 skills, 2 agents, 2 servers, 7 hooks) and, on a machine without the harness’s Python requirements, the needs lines for them.
The task
examples/trading/kapso-brief.md
generate.py writes the bars from a seed, so the baseline is the same number on every machine: three instruments, business days from 2021 through 2024, each a random walk whose next return leans on the last twenty days’ average by a weight of 0.35. The development years go under data/, the out-of-sample year under private/, which nothing copies into a workspace; the evaluator reads it through a pointer file beside itself. The evaluator imports signal from the workspace, shifts it by one bar, charges the cost on turnover, scores 2024 as an equal-weight portfolio, writes the two result files the require-results hook asks for, and prints the risk line then sharpe: <value> as its last line.
Run it
examples/trading/run.py
Harness line names the harness, so the command needs no --harness; load_harness() in the script is the same thing said in Python, and either wins over the line.
What the campaign shows
- The setup session runs first. It calls the
market-dataserver’ssnapshotonkapso_datasets/bars, which lands underprepared/market-data/with aMANIFEST.jsonof hashes, and writes the domain statement: the instruments, the calendar, the window, what it pinned.kapso_task.mdcarries both. - Each experiment’s implementation session has the backtesting and look-ahead skills, the
market-dataserver and the auditor beside it; a write underprepared/is denied, a written signal is scanned, and the session cannot end before the result files exist. The stream under.kapso/sessions/<branch>/stream.jsonlshows each decision. - Each scored attempt is verified before it is judged: the verifier reads the diff and the evaluation output under
.kapso/verification/<branch>/, runs the scan, asks the auditor where a pattern cannot decide, and writesverdict.json. A centred window or a future shift is avoidwith its file and line; the attempt stays on its branch and is never delivered. - The judge reads the verdict beside the evaluation and the risk reviewer’s words beside the score.
solution.explain()ends with the harness’s identity and the verdict on the delivered candidate.
Change it
- The harness. Edit a page under
examples/harnesses/trading/instructions/, bumpversion, runcheckagain. The next build records the new hash; a resume of an older campaign refuses it by name. - The target. The data’s trend is worth a Sharpe of about 2 to a 20-day momentum signal; a target above 3 is not there.
- The evaluator and the data.
evaluation/evaluate.pyandgenerate.pyare the task’s own; change the metric in the evaluator and inMeasured bytogether, change the trend weight and re-measure the baseline.
pip install leeroo-kapso · Every page as plain text: llms.txt.