# Gold Price Alerts

> Build a gold price alert / monitor / watcher that polls goldprice.dev and fires when a threshold is crossed — staying inside the Free tier's rate limit and quota. Use this whenever the user builds a gold price alert, monitor, watcher, cron job, or "notify me when gold hits X" bot — even if they don't mention rate limits or goldprice.dev. Especially reach for it when they worry about polling frequency, running out of quota, or alerting on a stale/frozen price.

- Skill: `nusantara-ventures/gold-price-alerts` (Agent Skill)
- Install (CLI): `npx skillmds@latest add nusantara-ventures/gold-price-alerts`
- Raw SKILL.md: https://api.skillmd.com/api/skills/nusantara-ventures/gold-price-alerts/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: nusantara-ventures (https://skillmd.com/u/nusantara-ventures)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/nusantara-ventures/gold-price-alerts

---


# goldprice.dev — price alerts (Free-tier friendly)

Poll the spot price, compare to a threshold, notify. Runs on the **Free tier** (free key, no card): 30 req/min, 1,000 req/mo.

## Poll the spot price

```bash
curl -H "Authorization: Bearer ga_live_..." \
  "https://api.goldprice.dev/v1/spot/XAU-USD-SPOT"
```

Response (values are **strings**; `symbol` is the base only):

```json
{"symbol":"XAU","quote_currency":"USD","unit":"troy_ounce","contract_type":"spot","price":"4165.16","bid":"4167.03","ask":"4163.28","is_stale":false,"computed_at":"2026-07-07T13:12:19Z"}
```

Compare `float(price)` to your threshold; notify on crossing. `bid`/`ask` carry the spread if you need it.

## Two rules that keep alerts correct

1. **Respect `is_stale`.** Never fire (or clear) an alert on a row where `is_stale` is `true` — you'd alert on a frozen price. For provenance, add `?include=sources` to see each source's own `is_stale`, `fetched_at`, and `source_timestamp`.
2. **Budget your polls against the quota.** 1,000/mo ≈ one poll every ~43 min if run continuously. Poll only during the hours you care about, cache the last value, and dedupe repeat notifications. Physical ($10) raises this to 20k/mo, Pro ($30) to 100k/mo when you need tight cadence.

## Sketch

```python
import time, httpx
THRESHOLD, last = 3400.0, None
while True:
    r = httpx.get("https://api.goldprice.dev/v1/spot/XAU-USD-SPOT",
                  headers={"Authorization": "Bearer ga_live_..."}).json()
    if not r["is_stale"]:
        price = float(r["price"])
        if last is not None and (last < THRESHOLD <= price or last > THRESHOLD >= price):
            notify(f"gold crossed {THRESHOLD}: {price}")
        last = price
    time.sleep(300)  # 5 min: inside the 30/min rate limit. But continuous
                     # 5-min polling is ~8.6k/mo — over Free's 1k/mo. On Free,
                     # run only during your alert window; ~hourly fits 1k/mo.
```

## Divergence alerts (no key)

Alert when sources disagree — a data-quality signal:

```bash
curl "https://api.goldprice.dev/v1/prices/divergence?threshold=50"
```

Anonymous returns a count; authenticated returns per-symbol detail (tier-filtered). `threshold` is in basis points.

## When to upgrade

Higher poll cadence → Physical/Pro quota. Silver/copper alerts (`XAG`/`HG`) → Pro. Sub-second reaction → Realtime Pro ($80) WebSocket stream instead of polling (see the realtime docs at https://goldprice.dev/docs/stream).

