Agent skill

Alpaca Broker Market Data

by alpacahq in alpacahq/alpaca-skills

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…

Apache-2.0Auto-check passedBusiness, Finance & HR

Install Alpaca Broker Market Data

skills CLI
$ npx skills add alpacahq/alpaca-skills --skill alpaca-broker-market-data -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install alpacahq/alpaca-skills alpaca-broker-market-data --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/alpacahq/alpaca-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/broker-api/market-data .claude/skills/alpaca-broker-market-data && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
alpaca-broker-market-data
GitHub stars
154
Token cost
~2.3k tokens
SKILL.md length
953 words
Files
2
Skills in repo
14
Repo updated
First seen
Licence
Apache-2.0

At a glance

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…

  • Works in 8 steps: Hosts & auth → REST endpoints → Bars — params → …
  • Building charts
  • SKILL.md covers Reference, 0. Hosts & auth, 1. REST endpoints and 2. Bars — params, plus 5 more sections
  • Reaches docs.alpaca.markets and data.alpaca.markets

What it does

Alpaca Broker Market Data is an agent skill from alpacahq/alpaca-skills. 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.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `reference.md`).

It sits in Business, Finance & HR, covering Stock and market analysis and Realtime and WebSockets. It works with Alpaca. The repository describes itself as: Agent skills for Alpaca's Trading API and Broker API: drop-in SKILL.md files for AI coding assistants. The licence is Apache-2.0.

When your agent uses it

  • Building charts
  • Asset metadata on Alpaca in any language

Example prompts

  • “/alpaca-broker-market-data”

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Hosts & auth
  2. REST endpoints
  3. Bars — params
  4. Feeds (entitlement matters)
  5. Object shapes (compact keys)
  6. WebSocket protocol
  7. Assets, clock, calendar
  8. Caching strategy (cost & rate-limit lesson)

What it can do on your machine

Read from SKILL.md and the folder at commit 39111ab. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • docs.alpaca.markets
    • data.alpaca.markets
    • api.alpaca.markets

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Alpaca Broker Market Data loads about 2.3k tokens when it runs. Until then it costs about 88 tokens; SKILL.md has 953 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~88
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from alpacahq/alpaca-skills at commit 39111ab, republished under its Apache-2.0 licence (© alpacahq). 953 words, ~2,298 tokens.

Download SKILL.mdSave it as .claude/skills/alpaca-broker-market-data/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
alpaca-broker-market-data
description
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.

Alpaca Market Data API — Stocks (REST + WebSocket)

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.

Reference

  • Guides: https://docs.alpaca.markets/docs/historical-stock-data, https://docs.alpaca.markets/docs/streaming-market-data
  • Live schema: alpaca-docs MCP → list-endpoints title "Market Data API"

0. Hosts & auth

SurfaceHost
Market data RESThttps://data.alpaca.markets (sandbox data.sandbox.alpaca.markets)
Market data WebSocketwss://stream.data.alpaca.markets/{version}/{feed}
Assets / clock / calendarhttps://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).

1. REST endpoints

PathPurpose
GET /v2/stocks/snapshots?symbols=… · GET /v2/stocks/{symbol}/snapshotSnapshot (latest trade/quote + bars)
GET /v2/stocks/bars?symbols=… · GET /v2/stocks/{symbol}/barsHistorical OHLCV bars
GET /v2/stocks/bars/latest · …/{symbol}/bars/latestLatest bar(s)
GET /v2/stocks/trades[/latest] · GET /v2/stocks/quotes[/latest]Historical / latest trades & quotes
GET /v2/stocks/auctionsOpening/closing auctions
GET /v2/stocks/meta/conditions/{trade|quote} · /meta/exchangesCode lookups
GET /v1beta1/news?symbols=…News (max limit 50)
GET /v1beta1/screener/stocks/most-actives · /screener/{stocks|crypto}/moversScreeners
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:

PathTrading API host (api.alpaca.markets)Broker API host (broker-api.*)
/v1/clock—200
/v2/clock200200
/v1/calendar—200
/v2/calendar200404
/v1/assets—200
/v2/assets200404

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.

2. Bars — params

ParamNotes
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 / endRFC3339 or YYYY-MM-DD, inclusive
limitdefault 1000, max 10000 — counts data points across all symbols, not per symbol
page_tokenpagination cursor (from next_page_token)
adjustmentraw (default), split, dividend, spin-off, all — comma-combinable
feedsee §3
sortasc (default) / desc
asofYYYY-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.

