Lint strategy code for lookahead and bias
check_codeReview Python/pandas backtest code statically to detect lookahead bias, data leakage, and invalid validation; return rule IDs, severity, fix hints, and a 0-100 audit score.
Instructions
Static review of Python/pandas strategy code for patterns that inflate backtests: negative shifts in
features or signals, centered windows, backward fill, fitting before the time split, shuffled CV, signal
and fill on the same bar, labels on the wrong bar, today's index constituents, yfinance caveats,
intraday resample labels, global normalization, target leakage, full-sample parameter search and
missing costs. Each finding has a rule id, severity (high/medium/possible/info), line, why it
inflates results and a fix hint. Returns Markdown plus JSON with a 0-100 audit score, and
suggested_fixes: minimal line edits for unambiguous findings, each re-checked by re-linting (often empty).
For files on disk, prefer check_path.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"source": "<source>"
},
"name": "check_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Python source of the strategy/backtest (pandas, numpy, sklearn, vectorbt, backtrader...). Paste the whole file or notebook cells. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||