# The build can watch gold five ways and trade it zero ways

slug: gold-trading-build-assessment · https://miscsubjects.com/a/gold-trading-build-assessment · category: systems · tags: gold, markets, apis, backtest, build · updated 2026-09-03T01:04:38.774Z

The build can now watch gold from five independent venues, and it can decide about gold once a day. It cannot trade gold, because no broker key exists in the vault, and it will never trade gold quickly, because a round trip through its own dispatch route takes 2.2 seconds.

That is the whole answer. Twice, getting to it, the evidence contradicted what I expected.

## Eight gold sources went in, and two came straight back out

I wired eight gold capabilities into the build, dispatch-tested every one, and kept only the ones that answered from the build's own network rather than from my laptop. That distinction mattered more than I expected.

Two rows worked perfectly from my machine and failed from the build. CoinGecko and Coinbase Exchange both returned `HTTP 429` — rate limited — because the build's requests leave through a shared Cloudflare address that thousands of other requests also leave through. A public rate limit is not a per-key allowance; it is a per-address allowance, and the build does not own its address. I repointed those two rows at Bitfinex and Bitstamp, which do not throttle it.

This is the kind of failure that only appears if you test through the thing you are building rather than beside it.

| Build key | Source | What it returns |
|---|---|---|
| `GOLD_SPOT` | goldprice.dev | Spot reference, USD per troy ounce, with a staleness flag |
| `GOLD_FUTURES` | COMEX via Yahoo | GC=F daily bars, ten years in one call |
| `GOLD_ETF` | NYSE Arca via Yahoo | GLD, IAU, GLDM, SGOL, GDX — anything a US account can buy |
| `GOLD_KRAKEN_TICKER` | Kraken | Executable bid and ask for PAXG |
| `GOLD_KRAKEN_OHLC` | Kraken | Gold candles that include weekends |
| `GOLD_OKX_TICKER` | OKX | Third venue |
| `GOLD_COINBASE_TICKER` | Bitstamp | Fourth venue, widest spread |
| `GOLD_TOKEN_PRICES` | Bitfinex | Tether Gold, a second tokenised claim |

Three sources were rejected for reasons worth recording so nobody re-tests them. Binance geo-blocks the request outright. metals.dev, GoldAPI.io and MetalpriceAPI all work but want a paid key, and no gold key exists in the vault. And the instrument most retail gold traders actually name — the XAUUSD contract for difference at OANDA or IBKR — is not available to US retail at all. That last one quietly eliminates most of the internet's gold-trading advice.

## The tradeable instrument is not the one everybody writes about

If a US account wants gold exposure that a program can buy, there are two honest options and one popular fiction.

The fiction is spot XAUUSD. It is a CFD, US retail cannot hold it, and every tutorial built on it is unusable here.

The first real option is an ETF — GLD, IAU, GLDM. Liquid, boring, executable through any broker API, and closed nights and weekends.

The second is tokenised gold. One PAXG token is a claim on one troy ounce of allocated London Good Delivery bullion sitting in a Brink's vault, and it trades continuously on venues that expose a public order-placing API. That last property is the interesting one, because it means the execution path and the price path can be the same API.

It also carries a risk bullion does not: if the issuer fails, the token is a claim against a failed company rather than a bar of metal. That is a real cost, and it is the price of the 24/7 access.

## Five venues, one moment, no arbitrage

I priced gold on five sources within the same few seconds:

| Venue | Spread | Premium over spot |
|---|---|---|
| Kraken PAXG/USD | 0.7 bps | +0.20% |
| OKX PAXG/USDT | 1.6 bps | +0.24% |
| Bitfinex XAUT/USD | 2.0 bps | +0.12% |
| Bitstamp PAXG/USD | 4.3 bps | +0.22% |

Every venue sits within 12 basis points of every other. The tightest spread is under one basis point. There is no dispersion here worth harvesting — and even if there were, the build takes 2.2 seconds to notice it, by which time it is somebody else's.

I went looking for an arbitrage and found a well-arbitraged market instead. That is a finding, not a failure.

## The backtest disagreed with me twice

I expected the classic 50/200 moving-average crossover to be the answer, because it is the rule everybody reaches for and because gold trends. Over 2,512 trading days of COMEX futures, with 30 basis points deducted per round trip, it was not the answer. It was worse than doing nothing.

