llm-trading-lab
Tooling that decides when an LLM trading agent is called, logs every call, records every prompt change with a falsification test, and audits research for look-ahead leaks.
- Repository
- darblinko/llm-trading-lab
- License
- Apache-2.0
Not investment advice
This is research tooling. It contains no trading strategy and no live prompts, and nothing here is a recommendation to buy or sell a security or an option. Backtest, replay and synthetic results do not predict future results. A bought option can lose its full premium.
How it works
The live loop is deterministic until a trigger fires. llm_gate holds without an LLM call when no strong trigger fires and fewer than two weak triggers fire. Each call that is made goes to a daily markdown trace. Session reviews lead to prompt changes, and each change is stored as before, after, diff and a rationale naming its trigger, expected effect and falsifier. Research candidates pass the leakage audit before any gate.
flowchart LR
tick["Market tick"] --> controls["agent_controls"]
controls --> gate{"llm_gate: trigger fired?"}
gate -- no --> hold["Hold, no LLM call"]
gate -- yes --> llm["LLM agent decision"]
llm --> trace["Daily markdown trace"]
trace --> apps["Session review apps"]
apps --> history["prompt_history record"]
idea["Research candidate"] --> audit["leakage_audit"]
audit --> wf["walkforward with purge"]
audit --> stagea["Stage A gate"]
Results
This repository publishes no result tables. Results are regenerated by running the included scripts against your own data source; see the README.
Run it
git clone https://github.com/darblinko/llm-trading-lab cd llm-trading-labpython3 -m venv .venv . .venv/bin/activate pip install -e ".[dev]"python scripts/make_sample_data.py python -m pytest -qpython -m swing_backtest.demo python -m leakage_audit --data data/sample/bars_1min.csv --plant-leaks python -m walkforward --data data/sample/bars_1min.csv --purge-bars 10
Limitations
- No result tables are committed. The code runs on synthetic data in this repository.
- The walk-forward code computes features from OHLCV.
- The live prompts, the LLM pipeline and the order execution code are not included.