A benchmark for LLM trading agents, with news replayed by the minute it was published
Most news backtests join headlines to prices by calendar date, so a headline published after the close is traded at that close. Here every headline arrives at the minute it was published and orders fill at the next open, through three frozen markets: the 2020 crash, the 2022 bear market and 2026. Llama, GPT, Claude and Gemini trade them blind and with names, three seeds each, scored apart before and after each model's training cutoff. The results are public; the headlines behind them are licensed and not distributed, so the replay runs on news you bring: the free SEC 8-K filings, a news API key of your own or any CSV.
The same package is also a set of AI trading agents for US stocks that check the macro calendar, the fear index and verified news before they buy.
Market regimes from VIX and the FOMC / CPI calendar · dip buying with an earnings check · a 30% cash floor · cross-verified news · paper-trading agents ranked against SPY · news backtests that cannot see the future · a public leaderboard of LLM trading agents · frozen 2020, 2022 and 2026 markets for research · LLM agents over MCP · paper and live trading on 10 brokers.
🌐 Website · 🏆 LLM leaderboard · 中文说明 → README_zh.md · 🚀 Quick start · 🆕 What's new · 🔬 Research kit · 🔗 MCP · 📸 Screenshots · Changelog
Screens from the dashboard and from riskaware research run on the bundled 2026 data. A backtest shows what a strategy would have done, not what it will do.
🚀 Quick start
pip install "risk-aware-trading-agents[dashboard,mcp]" # Python 3.10+
riskaware dashboard # the web UI on http://localhost:8501, English and 中文
Then, in another terminal:
riskaware init # 2-minute wizard: language, risk profile, broker, watchlist
riskaware regime # market regime, VIX, fear & greed, next FOMC / CPI / jobs report
riskaware scan # today's signals, each with its reasons
riskaware analyze NVDA # what every agent thinks about one stock
riskaware news AAPL # cross-verified headlines
riskaware backtest --compare buy_and_hold,ema_bounce
riskaware run # one paper-trading cycle (built-in paper account)
riskaware agents init # four starter paper-trading agents
riskaware agents run # let them trade once now
riskaware agents schedule --install # ...and every trading day from now on
riskaware research run -s swing_trend # a strategy on the frozen 2026 market, with a look-ahead check
riskaware research run -s swing_trend --period 2022 # the same in the 2022 bear market
On your phone: riskaware phone on, then scan the QR code it prints; the phone reaches this computer through Tailscale, at home or away, and logs in with an access code. How →
No account or API key is needed for any of these. Add --lang zh to any command for Chinese output. For the newest code before it is released, use pip install "risk-aware-trading-agents[dashboard,mcp] @ git+https://github.com/jackson-cmd/risk-aware-trading-agents"; to change the code, clone the repository and run pip install -e ".[dashboard,mcp]".
Docker, for x86-64 and ARM:
docker run --rm -p 8501:8501 ghcr.io/jackson-cmd/risk-aware-trading-agents dashboard # http://localhost:8501
docker run -i --rm ghcr.io/jackson-cmd/risk-aware-trading-agents mcp # MCP server over stdio
For the daily paper-trading scheduler as well, put riskaware.yaml (from riskaware init) and, if you use broker keys, .env in the repository root, then run docker compose -f docker/docker-compose.yml up -d (or make docker).
Nothing to install: opens the repository in your browser with every extra installed. Run riskaware dashboard there and port 8501 opens by itself.
Is it for you?
- You trade US stocks over days to weeks and want rules you can read: buy quality names on pullbacks, keep cash, and never sell in a panic.
- You want backtests that cannot cheat: news replayed as it was published, orders at the next open, and a look-ahead check on every research run.
- You study LLM trading agents and need data and a setup that others can repeat: three frozen markets (the 2020 crash, the 2022 bear market, 2026), a blind mode, a saved record of every run, and a public leaderboard you can submit to.
- You use Claude, Codex or Gemini and want them to test a strategy you describe in words, on your own plan, with no API key.
- You want to paper trade first: several strategies side by side on simulated money, ranked against SPY every trading day.
- You read English or Chinese: the CLI, the dashboard, the reports and the docs come in both.
If you were looking for an AI trading bot for US stocks, a backtester with historical news and no look-ahead bias, a point-in-time dataset of prices, VIX and headlines for 2020, 2022 and 2026, a benchmark and leaderboard for LLM trading agents, an MCP server for trading research, or paper-trading agents for Alpaca and other brokers: it is all here, open source.
Contents
- 🚀 Quick start · Is it for you? · 🆕 What's new · 💡 The idea · Four ways to use it
- ✨ Feature tour: How it works · Cross-verified news · Paper-trading agents · On your phone · MCP server · Strategy lab · LLM leaderboard · Research kit · Backtest · Strategy library · Write your own strategy
- 📸 Screenshots · 🔌 Brokers · 🔒 Safety · 🔧 Configuration · 🧰 Under the hood: CLI · Project layout
- ❓ FAQ · 🧭 Roadmap · 🤝 Contributing · 📝 Citation · ❗ Disclaimer · 📜 License
🆕 What's new
- 0.10.0 · 🗞️ Open news you may share:
riskaware news-history collectgathers SEC, Federal Reserve, FDA, BEA, BLS and CFTC releases, every 8-K and GDELT's finance headlines, each with the time it was first seen, andpullbrings them into your backtests. Only sources that allow republication are collected. How → - 0.9.0 · 📱 The dashboard on your phone, at home or away: turn on phone access, scan the QR code, and your phone opens the dashboard running on your computer through Tailscale, logged in with an access code for 180 days; nothing is opened to the internet.
riskaware dashboardnow listens on 127.0.0.1, so the same Wi-Fi no longer gets in without a login. How → - 0.8.0 · 🏆 LLM trading agent leaderboard, rta-bench-1: six models trade 2026, the 2022 bear market and the 2020 crash, blind and with names, with news replayed by publication time and realistic costs. Scored after each model's training cutoff, Claude Haiku 4.5 leads 2026 with +7.2%, still behind SPY's +12.1%. Leaderboard → Also new: the frozen 2022 and 2020 periods, realistic costs, return attribution (exposures and alpha), news factors, short selling and margin, a memory probe and prompt tests. The licensed headlines are no longer distributed with the package; the results and numbers stay public. Releases are no longer archived on Zenodo.
- 0.7.2 · 🔗 One step into Claude and other MCP clients: the server is on the official MCP Registry,
uvx risk-aware-trading-agents mcpstarts it with nothing installed first, and every release carries a Claude Desktop extension (.mcpb) that installs when you open it. How → - 0.7.1 · 📦 On PyPI and Docker:
pip install risk-aware-trading-agents, or run the dashboard or the MCP server fromghcr.io/jackson-cmd/risk-aware-trading-agentswithout installing Python; GitHub Codespaces opens the repository with everything installed. How → - 0.7.0 · 🔬 A frozen 2026 market for research: point-in-time prices and VIX for the whole year ship with the package, and news is replayed by the minute it was published (the licensed headlines are not distributed after 0.7.2: bring your own). Ask what was known at any close, let Claude turn a strategy you describe into code and test it, or let an LLM trade the year step by step. Every run gets a look-ahead check and a record for papers; trend following made +21.1% against SPY's +12.1%. How →
- 0.6.3 · ⏳ Long runs keep going in the background: scans, backtests, agent runs and news fetches go on when you switch pages or reload, and a bar takes you back to the result.
Earlier releases
- 0.6.2 · ❓ Every number explains itself: a ? next to every card, column and field says what it is, how it is calculated and how to use it, in English and 中文. See it →
- 0.6.1 · 🔎 The news behind every backtest trade: pick a trade and see the headlines the backtest had at that close and the order it placed. How →
- 0.6.0 · 🗞️ 2026 news replay: 16,945 headlines and SEC filings for the 64 built-in stocks (bundled until 0.7.2; licensed, so no longer distributed). The agent with news made +15.9% against SPY's +12.1%, with a -5.3% drawdown against -8.9%. Results →
- 0.6.0 · 🧪 Describe a strategy, the AI writes and tests it: over MCP, Claude, Codex or Gemini write the strategy as code; it is checked for look-ahead and side effects and runs in a separate process. How →
- 0.6.0 · 🔭 No peeking at the future: each backtest day sees only news published before its close, and a strategy cannot reach later prices. github.com/jackson-cmd/risk-aware-trading-agents/blob/main
- 0.5.0 · 🔑 No API key needed: agent reviews run on your Claude, ChatGPT or Gemini plan with
--llm claude-cli,codex-cliorgemini-cli. How → - 0.5.0 · 🔌 MCP in one command:
riskaware mcp-setup claude-desktop(orclaude-code,codex,gemini,antigravity). Set it up → - 0.5.0 · 🗄️ Your own news archive for other years: SEC 8-K filings for free, a news API key of your own, or any CSV, replayed the same way. How →
- 0.4.0 gave each agent its own LLM review with every decision on record, 0.3.0 added daily paper-trading agents, the MCP server and the new dashboard, and 0.2.0 added options backtests and four stock strategies.
The full history is in the changelog.
💡 The idea
Most trading bots either chase every signal or need a quant team to configure. This one follows a simple, explainable discipline that long-term investors already use: buy quality stocks when they pull back to their moving averages, add when fear is high and the earnings still hold up, trim when prices run too far, never panic-sell into uncertainty, and always keep a cash reserve. Four agents check the market, the calendar, the company and the news; a deterministic risk manager has the final word on every order.
How it did. On 2026 so far, reading the 2026 headlines (licensed, not distributed), the agent made +15.9% against SPY's +12.1%, with a Sharpe ratio of 1.70 against 0.77, and its worst drop was -5.3% against SPY's -8.9% (details). From 2018 to 2026 it earned less than SPY in the long bull market, 10.4% a year against 14.1%, and fell about half as far, -18.2% against -33.7% (details).
Not financial advice. It starts in paper mode, and live trading needs three explicit switches.
Four ways to use it
| Dashboard | Command line | AI assistants (MCP) | Python | |
|---|---|---|---|---|
| Start with | riskaware dashboard |
riskaware scan |
riskaware mcp-setup claude-desktop --apply |
from riskaware.research import run_experiment |
| What you do | watch the regime, the signals, the agents and the backtests, in English or 中文 | scan, backtest, paper trade, and schedule the agents | describe a strategy in words; Claude, Codex or Gemini write it, test it and explain the result | run experiments on the frozen 2020, 2022 and 2026 markets and keep a record for a paper |
| Needs | the dashboard extra |
nothing else | the mcp extra; runs on your plan, no API key |
nothing else |
from riskaware.research import Experiment, run_experiment
r = run_experiment(Experiment(strategy="swing_trend", news=True, split="2026-07-01"))
print(r.summary()["metrics"], r.leak, r.folder)
✨ Feature tour
The highlights. The guides in docs/ cover every command and setting, and the website has longer answers on news backtesting, point-in-time data and LLM agents.
🧠 How it works
- Macro-aware market regimes. VIX and its term structure (VIX/VIX3M), sector breadth, credit appetite (HYG vs IEF), safe-haven demand, a fear-and-greed gauge computed from free data (and CNN's Fear & Greed for reference), and the FOMC, CPI, jobs report, PPI, GDP and PCE calendar put the market in one of four regimes: risk-on, neutral, uncertain, risk-off.
- Buy low, sell high. Pullbacks to EMA 50 / 100 / 200, RSI(2) and z-score mean reversion, quality dips that must pass an earnings check (revenue growth, margins, free cash flow, leverage, EPS beats), breakouts and trend continuation in strong markets. Take-profit trims when a stock runs far above EMA50; trend exits after a break of a falling EMA50.
- No panic selling. When the regime is uncertain or risk-off the agent holds, does not sell, and only buys at strong support. Only a disaster the company itself confirms (bankruptcy, delisting, restatement in its own 8-K or press release) or an optional hard stop can force an exit.
- Risk first. A 30% cash + T-bill floor, position, sector and speculative ("lottery ticket") caps, volatility-scaled sizes, buying in tranches, a Treasury sleeve for conservative profiles, idle cash parked in a T-bill ETF, a drawdown pause, a kill switch.
- Optional LLM review, per agent. A bull analyst, a bear analyst and a risk judge (GPT, Claude, any OpenAI-compatible model such as DeepSeek or Qwen, or a free local model through Ollama) can nudge conviction by at most ±0.15 or veto a buy. They can never create a trade or change a limit. News reaches them only as quoted, untrusted text, and every prompt and reply is kept in the local journal so you can see how each decision was made.
flowchart TB
D["Prices · VIX · sectors · FOMC / CPI / NFP calendar · earnings · Finviz + RSS + SEC"]
M["Macro agent<br/>regime + fear/greed"]
E["Event agent<br/>FOMC, CPI, jobs"]
T["Technical agent<br/>EMA 50/100/200,<br/>mean reversion, trend"]
F["Fundamental agent<br/>earnings quality"]
N["News agent<br/>cross-verified"]
S["Strategy: built-in or yours"]
L["Optional LLM<br/>bull / bear / judge"]
R["Risk manager: cash floor · caps · tranches · regime rules"]
D --> M & E & T & F & N
M & E & T & F & N --> S
L -.->|"±0.15 at most"| S
S --> R
R --> G["Safety guards"] --> B["Paper or live broker"]
R --> X["Backtester"]
What the agent does in each regime
| Regime | Typical trigger | Buys | Sells | Size |
|---|---|---|---|---|
| 🟢 Risk-on | SPY above a rising EMA50 and EMA200, VIX < 20, most sectors above EMA200 | pullbacks, breakouts, dips | take profit, trend exits | 100% |
| ⚪ Neutral | none of the others | EMA support, mean reversion, quality dips | take profit | 75% |
| 🟡 Uncertain | 2 days before an FOMC decision, the day before CPI or the jobs report, VIX 20–30, fear gauge < 35, downtrend | EMA100 / EMA200 support only | none: hold | 50% |
| 🔴 Risk-off | VIX ≥ 30, VIX backwardation below EMA200, credit stress | quality dips and broad ETFs, small tranches | none: hold | 35% |
Emergency exits (a severe red flag the company itself confirms in its 8-K or its own press release, or the profile's hard stop) work in every regime.
Risk profiles
| Conservative | Balanced | Aggressive | |
|---|---|---|---|
| Cash + T-bill floor | 30% | 30% | 30% |
| Treasury sleeve (IEF) | 15% | 5% | 0% |
| Max single stock / sector | 5% / 20% | 7% / 25% | 10% / 35% |
| Speculative sleeve (high-volatility names) | 0% | 3% (2 names) | 7% (3 names) |
| Minimum conviction | 0.65 | 0.58 | 0.52 |
| Earnings score needed for a dip buy | 70 | 60 | 50 |
| Take-profit trigger | +20% | +25% | +30% |
| Breakout entries | off | off | on |
Every limit can be overridden in riskaware.yaml. Positions are built in tranches (50% / 25% / 25% of the target); a later tranche needs a deeper support touch or a winning position, and trimmed positions can be rebuilt on the next pullback.
📰 Cross-verified news
- Sources. Finviz (free), Google News, Nasdaq, Seeking Alpha and Yahoo RSS, plus the company's own SEC 8-K filings.
- Confirmed means two sources. A story only counts toward the company it names, and it is confirmed when two independent outlets, the company's own press release or its SEC filing carry it. A red flag on a confirmed story blocks new buys.
- Hard to fool. Only the company's 8-K, or its own release confirming what independent outlets reported first, can force a sale, so a fake headline, a fake press release and the outlets that repeat it, or another company's bad news cannot. A denial clears the story it refutes instead of confirming it.
The same check runs in backtests, on news replayed as it was published: see News in backtests.
🤖 Paper-trading agents
An agent is a strategy with its own paper account. Pick a strategy (built-in or your own file), a risk profile, a stock list and the starting cash, and the agent trades that account once every trading day on free Yahoo Finance prices. Run several side by side and see which one beats SPY. Agents only ever use the built-in paper account, never a broker.
riskaware agents init # steady, momentum, breakout, fear-buyer
riskaware agents add dips --strategy rsi2 --universe tech --cash 25000
riskaware agents add mine --strategy my_dip.py:MyDip --profile aggressive
riskaware agents add luna --strategy risk_aware --llm openai:gpt-5.6-luna # with an LLM review board
riskaware agents add local --strategy risk_aware --llm ollama:qwen2.5:3b # a free local model
riskaware agents run # trade every active agent now
riskaware agents why luna # how it decided: setups, risk check, bull / bear / judge
riskaware agents # the leaderboard
riskaware agents schedule --install # every trading day, by itself
The daily job (a LaunchAgent on macOS, a crontab line on Linux, a scheduled task on Windows) wakes every 15 minutes on weekdays and trades each agent once per trading day after 15:40 New York time, before the close. It skips holidays, catches up after the laptop sleeps, and keeps going when one agent fails. Each agent keeps its account, journal and daily equity in ~/.riskaware/arena/NAME/. The Agents page of the dashboard shows the leaderboard and lets you create, run, pause, reset and delete agents; its Decisions tab shows how each decision was made, including the LLM's bull case, bear case and verdict and the exact prompt it was sent. GPT needs OPENAI_API_KEY in your .env; a local model needs Ollama (ollama pull qwen2.5:3b); and --llm claude-cli, codex-cli or gemini-cli uses your Claude, ChatGPT or Gemini plan through its command-line tool, with no API key. More in docs/agents.md.
📱 On your phone
Check the agents, the market regime and today's signals from your phone while the dashboard runs on your computer. The phone reaches the computer through Tailscale, a free private network for your own devices, so nothing is opened to the internet.
riskaware dashboard # on the computer; open its Phone page, or:
riskaware phone on # let phones in with an access code; prints a QR code to scan
riskaware phone tailscale # an https address only your own devices can open
Install Tailscale on the computer and the phone with the same account, scan the QR code, and add the page to the home screen: it opens full screen with its own icon, like an app. A phone logs in once with the 8-character access code and stays logged in for 180 days; wrong codes are rate-limited, a new code signs every phone out, and the Phone page that shows the code opens only on the computer. Without Tailscale, riskaware dashboard --host 0.0.0.0 works on the same Wi-Fi. More in docs/phone.md.
🔗 MCP server
riskaware mcp serves the agents over the Model Context Protocol, so Claude, Codex, Gemini, Cursor or any MCP client can use them, on your plan and without an API key. riskaware mcp-setup prints (or, with --apply, runs) the one step that connects it:
pip install risk-aware-trading-agents # the MCP server is part of the base install since 0.7.2
riskaware mcp-setup claude-desktop --apply # or: claude-code, codex (your ChatGPT login), gemini, antigravity
Other ways in: in Claude Desktop, download risk-aware-trading-agents-<version>.mcpb from the latest release and open it. A client that starts servers by command can use uvx risk-aware-trading-agents mcp (nothing to install first) or docker run -i --rm ghcr.io/jackson-cmd/risk-aware-trading-agents mcp. The server is listed on the official MCP Registry as io.github.jackson-cmd/risk-aware-trading-agents.
Twenty-one tools: market_regime, scan, analyze_stock, stock_news, list_strategies, backtest, strategy_guide, backtest_code, agents_leaderboard, agent_detail, agent_decisions, agents_create and agents_run, and for research research_guide, market_day, run_experiment, list_experiments, experiment_report, trading_session_start, trading_session_step and trading_session_status. They are read-only or act on local paper accounts; no tool can send an order to a broker. Then just ask, for example "What regime is the market in, and what is coming up this week?" or "Backtest the wheel on megacap with $1M since 2018." ChatGPT itself only connects to remote servers, so on the OpenAI side use Codex, which runs on your ChatGPT login. More in docs/agents.md.
🧪 Strategy lab
Describe a strategy in plain words and let the AI build it. Over MCP, Claude, Codex or Gemini read strategy_guide, write the strategy as a Python class and run it with backtest_code. Before the code runs, the lab refuses dates and stock tickers written into it (both let a backtest know the future), files, network and private attributes. Then it backtests the code in a separate process with no API keys and a time limit, and returns the metrics next to SPY and buy-and-hold, or the lines to fix.
Write a strategy that buys two-day pullbacks in uptrends when the recent news is positive, and sells after 10 days or at +8%. Backtest it on the tech list for 2026 with news.
save_as keeps a strategy that works: it then shows up on the dashboard and can run as a paper agent. For code from anywhere else, riskaware lab my_strategy.py --preset tech does the same checks and backtest. More in docs/strategy-lab.md.
🏆 LLM trading agent leaderboard
rta-bench-1 ranks LLMs as trading agents on the same game: the 56 large caps, after every fifth close, through 2026 to date, the 2022 bear market and the 2020 crash, each played blind and with real names, on news replayed by the minute it was published and with realistic fill costs. A model's training cutoff decides which scores count: periods after the cutoff are ranked, periods it may remember are listed apart. For each model the board shows how it made its money (market and style exposure against stock picking, sectors, holding periods, trades set off by news) and a memory score, next to the five rule strategies, SPY and the equal-weight list. An entry is one JSON file with the model's replies, so anyone can replay it without calling the model; to add a model, run riskaware research submit and open a pull request. More in docs/leaderboard.md.
🔬 Research kit
Three very different years ship with the package, frozen, for experiments that anyone can repeat: 2026 to date (a rising market), 2022 (the rate-hike bear market: SPY -18.2%) and 2020 (the COVID crash: SPY -34% in 23 days, then a new high). Each has daily prices for the 64 stocks and 25 ETFs from two years before it, the VIX term structure, and every indicator and regime reading the agents use, each as it was known at that day's close. The results were also made with that year's headlines, which are licensed and not distributed (below).
| Period | Test window | Headlines behind the results (not distributed) |
|---|---|---|
2026 (default) |
2026-01-02 to 2026-11-11 | 16,945 headlines and SEC 8-K filings |
2022 |
the whole year | 29,300 headlines |
2020 |
the whole year | 19,618 headlines |
The headlines are licensed, so they are not distributed: the conclusions and numbers here were made with them, and each period's manifest keeps the SHA-256 of its headline file, so whoever has a copy can check it is the same data (riskaware research data). To replay news yourself, build an archive under the same rules from the free SEC 8-K filings, a news API key of your own or any CSV (how). The prices of the three periods are also on Hugging Face, as Parquet with a data viewer and the original files.
riskaware research day 2026-04-08 --symbols NVDA,TSLA # everything known at that close
riskaware research run --strategy swing_trend --split 2026-07-01
riskaware research run --strategy swing_trend --period 2022 # the bear market
riskaware research trade --llm ollama:qwen2.5:3b --universe core --blind --period 2020
- Point in time. Signals at the close, orders at the next open: swing trading on daily bars. A headline counts only after it was published, and indicators only look back.
- A look-ahead check on every run. The run is repeated with every price and headline after three cut days replaced by random ones, and the decisions before each cut must not change. For an LLM it replays the model's replies and checks that what the model was shown before each cut did not change, so the model is not asked twice.
- A record for papers. Each run saves its data hashes, code, settings, metrics, bootstrap intervals, trades and every decision.
- Made for LLMs. Over MCP, describe a strategy and Claude writes and tests it (
run_experiment), looks at any day (market_day), or trades a period step by step (trading_session_start), blind if you like: no tickers, company names or dates.
Five common swing strategies on the 56 megacaps, at most 10 equal positions; return without news / with news:
| Strategy | 2026 (to Nov 11) | 2022 | 2020 |
|---|---|---|---|
| Trend following (EMA20 / EMA50 cross) | +21.1% / +19.6% | -6.0% / -5.0% | +36.6% / +68.4% |
| Post-news drift (without news: the same trade on a price jump) | +15.7% / +4.4% | -13.3% / -14.1% | +9.4% / +28.4% |
| Connors RSI(2) | +12.7% / +10.8% | -2.2% / -5.7% | +14.0% / +12.7% |
| Pullback in an uptrend | +2.3% / +1.7% | -4.7% / -4.0% | +2.3% / +3.3% |
| 20-day breakout | -0.3% / -3.5% | -12.8% / -13.7% | +33.1% / +30.4% |
| SPY buy and hold | +12.1% | -18.6% | +17.2% |
| Equal weight, the same 56 stocks | +11.4% | -12.4% | +40.1% |
No rule wins every year. Trend following led in the two rising years; in 2022 every strategy lost money, all of them less than SPY, and the pullback rule lost least. The news filter cut returns in 2026 and seemed to help in 2020, but the 2020 gain is one position: with news, a free slot let trend following buy Tesla in April 2020 and hold it to the end of the year. The equal-weight row shows the survivorship bias of today's large caps, largest in 2020. Every interval overlaps, and every run passed the look-ahead check. Definitions, the full tables with 95% intervals, and advice for papers in docs/research.md.
📊 Backtest
Built-in strategy, balanced profile, the 55-stock megacap list, $100k, signals at the close and fills the next day, 5 bps slippage, January 2018 to November 2026:
| risk_aware | SPY buy & hold | |
|---|---|---|
| CAGR | 10.4% | 14.1% |
| Volatility | 9.3% | 19.0% |
| Sharpe | 0.84 | 0.66 |
| Max drawdown | -18.2% | -33.7% |
| Worst calendar year | -3.7% | -18.2% |
| Average stocks / cash + T-bills | 57% / 39% | 100% / 0% |
Read it honestly: in a long bull market the agent earns less than the index because it keeps at least 30% in cash, and it loses roughly half as much when markets fall. The list is today's large caps, so it carries survivorship bias; these numbers use neither news nor fundamentals (2026 with news is below), and past results do not predict future ones. Reproduce it with riskaware backtest --compare buy_and_hold.
riskaware backtest --strategy risk_aware --compare buy_and_hold,ema_bounce,rsi2 --start 2018-01-01 --open
riskaware backtest --preset etf --profile conservative
riskaware backtest --symbols AAPL,MSFT,NVDA,COST --cash 25000
riskaware backtest --synthetic # offline demo, no download
Every run writes a self-contained HTML report (metrics, equity and drawdown charts with regime shading, monthly returns, every trade with its reason) plus CSV files.
2026 so far, with news
The same agent and settings on 2026, from January 2 to November 11, now reading the 2026 news: 15,542 headlines and 605 SEC filings for these 56 stocks (licensed, not distributed with the package), each day only what was out before its close.
| January 2 – November 11, 2026 | risk_aware + news | risk_aware, no news | SPY buy & hold |
|---|---|---|---|
| Return | +15.9% | +15.4% | +12.1% |
| Volatility | 8.2% | 7.8% | 14.0% |
| Sharpe | 1.70 | 1.73 | 0.77 |
| Max drawdown | -5.3% | -5.3% | -8.9% |
| Average stocks / cash + T-bills | 60% / 35% | 61% / 34% | 100% / 0% |
The agent beat SPY by 3.8 points while holding stocks with 60% of its money on average, and its worst drop was 60% of SPY's: in the March sell-off it fell 5.3% while SPY fell 8.9%. News added half a point of return this year. Ten months is a short test, so the 2018–2026 table above is still the better guide. Reproduce it with riskaware backtest --preset megacap --start 2026-01-02 --end 2026-11-11 --news and a copy of the 2026 headline file in ~/.riskaware/data/news; with an archive of your own the rules are the same and the numbers will differ.
News in backtests
A backtest may only use news it would have seen on that day, so it needs each item's publication time. The results in this README were made with headlines for 2020, 2022 and 2026 for the 64 stocks of the built-in lists: 19,618, 29,300 and 16,945 items (headlines, titles only; for 2026 also SEC 8-K filings, January 1 to November 11). They are licensed, so the package does not distribute them; the manifests keep their SHA-256. riskaware news-history keeps an archive on your own machine (~/.riskaware/news, never in the repository): SEC 8-K filings for free, headlines from a news API with your own key, or any CSV. --news replays it through the same clustering and two-source check used in live trading. Each day sees only items published before its close (16:00 New York, 13:00 on early-close days), and orders fill the next day.
riskaware news-history build --preset core --contact-email you@example.com # SEC 8-K filings since 2018
riskaware news-history import my_news.csv --tz America/New_York # timestamp, symbol, headline[, source, url, sentiment]
riskaware news-history status
riskaware news-history show NVDA --date 2024-05-22 # what the backtest saw at that close
riskaware backtest --strategy examples/strategies/news_earnings_drift.py --preset core --news --compare buy_and_hold
| Source | What goes into the archive | Cost |
|---|---|---|
| SEC EDGAR | every 8-K (earnings, officer changes, deals, impairments, restatements) with SEC's acceptance time | free; SEC asks for a contact email |
| A news API | headlines with your own key (sources) | your plan |
| CSV | any news you have the right to use | , |
The core preset is SPY, QQQ, AAPL, MSFT, NVDA, AMZN, GOOGL, META and TSLA. SPY and QQQ are funds, not companies, so the SEC archive has little or nothing for them; the FOMC, CPI and jobs calendar already drives the regime in every backtest. A news API counts as one publisher, so a story from it alone stays single-source until an SEC filing or a second publisher backs it. What you download or import stays on your machine. Details: docs/news-history.md.