alpaca-broker-market-data-sh-mxr9tb
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "alpaca-broker-market-data-sh-mxr9tb" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4a7b04fe2e64d96d0fb965eaec8b5d2e4664f5b74a23256ee0305aa8f685a6a8. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/alpaca-broker-market-data-sh-mxr9tb before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Skill dedicated to Alpaca broker market data, used to help an AI Agent efficiently perform tasks related to Alpaca broker market data.
Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference
SkillPi interpretation
- Tasks
- 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.
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: Alpaca券商行情数据
slug: alpaca-broker-market-data
version: 1.0.0
displayName: Alpaca券商行情数据
description: >
Alpaca券商行情数据专用技能,帮助AI Agent高效完成相关任务。
summary: "Alpaca券商行情数据专用技能,帮助AI Agent高效完成相关任务。"
license: MIT
category: 量化交易
framework:
- Claude Code
- Codex
- Hermes Agent
- OpenClaw
- QClaw
- WorkBuddy
platform: multi-platform
homepage: "https://github.com/1991513ccie-png"
repository: "https://github.com/1991513ccie-png"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-integrationfirst. 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-docsMCP →list-endpointstitle"Market Data API"
0. Hosts & auth
| 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).
1. REST endpoints
| 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/clock200 200 /v1/calendar— 200 /v2/calendar200 404 /v1/assets— 200 /v2/assets200 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/clockand/v2/clockboth work there;/v2/calendarand/v2/assets404). A Broker-API integration hitting/v1/clockis correct, not stale.
2. Bars — params
| 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.
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
iexexplicitly if you're on the free tier — some endpoints default tosip, which then 403s without entitlement. (A common surprise: "why is my historical request failing?" → defaulted to SIP.) - Without real-time access,
start/endwindows 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:
ttime,oopen,hhigh,llow,cclose,vvolume,ntrade count,vwVWAP. - Trade:
ttime,pprice,ssize,xexchange,cconditions,ztape,iid. - Quote:
bp/bs/bxbid price/size/exchange,ap/as/axask price/size/exchange,cconditions,ztape. (price0= no active bid/ask.)
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:
- Connect →
[{"T":"success","msg":"connected"}] - Auth within 10s:
{"action":"auth","key":"…","secret":"…"}→[{"T":"success","msg":"authenticated"}] - Subscribe:
{"action":"subscribe","trades":["AAPL"],"quotes":["AMD"],"bars":["*"]}→ server echoes full subscription state.*= all symbols.unsubscriberemoves.
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:
401not auth'd,402auth failed,405symbol limit,407slow client,409insufficient subscription (feed not entitled),410invalid action for feed. - Messages are batched — always iterate the array; don't assume one frame = one event.
- Handle
u(updated bar) andc/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/assetson Trading host ·GET /v1/assetsand/v1/assets/{symbol}on Broker host) — tradability metadata:tradable,fractionable,marginable,shortable,borrow_status(replaces deprecatedeasy_to_borrow),status(active/inactive),class(us_equity/us_option/crypto/ipo),exchange,attributes[](e.g.has_options,overnight_tradable). Filter bystatus,asset_class,exchange. Cache this — it changes slowly; query it before trading to confirmtradable/fractionable(seealpaca-broker-trading-orders). - Clock (
/v2/clockon Trading host ·/v1/clockon 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/calendaron Trading host ·/v1/calendaron Broker host — note there is no/v2/calendaron the Broker host) — per-dayopen/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:
- 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. - Cache snapshots/quotes in a short-TTL cache (TTL tuned to market-open vs closed).
- Run one bulk backfill job for searchable symbols on a schedule rather than fetching per user request.
- Always follow
next_page_tokenand watchX-RateLimit-Remaining(seealpaca-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.
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 Alpaca 券商行情数据的完整 API 文档,对量化交易开发者具有明确实用价值
- 涵盖 REST 和 WebSocket 接口、认证、参数、对象结构、缓存策略等关键信息
Highlights
- 触发词精准完整,明确指向 Alpaca 券商行情数据功能
- 边界清晰,不易与其他 Skill 混淆
Highlights
- 文档结构清晰,分章节详细描述各项功能
- frontmatter 完整,包含必要的元数据信息
Highlights
- 提供了详细的 API 使用说明和最佳实践
- 覆盖了主要异常情况和错误处理建议
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 43
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- api.alpaca.markets
- data.alpaca.markets
- docs.alpaca.markets
- github.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.