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.
### 📱 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](https://tailscale.com/download), a free private network for your own devices, so nothing is opened to the internet.
```bash
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](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:
```bash
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-
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](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`.
```bash
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.
```bash
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](docs/news-history.md#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](docs/news-history.md).
### 📚 Strategy library
Every built-in strategy runs through the same risk manager, so all of them keep the cash floor. Backtest any of them with `riskaware backtest --strategy NAME`; compare several with `--compare a,b,c`.
| Strategy | Type | Idea |
|---|---|---|
| `risk_aware` | stocks (default) | the multi-agent strategy described above |
| `momentum_rotation` | stocks | each month hold the strongest names by 6-month relative strength, above EMA200 |
| `donchian_breakout` | stocks | Turtle-style: 55-day highs on volume, exit on a 20-day low |
| `bollinger_reversion` | stocks | buy closes below the lower Bollinger band in uptrends, sell at the middle band |
| `fear_greed_dca` | stocks / ETFs | buy in steps when fear is high, trim in extreme greed |
| `ema_bounce`, `rsi2`, `golden_cross`, `buy_and_hold` | stocks | simple references and baselines |
| `swing_trend`, `swing_rsi2`, `swing_breakout`, `swing_pullback`, `swing_news` | stocks | five textbook swing strategies with a news switch, the [research kit](#-research-kit)'s baselines |
| `aggressive_calls` | options | buy ~0.6-delta calls 45–60 days out on pullbacks in strong uptrends; +100% take profit, -50% stop |
| `wheel` | options | sell ~0.25-delta cash-secured puts near support; after assignment, sell covered calls above cost |
Backtests from January 2018 to November 2026 on the `megacap` list:
| Strategy | Profile, capital | CAGR | Sharpe | Max drawdown | Worst year |
|---|---|---|---|---|---|
| `wheel` | aggressive, $1M | 14.1% | 1.12 | -21.7% | +5.8% |
| `momentum_rotation` | balanced, $100k | 12.5% | 0.91 | -18.2% | -8.2% |
| `risk_aware` | balanced, $100k | 10.4% | 0.84 | -18.2% | -3.8% |
| `donchian_breakout` | balanced, $100k | 9.8% | 0.86 | -12.6% | -6.7% |
| `aggressive_calls` | aggressive, $100k | 6.7% | 0.30 | -40.3% | -24.7% |
| `bollinger_reversion` | balanced, $100k | 4.5% | 0.58 | -4.4% | +0.8% |
| SPY buy & hold | | 14.1% | 0.66 | -33.7% | -18.2% |
#### Options (backtest only)
Option strategies open long calls or puts, cash-secured puts and covered calls. The risk manager caps the premium in long options (`options_sleeve`: 0% conservative, 3% balanced, 12% aggressive; `options_per_trade`: 0 / 1% / 3%), keeps put collateral out of the 30% cash floor and inside the single-stock cap, and never lets shares that back a written call be sold. Expiring options settle at intrinsic value; written puts are assigned into shares, covered calls are called away.
There is no free archive of historical option quotes, so the backtester prices options with Black-Scholes on a modelled implied volatility (VIX for index ETFs; realized volatility, a 10% volatility premium and a VIX scaling for stocks) and pays half of a 4% bid-ask spread plus $0.65 per contract. The results move with these assumptions: without the 10% volatility premium the wheel drops to a 0.81 Sharpe and `aggressive_calls` ranges from 3% to 15% a year depending on spread and volatility, always with a drawdown near -40%. Treat option backtests as the shape of a strategy, not a forecast. `riskaware run` skips option orders in this version.
Written puts need cash for 100 shares per contract inside the single-stock cap, so the wheel only trades names whose strike × 100 fits (about $10k per name on a $100k aggressive account); test it with `--cash 1000000` or a list of lower-priced names.
### 🧩 Write your own strategy
Write one Python method, and the same strategy object runs in backtests, paper trading and live trading with the same risk engine.
```bash
riskaware new-strategy my_dip # creates my_dip.py from a template
riskaware backtest --strategy my_dip.py --compare risk_aware,buy_and_hold
riskaware run --strategy my_dip.py # paper trade it
```
```python
from riskaware.strategy import Action, Signal, Strategy
class MyDip(Strategy):
name = "my_dip"
default_params = {"rsi_entry": 30, "take_profit": 0.20}
def on_bar(self, ctx):
signals = []
for sym in ctx.universe:
row = ctx.row(sym) # indicators at today's close
if row is None:
continue
pos = ctx.position(sym)
if pos is None and row["close"] > row["ema200"] and row["rsi14"] < self.params["rsi_entry"]:
signals.append(Signal(sym, Action.BUY, strength=0.7, reason="oversold in an uptrend"))
elif pos and pos.gain >= self.params["take_profit"]:
signals.append(Signal(sym, Action.SELL, strength=0.8, fraction=0.5, reason="take profit"))
return signals
```
A strategy only says what it wants and how sure it is; the risk manager decides the size and enforces the cash floor, caps and regime rules, so your strategy inherits the same protection. `ctx.market` has the regime, VIX and upcoming events; `ctx.quality(sym)` and `ctx.news(sym)` give the earnings verdict and the verified news in live runs; `ctx.news` also works in backtests run with `--news`. See [docs/custom-strategies.md](docs/custom-strategies.md). Or describe the strategy and let an AI write it in the [strategy lab](#-strategy-lab).
---
## 📸 Screenshots
Every page of the dashboard (`riskaware dashboard`), in English and 中文. Click a picture to open it full size.