3. Feeds (entitlement matters)

  • 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:

  • Pick 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.)
  • Without real-time access, start/end windows withhold the most recent 15 minutes.
  • Trade/quote sizes are in shares as of 2025-11-03 (were round lots before).

4. Object shapes (compact keys)

Snapshot per symbol: latestTrade, latestQuote, minuteBar, dailyBar, prevDailyBar. Multi-symbol response is a map { "AAPL": {…} }.

  • Bar: t time, o open, h high, l low, c close, v volume, n trade count, vw VWAP.
  • Trade: t time, p price, s size, x exchange, c conditions, z tape, i id.
  • Quote: bp/bs/bx bid price/size/exchange, ap/as/ax ask price/size/exchange, c conditions, z tape. (price 0 = no active bid/ask.)
Show full SKILL.md (431 more words)Show less

5. WebSocket protocol

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:

  1. Connect → [{"T":"success","msg":"connected"}]
  2. Auth within 10s: {"action":"auth","key":"…","secret":"…"} → [{"T":"success","msg":"authenticated"}]
  3. Subscribe: {"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:

  • One concurrent connection per key on most plans — a 2nd connection → {"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).
  • Authenticate within 10s or get dropped (404).
  • Other error codes: 401 not auth'd, 402 auth failed, 405 symbol limit, 407 slow client, 409 insufficient subscription (feed not entitled), 410 invalid action for feed.
  • Messages are batched — always iterate the array; don't assume one frame = one event.
  • Handle u (updated bar) and c/x (corrections/cancels): a streamed bar/trade can be revised after the fact.

6. Assets, clock, calendar

Use the host-appropriate path (see the table in §1): /v2/... on the Trading API host, /v1/... on the Broker API host.

  • Assets (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).
  • Clock (/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.
  • Calendar (/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."

7. Caching strategy (cost & rate-limit lesson)

Market data is the highest-volume, highest-cost surface. Production lesson:

  1. Persist historical bars in your own store keyed by (symbol, timeframe, timestamp) with upsert/skip-duplicate, and serve charts from there — only fetch the gap from Alpaca.
  2. Cache snapshots/quotes in a short-TTL cache (TTL tuned to market-open vs closed).
  3. Run one bulk backfill job for searchable symbols on a schedule rather than fetching per user request.
  4. Always follow 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.

© alpacahq, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/broker-api/market-data of alpacahq/alpaca-skills.

  • SKILL.md
  • reference.md

Open the folder on GitHubat commit 39111ab

Compare with similar skills

Alpaca Broker Market Data next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Alpaca Broker Market Data compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Alpaca Broker Market Data this skillalpacahq/alpaca-skills154—~2.3kAutomated safety check: PassApache-2.0
Alpaca CLIalpacahq/cli178—~2.6kAutomated safety check: PassApache-2.0
Feedsalsk1992/CloddsBot3k—~1.8kAutomated safety check: PassMIT
Binance Datatoollostleaf/binance-datatool148—~2.5kAutomated safety check: NotesBSD-3-Clause
Polymarket2025Emma/vibe-coding-cn23k1 repos~1.6kAutomated safety check: PassMIT
Longbridge Market Datahelsome/folio2711 repos~1.6kAutomated safety check: PassMIT

Similar skills

  • Alpaca CLI

    alpacahq/cli

    Install, configure, and use the Alpaca CLI - a command-line tool for the Alpaca Trading API.

    178 GitHub stars~2.6k tokensUpdated 2 days ago
    Business, Finance & HRAuto-check passed
  • Feeds

    alsk1992/CloddsBot

    Real-time market data feeds from 8 prediction market platforms

    3k GitHub stars~1.8k tokensUpdated 8 days ago
    Business, Finance & HRAuto-check passed
  • Binance Datatool

    lostleaf/binance-datatool

    Manage Binance historical market data from data.binance.vision using the binance-datatool CLI.

    148 GitHub stars~2.5k tokensUpdated 5 mo ago
    Backend & APIsAuto-check: notes
  • Polymarket

    2025Emma/vibe-coding-cn

    Comprehensive Polymarket skill covering prediction markets, API, trading, market data, and real-time WebSocket data streaming.

    23k GitHub starsUsed in 1 repo~1.6k tokens
    Backend & APIsAuto-check passed
  • Real-time quotes, K-line charts, order book, trade ticks, intraday capital flow, market sentiment temperature, trading session schedule, security lists, exchange rates, and IPO calendar for…

    271 GitHub starsUsed in 1 repo~1.6k tokens
    Business, Finance & HRAuto-check passed
  • Longbridge Market Data

    sickn33/agentic-awesome-skills

    Real-time quotes, K-line charts, order book, trade ticks, intraday capital flow, market sentiment temperature, trading session schedule, security lists, exchange rates, and IPO calendar for…

    47k GitHub starsUsed in 1 repo~1.7k tokens
    Business, Finance & HRAuto-check passed

More from alpacahq/alpaca-skills

All 14 skills in this repo
  • Alpaca Broker Account Onboarding

    alpacahq/alpaca-skills

    Open and manage brokerage accounts via the Alpaca Broker API — account creation, KYC/CIP, identity & disclosures, agreements, document upload (incl.

    154 GitHub stars~2.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Alpaca Broker Funding Transfers

    alpacahq/alpaca-skills

    Move money between an Alpaca brokerage account and the EXTERNAL banking world via the Broker API — ACH relationships, wire recipient banks, classic transfers (deposits/withdrawals), the v1beta…

    154 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Alpaca Broker Integration

    alpacahq/alpaca-skills

    Entry point for integrating with the Alpaca Broker API (plus Market Data and Trading APIs) in any programming language.

    154 GitHub stars~3k tokensUpdated 1 mo ago
    Auto-check passed
  • Alpaca Broker Journals

    alpacahq/alpaca-skills

    Move cash (JNLC) and securities (JNLS) BETWEEN accounts inside your own Alpaca omnibus via the Broker API — single, batch, and reverse-batch journals, the Idempotency-Key header, journal status…

    154 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Alpaca Broker Money Precision

    alpacahq/alpaca-skills

    Handle money and numeric precision correctly with the Alpaca API — numbers-as-strings on the wire, decimals vs floats, rounding/truncation before sending amounts, fractional-share precision, and…

    154 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Make Alpaca API clients resilient — rate-limit header handling, HTTP 429 backoff, exponential retry, bounded concurrency/worker pools, pagination loops, batch sizing, and timeouts.

    154 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Alpaca Broker Market Data

What does Alpaca Broker Market Data do?

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…. Alpaca Broker Market Data is an agent skill from alpacahq/alpaca-skills. 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.

When should I use Alpaca Broker Market Data?

Alpaca Broker Market Data fits situations like: building charts; asset metadata on Alpaca in any language.

How do I install Alpaca Broker Market Data in Claude Code?

Run `npx skills add alpacahq/alpaca-skills --skill alpaca-broker-market-data -a claude-code`. Or copy the skill folder (skills/broker-api/market-data in alpacahq/alpaca-skills) into .claude/skills/alpaca-broker-market-data in your project. Claude Code loads it when a task matches its description.

How do I install Alpaca Broker Market Data in Codex?

Run `npx skills add alpacahq/alpaca-skills --skill alpaca-broker-market-data -a codex`. Or copy the skill folder (skills/broker-api/market-data in alpacahq/alpaca-skills) into .agents/skills/alpaca-broker-market-data in your project. Codex loads it when a task matches its description.

Can I use Alpaca Broker Market Data in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add alpacahq/alpaca-skills --skill alpaca-broker-market-data -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/alpaca-broker-market-data, .gemini/skills/alpaca-broker-market-data, .github/skills/alpaca-broker-market-data and .opencode/skills/alpaca-broker-market-data in your project.

What does Alpaca Broker Market Data need to run?

SKILL.md names no scripts, command-line tools or credentials: Alpaca Broker Market Data is instructions for the agent only.

Does Alpaca Broker Market Data access the network?

SKILL.md names 3 domains. In commands or code: docs.alpaca.markets, data.alpaca.markets and api.alpaca.markets; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Alpaca Broker Market Data safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Alpaca Broker Market Data use?

Alpaca Broker Market Data is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Alpaca Broker Market Data use?

About 2.3k tokens (SKILL.md is roughly 9.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Alpaca Broker Market Data?

Skills that share tags, products or a category with Alpaca Broker Market Data: Alpaca CLI (alpacahq/cli, 178 stars), Feeds (alsk1992/CloddsBot, 3k stars), Binance Datatool (lostleaf/binance-datatool, 148 stars) and Polymarket (2025Emma/vibe-coding-cn, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Alpaca Broker Market Data?

alpacahq (a GitHub organization) maintains it in alpacahq/alpaca-skills, which has 154 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on September 8, 2026.

Source: alpacahq/alpaca-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.