How it works
A paper account (pretend money, real prices) for gold, silver and seven currency pairs against the dollar. Plain code makes every trading decision. Claude reads the news for the shield and writes reports; it can make the account more careful, never bolder.
Every 15 minutes
- PricesYahoo Finance daily bars for the nine instruments, the ETFs that confirm big moves, and the dollar index. Interest rates from FRED once a day.
- News shieldHeadlines from Google News searches, MarketWatch, the Fed and the ECB; a keyword filter; then claude-opus-5-5 (effort high) rates them into a fixed schema. Code turns ratings into flags or cuts.
- Intraday checksThe kill switch and the drawdown stop on live prices.
Once a day, 16:30 New York time
- Check the dataFresh, plausible prices or no trade.
- Signals and sizesFrom the frozen release v1 (sha256 37cfda125165…). A changed file stops trading.
- Risk gateLimits below.
- OrdersFilled at the current price plus half the spread, commission and slippage. Each order key is unique, so nothing trades twice.
- Reconcile and reportFinancing booked; the same rules re-run as a backtest over the live period; Claude proposes its own weights (shadow account, never traded) and writes the report.
The strategy
- Trend (3, 6, 12 months)liveMean of the signs of the 63, 126, 252-day returns, sized to 5% volatility per instrument.
- Carry, per currencyliveCurrencies with rates above the average long, below short, sized to 2.5% volatility; off while FX volatility is above 1.5x its one-year median.
- Gold/silver ratioshadowWhen the gold/silver ratio is more than 1 standard deviation from its 3-year mean, long the cheap metal and short the other with equal risk.
Risk gate
- Portfolio volatilityAll positions together at most 10% a year, from the covariance of daily returns (EWMA, 120 days).
- Position sizeAt most 1x the account in a metal, 2x in a currency pair; 5x gross.
- DataNo trade on a price that is missing, older than 4 days, or a move over 6 standard deviations (and over 12% for metals, 5% for FX) that its ETF does not confirm. More than 2 bad: no trades at all.
- Daily lossAfter losing 2% in a day, positions may shrink but not grow until the next step.
- DrawdownFrom 10% below the peak, half risk until a new high. At 20%, everything is closed and trading stays off until a person resets it.
- EventsOn FOMC days, US jobs reports and listed central bank meetings: no increases, and costs counted at 3x slippage.
- News shieldSeverity 2+: no increases for the hours given (at most 48). Severity 3 with "reduce": cut to 50%, at most 2x a day per instrument. Mode now: shadow.
- Small changesSkipped when smaller than 0.05 or 10% of the position.
- Kill switch
php bin/kill.php oncloses everything on the next cycle;offresumes.
Positions, costs and carry
Positions are held like spot contracts for difference in USD: price changes settle into cash at each step; each day a long position earns the rate of what it holds and pays the rate of what it is funded in (metals: their lease rate, gold 0.25%, silver 0.5%), minus 0.5% a year. Cash earns the USD rate.
\text{carry}_{\,\text{long } B/Q} = N \cdot (i_B - i_Q - m)\cdot \tfrac{\Delta t}{365}Metals use the COMEX front-month future (GC=F, SI=F) as a stand-in for spot; its roll jumps are about the size of a day's noise. Spreads: XAU 1.5 bp, XAG 4 bp, EURUSD 0.6 bp, USDJPY 0.8 bp, GBPUSD 1 bp, AUDUSD 1 bp, USDCHF 1.2 bp, USDCAD 1.2 bp, NZDUSD 1.6 bp; commission 0.3 bp, slippage 0.5 bp.
What Claude does and does not do
- DoesRates headlines for the shield; writes the daily report; proposes weights for a separate pretend account so the two can be compared.
- Does notPlace, size or approve orders. Its answers are not reproducible and it has read the future of any backtest period, so it stays out of the order path.
- If it failsNo action, an alert, and the engine trades as usual.
What Claude costs
K \approx N_{calls}\left(\frac{T_{in}}{10^6}\,p_{in} + \frac{T_{out}}{10^6}\,p_{out}\right)| Use | Calls a day | Tokens in | Tokens out | A day |
|---|---|---|---|---|
| News shield | 1.0 | 3,642 | 1,643 | $0.05 |
| Total | $0.05 |
Averages so far, at $4 / $20 per million tokens. Budget: $5.00 a day, after which calls stop until tomorrow.
Go / no-go before any real money
- At least 3 months of paper trading (6 preferred)0 trading days so far, 63 to go
- Live within the backtest's bandShadow backtest starts with the first daily step
- No unexplained data or execution errors for 4 weeksNone open
- Drawdown within the limitWorst 0.0% (limit 10%)
- Costs realistic$0 paid in spreads, commission and slippage; check against a broker's statement before relying on it
- Criteria fixed in advance, not adjusted afterwardsListed in src/metrics.php; strategy Trend and carry (v1) frozen in releases/v1.json
- The same strategy for the whole test (a switch restarts the 3 months)No switch since the account started
Fixed in advance. Meeting them is a reason to look closer, not a decision; that stays with a person.