account-onboarding
Open and manage brokerage accounts via the Alpaca Broker API — account creation, KYC/CIP, identity & disclosures, agreements,…
Keep local state correct against the Alpaca Broker API — idempotency keys, ID-keyed upserts, event snapshotting and dedup, polling rails that have no events, windowed reconciliation/heal jobs, status state-machine mapping, and handling eventual consistency and corrections. Use
$ npx -y skills add alpacahq/alpaca-skills --skill reconciliation-idempotency --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/reconciliation-idempotencyContext preview
The summary Claude sees to decide when to auto-load this skill.
Keep local state correct against the Alpaca Broker API — idempotency keys, ID-keyed upserts, event snapshotting and dedup, polling rails that have no events, windowed reconciliation/heal jobs, status state-machine mapping, and handling eventual consistency and corrections. Use
name: alpaca-broker-reconciliation-idempotency description: Keep local state correct against the Alpaca Broker API — idempotency keys, ID-keyed upserts, event snapshotting and dedup, polling rails that have no events, windowed reconciliation/heal jobs, status state-machine mapping, and handling eventual consistency and corrections. Use when designing the data-correctness layer of any Alpaca integration in any language.
This is the skill that separates a demo from production. Alpaca is an **asynchronous, eventually-consistent** system: writes settle later, events can be missed or replayed, some rails emit no events at all, and "executed" can still be reversed. Your job is to make your local database a faithful, self-healing mirror of Alpaca's state.
> Read `alpaca-broker-integration` first for base URLs and auth (client-credentials Bearer token; legacy Basic still works), then `alpaca-broker-sse-events` and the relevant domain skills. This skill is the architecture that ties them together.
> **Treat Alpaca as the source of truth and your DB as a cache that must converge to it.** Every write is a request, not a fact. Every event is a hint, not a guarantee. Correctness comes from *idempotent* processing plus a *reconciliation* loop — never from assuming any single call or event succeeded exactly once.
Layer 1 — Idempotent writes : never create a duplicate when you retry Layer 2 — Idempotent event intake: never double-process a replayed/duplicate event Layer 3 — Reconciliation sweep : re-pull authoritative state and fix any drift
You need all three. Layer 1+2 keep you correct in the happy/retry case; Layer 3 catches everything that still slips through (downtime, bugs, missing events, corrections).
Every money/order write must be safe to retry, because you can't tell a timeout apart from a success.
Events are **at-least-once**: replay cursors, reconnects, and corrections all cause the same event to arrive more than once.
A scheduled job that re-pulls authoritative state from Alpaca and upserts it locally. This is what makes the system **self-healing**.
**Canonical windowed heal (lesson):** 1. Re-read **activities** from the Activity SSE (`GET /v2beta1/events/activities`) with `since`/`until` bounds. Bounded replay is a batch job, not a subscription: the stream ends with a `200` once it reaches `until`, and `since`/`until` filter on business time (`at`). (`GET /v1/accounts/activities` is marked fully replaced, but it is still the only source for activities booked before **2026-02-11**; use it for any window that reaches back past that date.) 2. Page through **journals** (`GET /v1/journals`) and **transfers** for the same window. 3. **Upsert** each into your tables keyed on the Alpaca ID (insert-or-update). Re-running is safe and converges. 4. Bound concurrency (a small worker pool) and respect rate limits (`alpaca-broker-rate-limits-resilience`).
Why a *window* and not just "since last run": it absorbs corrections, late settlements, and any events dropped during a deploy — without rescanning all history every night. Choose a window longer than your longest plausible outage.
Not everything emits SSE. Where there's no event, you **must poll**.
**Lesson:** polling implies latency. Document the expected lag (e.g. "withdrawal status updates within ~1h"
Open agent skills for Alpaca's Trading API and Broker API. Each skill is a SKILL.md file with step-by-step instructions your AI coding assistant follows when you ask it to complete a task, such as running a historical backtest, onboarding Broker API accounts,
Open and manage brokerage accounts via the Alpaca Broker API — account creation, KYC/CIP, identity & disclosures, agreements,…
Move money between an Alpaca brokerage account and the EXTERNAL banking world via the Broker API — ACH relationships, wire…
Entry point for integrating with the Alpaca Broker API (plus Market Data and Trading APIs) in any programming language. Use when…
Move cash (JNLC) and securities (JNLS) BETWEEN accounts inside your own Alpaca omnibus via the Broker API — single, batch, and…
Pull and stream US stock market data from Alpaca — REST snapshots/bars/trades/quotes, historical bars with timeframes and feeds…
Handle money and numeric precision correctly with the Alpaca API — numbers-as-strings on the wire, decimals vs floats,…