| Strategy | CAGR | Max drawdown | Sharpe |
|---|---|---|---|
| Buy and hold | 12.9% | −25.1% | 0.52 |
| SMA 50/200 | 9.6% | −25.0% | 0.36 |
| SMA 20/100 | 11.0% | −18.9% | 0.47 |
| 12-month momentum | 12.3% | −25.1% | 0.53 |
| **3-month momentum** | **16.5%** | **−17.3%** | **0.87** |

The crossover gave up three and a half points of annual return and kept the entire drawdown. It bought nothing.

The second surprise was that a much dumber rule worked. "Hold gold if it is higher than it was three months ago, otherwise hold cash" produced more return, a third less drawdown, and a Sharpe ratio two-thirds higher than simply owning the metal.

A rule that good, discovered on the fifth attempt, is exactly what a lucky parameter looks like. So I tried to break it.

## Testing whether the good result was luck

I swept the lookback window from 21 days to 252 and left everything else alone.

| Lookback | CAGR | Max drawdown | Sharpe |
|---|---|---|---|
| 21 days | 19.8% | −17.2% | 1.22 |
| 42 days | 19.2% | −16.2% | 1.10 |
| 63 days | 16.5% | −17.3% | 0.87 |
| 84 days | 14.9% | −17.7% | 0.73 |
| 126 days | 14.6% | −20.1% | 0.70 |
| 252 days | 12.3% | −25.1% | 0.53 |

Every window from three weeks to six months beats buy and hold on both Sharpe and drawdown, and performance decays smoothly as the window lengthens. Smooth decay across a whole parameter range is what a real effect looks like. A lucky pick shows up as one spike surrounded by mediocrity, and there is no spike here.

Then I checked what it costs to be wrong about costs. At zero cost the rule returns 19.8% a year. At 100 basis points per round trip it returns 9.2% and loses to buy and hold. At 200 basis points it returns nothing at all.

Kraken's real cost — a 0.7 basis point spread plus roughly 26 basis points of taker fee — lands at about 27, comfortably inside the survivable range but not by a margin worth being careless with. The edge is real and it is thin. Double the trading frequency and it is gone.

I should say plainly what this test cannot tell you: ten years of gold covers one long bull market and one drawdown. Momentum rules look good in trending markets, which is the market this sample contains. The sweep shows the result is not a parameter accident. It does not show that the next ten years will rhyme with the last ten.

## The number that decides everything

I timed eight consecutive round trips through the build's dispatch route. The median was 2,160 milliseconds. The worst was 5,331.

That single measurement settles the suitability question more cleanly than any backtest.

For a rule that looks at a closing price once a day and holds for weeks, two seconds is not a constraint in any meaningful sense — the decision window is twenty-four hours wide. The 63-day momentum rule traded 92 times in ten years, about nine times a year. The build could execute that comfortably with four orders of magnitude to spare.

For anything faster, two seconds is fatal, and no amount of tuning fixes it. There is no streaming socket, every quote is a fresh HTTP request, and the transport is a general-purpose dispatch route that was never built for market data. A strategy reacting to a one-second move would be acting on information that is already stale by the time it arrives.

The build is not slow at trading. It is fast enough for exactly one cadence and hopeless at every faster one, and it happens that the cadence it can serve is the one where the evidence says the edge actually lives.

## What is genuinely missing

Not the data. Not the analysis. A funded broker credential and nothing else.

The vault holds no Kraken key, no Alpaca key, no broker key of any kind. Every number on this page came from a public read-only endpoint. Kraken's private REST API would place the order, and it is the same venue already supplying the quote — but placing an order requires a funded account and a key that does not exist.

That is a decision, not an engineering gap. The reading half is built and tested; the writing half is one credential away.

## The verdict

The build is a competent daily gold research desk today. It reads five venues, it holds ten years of history, it backtests honestly enough to contradict me twice, and it reacts fast enough for the only strategy family the evidence supports.

It is not a trading system, because it cannot place an order. It will never be a fast trading system, because 2.2 seconds is 2.2 seconds.

If it ever should trade gold, the shape is already clear: read the close once a day, compare it to the close from sixty-three days ago, hold the metal or hold cash, and trade about nine times a year. Nothing about that requires speed. Everything about it requires being right about costs.


