Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Pull and stream US stock market data from Alpaca — REST snapshots/bars/trades/quotes, historical bars with timeframes and feeds (IEX vs SIP), the assets master list, market clock & calendar, news, and the real-time WebSocket stream. Use when building charts, quotes, price feeds, or asset metadata on Alpaca in any language.
.claude/skills/alpacahq-alpaca-broker-market-data/SKILL.md| Model | Eval pass | Runs |
|---|---|---|
| gemini-3.6-flash | 100% | 10 |
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-16 | ✗→✓ | ▲ Improved | 63% | 0% |
| case-21 | ✗→✓ | ▲ Improved | 85% | 0% |
| case-13 | ✓→✓ | = Same ✓ | 99% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 135% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 178% | 0% |
Real-time and historical US equity data. Unlike the Broker endpoints, market data lives on its own host with its own auth, and the real-time feed is WebSocket, not SSE.
> Read alpaca-broker-integration first. Assets/clock/calendar live on the Trading API host; everything else here is the Market Data API host.
https://docs.alpaca.markets/docs/historical-stock-data, https://docs.alpaca.markets/docs/streaming-market-dataalpaca-docs MCP → list-endpoints title "Market Data API"| Surface | Host | |---------|------| | Market data REST | https://data.alpaca.markets (sandbox data.sandbox.alpaca.markets) | | Market data WebSocket | wss://stream.data.alpaca.markets/{version}/{feed} | | Assets / clock / calendar | https://api.alpaca.markets (Trading API) — paper: paper-api.alpaca.markets |
Auth: headers APCA-API-KEY-ID / APCA-API-SECRET-KEY (Broker partners may use Broker Basic auth in broker context).
| Path | Purpose | |------|---------| | GET /v2/stocks/snapshots?symbols=… · GET /v2/stocks/{symbol}/snapshot | Snapshot (latest trade/quote + bars) | | GET /v2/stocks/bars?symbols=… · GET /v2/stocks/{symbol}/bars | Historical OHLCV bars | | GET /v2/stocks/bars/latest · …/{symbol}/bars/latest | Latest bar(s) | | GET /v2/stocks/trades[/latest] · GET /v2/stocks/quotes[/latest] | Historical / latest trades & quotes | | GET /v2/stocks/auctions | Opening/closing auctions | | GET /v2/stocks/meta/conditions/{trade\|quote} · /meta/exchanges | Code lookups | | GET /v1beta1/news?symbols=… | News (max limit 50) | | GET /v1beta1/screener/stocks/most-actives · /screener/{stocks\|crypto}/movers | Screeners | | GET /v2/assets (Trading API host) · GET /v1/assets (Broker API host) | Asset master / tradability | | GET /v2/clock · GET /v2/calendar (Trading API host) | Market hours |
> Clock/calendar/assets paths are host-dependent — verified live against the sandbox: > > | Path | Trading API host (api.alpaca.markets) | Broker API host (broker-api.*) | > |------|:--:|:--:| > | /v1/clock | — | 200 | > | /v2/clock | 200 | 200 | > | /v1/calendar | — | 200 | > | /v2/calendar | 200 | 404 | > | /v1/assets | — | 200 | > | /v2/assets | 200 | 404 | > > So: on the Trading/Market-Data API host use /v2/clock, /v2/calendar, /v2/assets. On the Broker API host use /v1/clock, /v1/calendar, /v1/assets (/v1/clock and /v2/clock both work there; /v2/calendar and /v2/assets 404). A Broker-API integration hitting /v1/clock is correct, not stale.
| Param | Notes | |-------|-------| | timeframe | [1-59]Min/T, [1-23]Hour/H, 1Day/D, 1Week/W, [1,2,3,4,6,12]Month/M. Case-sensitive. e.g. 1Min, 5Min, 1Hour, 1Day | | start / end | RFC3339 or YYYY-MM-DD, inclusive | | limit | default 1000, max 10000 — counts data points across all symbols, not per symbol | | page_token | pagination cursor (from next_page_token) | | adjustment | raw (default), split, dividend, spin-off, all — comma-combinable | | feed | see §3 | | sort | asc (default) / desc | | asof | YYYY-MM-DD for symbol/name-change mapping; - skips mapping |
Pagination lesson: results are sorted by symbol, then timestamp. A multi-symbol request that hits limit may return only the first symbol(s) — you must follow next_page_token until empty to get them all. Don't assume one page = all symbols.
iex — single exchange (~2.5% of volume). The only feed available without a paid subscription. Good for dev/testing.sip — consolidated, all exchanges (100% volume). Requires a paid data plan.delayed_sip — SIP delayed 15 min (latest/snapshot endpoints).otc, boats (Blue Ocean overnight ATS), overnight (Alpaca-derived, cheaper).Lessons:
iex explicitly if you're on the free tier — some endpoints default to sip, which then 403s without entitlement. (A common surprise: "why is my historical request failing?" → defaulted to SIP.)start/end windows withhold the most recent 15 minutes.Snapshot per symbol: latestTrade, latestQuote, minuteBar, dailyBar, prevDailyBar. Multi-symbol response is a map { "AAPL": {…} }.
t time, o open, h high, l low, c close, v volume, n trade count, vw VWAP.t time, p price, s size, x exchange, c conditions, z tape, i id.bp/bs/bx bid price/size/exchange, ap/as/ax ask price/size/exchange, c conditions, z tape. (price 0 = no active bid/ask.)URL: wss://stream.data.alpaca.markets/{version}/{feed} — e.g. v2/iex, v2/sip, v2/delayed_sip, v1beta1/boats, v1beta1/overnight, or v2/test (always-on, use symbol FAKEPACA).
Connect flow:
[{"T":"success","msg":"connected"}]{"action":"auth","key":"…","secret":"…"} → [{"T":"success","msg":"authenticated"}]{"action":"subscribe","trades":["AAPL"],"quotes":["AMD"],"bars":["*"]} → server echoes full subscription state. * = all symbols. unsubscribe removes.Message types (every message is a JSON array; T discriminates): t trade, q quote, b minute bar, d daily bar, u updated bar, s trading status (halt/resume), l LULD, c correction, x cancel/error, i imbalance; control: success, error, subscription. Subscribing to trades auto-adds corrections + cancelErrors.
WebSocket lessons:
{"code":406,"connection limit exceeded"}. Centralize the stream in one process and fan out to your own clients (don't open a socket per user).404).401 not auth'd, 402 auth failed, 405 symbol limit, 407 slow client, 409 insufficient subscription (feed not entitled), 410 invalid action for feed.u (updated bar) and c/x (corrections/cancels): a streamed bar/trade can be revised after the fact.Use the host-appropriate path (see the table in §1): /v2/... on the Trading API host, /v1/... on the Broker API host.
GET /v2/assets on Trading host · GET /v1/assets and /v1/assets/{symbol} on Broker host) — tradability metadata: tradable, fractionable, marginable, shortable, borrow_status (replaces deprecated easy_to_borrow), status (active/inactive), class (us_equity/us_option/crypto/ipo), exchange, attributes[] (e.g. has_options, overnight_tradable). Filter by status, asset_class, exchange. Cache this — it changes slowly; query it before trading to confirm tradable/fractionable (see alpaca-broker-trading-orders)./v2/clock on Trading host · /v1/clock on Broker host) — is_open, next_open, next_close, timestamp. Use this to gate market-hours logic instead of hardcoding 9:30–16:00 ET./v2/calendar on Trading host · /v1/calendar on Broker host — note there is no /v2/calendar on the Broker host) — per-day open/close (HH:MM), session_open/session_close (HHMM, extended hours), settlement_date. Use the calendar for holidays — a naive "weekdays only" check runs jobs on market holidays (harmless but wasteful) and miscomputes "previous trading day."Market data is the highest-volume, highest-cost surface. Production lesson:
(symbol, timeframe, timestamp) with upsert/skip-duplicate, and serve charts from there — only fetch the gap from Alpaca.next_page_token and watch X-RateLimit-Remaining (see alpaca-broker-rate-limits-resilience).Related skills: tradability before ordering → alpaca-broker-trading-orders; rate limits/pagination → alpaca-broker-rate-limits-resilience; the broker event stream (SSE, different from this WS) → alpaca-broker-sse-events.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-13 | pass→pass | 8,348 | 2,004 | -76% | 1 | 1 | 0% | 1,599 | 3,187 | +99% | 0 | 0 | — |
case-01 | pass→pass | 7,863 | 4,573 | -42% | 1 | 1 | 0% | 1,608 | 3,779 | +135% | 0 | 0 | — |
case-02 | pass→pass | 6,325 | 4,098 | -35% | 1 | 1 | 0% | 1,290 | 3,581 | +178% | 0 | 0 | — |
case-03 | pass→pass | 3,761 | 2,706 | -28% | 1 | 1 | 0% | 736 | 3,404 | +363% | 0 | 0 | — |
case-04 | pass→pass | 10,814 | 6,499 | -40% | 1 | 1 | 0% | 2,128 | 4,240 | +99% | 0 | 0 | — |
case-18 | pass→pass | 2,781 | 1,658 | -40% | 1 | 1 | 0% | 325 | 3,109 | +857% | 0 | 0 | — |
case-05 | pass→pass | 5,646 | 1,803 | -68% | 1 | 1 | 0% | 1,042 | 3,184 | +206% | 0 | 0 | — |
case-06 | pass→pass | 12,218 | 7,557 | -38% | 1 | 1 | 0% | 2,183 | 4,249 | +95% | 0 | 0 | — |
case-07 | pass→pass | 4,819 | 1,801 | -63% | 1 | 1 | 0% | 915 | 3,127 | +242% | 0 | 0 | — |
case-08 | pass→pass | 6,769 | 3,303 | -51% | 1 | 1 | 0% | 1,320 | 3,485 | +164% | 0 | 0 | — |
case-09 | pass→pass | 4,869 | 3,104 | -36% | 1 | 1 | 0% | 929 | 3,428 | +269% | 0 | 0 | — |
case-10 | pass→pass | 2,944 | 1,863 | -37% | 1 | 1 | 0% | 556 | 3,160 | +468% | 0 | 0 | — |
case-11 | pass→pass | 2,727 | 1,990 | -27% | 1 | 1 | 0% | 501 | 3,101 | +519% | 0 | 0 | — |
case-12 | pass→pass | 3,952 | 2,010 | -49% | 1 | 1 | 0% | 652 | 3,251 | +399% | 0 | 0 | — |
case-14 | pass→pass | 10,564 | 5,351 | -49% | 1 | 1 | 0% | 1,906 | 3,773 | +98% | 0 | 0 | — |
case-15 | pass→pass | 3,851 | 1,739 | -55% | 1 | 1 | 0% | 562 | 3,099 | +451% | 0 | 0 | — |
case-16 | fail→pass | 9,682 | 1,882 | -81% | 1 | 1 | 0% | 1,969 | 3,214 | +63% | 0 | 0 | — |
case-17 | pass→pass | 3,775 | 2,650 | -30% | 1 | 1 | 0% | 747 | 3,359 | +350% | 0 | 0 | — |
case-19 | pass→pass | 3,322 | 2,800 | -16% | 1 | 1 | 0% | 660 | 3,401 | +415% | 0 | 0 | — |
case-20 | pass→pass | 3,279 | 2,979 | -9% | 1 | 1 | 0% | 637 | 3,407 | +435% | 0 | 0 | — |
case-21 | fail→pass | 13,568 | 15,770 | +16% | 1 | 1 | 0% | 2,898 | 5,362 | +85% | 0 | 0 | — |
case-22 | pass→pass | 15,976 | 11,092 | -31% | 1 | 1 | 0% | 2,603 | 5,027 | +93% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.