massive-api-patternslisted
Install: claude install-skill rgourley/quant-garage
# massive-api-patterns
The REST foundation. Every skill that calls `api.massive.com` reads these
rules first.
## Auth
API key goes in the `Authorization` header as a bearer token:
```
Authorization: Bearer ${MASSIVE_API_KEY}
```
Query-string auth (`?apiKey=...`) also works but logs the key in URLs.
Use the header.
## Rate limits
- **Free Basic:** 5 requests per minute. Hard cap. 429 if you exceed it.
- **Any paid tier:** unlimited requests per minute. Soft cap at 100
requests per second to avoid throttling.
The skills in this repo declare their rate assumptions in `requires.yml`.
A skill that fans out parallel calls will warn the user if it detects a
free key.
Always handle 429 explicitly: back off with exponential delay, retry
once, then surface the error.
## Pagination
List endpoints return a `next_url` field when more results exist:
```json
{
"results": [...],
"next_url": "https://api.massive.com/v3/reference/tickers?cursor=..."
}
```
Follow `next_url` directly, don't reconstruct it. The cursor is opaque
and includes auth context.
## The best-price fallback chain
Never quote a price from a single field. The v2 snapshot response nests
everything under `ticker`, so all reads start there. Walk this 4-step
chain and stop at the first non-null value:
1. `snapshot.ticker.lastTrade.p` (most recent trade across exchanges)
2. `snapshot.ticker.min.c` (current minute bar close, intraday only)
3. `snapshot.ticker.day.c` (today's session close)
4. `snapshot.ticker