alpaca-broker

Implements Alpaca Broker API workflows for account opening, funding, trading, and SSE events.

1|2|Updated Nov 25, 2017
One-click install
npx skills add https://github.com/asarchami/dotfiles --skill alpaca-broker-asarchami
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: alpaca-broker
Source: https://github.com/asarchami/dotfiles/tree/main/dot_config/opencode/skills/alpaca/broker
Command: npx skills add https://github.com/asarchami/dotfiles --skill alpaca-broker-asarchami

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building a brokerage platform requires handling complex backend operations like KYC-compliant account opening, funding orchestration, and real-time event processing. This Skill provides the operational knowledge to integrate the Alpaca Broker API correctly, covering OAuth2 client credentials authentication, rate limits, sandbox testing, and compliance edge cases. ## Core Features & Use Cases - Account Management & KYC: Create and manage end-user brokerage accounts with KYC/KYB data, handle account statuses from SUBMITTED to ACTIVE, and support domestic, international, and IRA accounts. - Funding & Trading: Orchestrate ACH transfers, journals, crypto wallets, and per-account trading configurations with multi-account order routing. - Real-Time SSE Events: Process trade updates, funding status, journal status, and account status events via server-sent events with pagination support. - Use Case: A fintech engineer building a trading app uses this Skill to implement the full account opening flow in the sandbox environment, test KYC validation with pre-flight checks, then wire up SSE event listeners for funding status before going live. ## Quick Start Ask the assistant to create a sandbox brokerage account with test KYC data using the Alpaca Broker API and show the OAuth2 token flow.

Frequently Asked Questions about alpaca-broker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I authenticate with the Alpaca Broker API?

The Broker API uses OAuth2 client credentials, not legacy API key headers. POST your client_id and client_secret to the authx token endpoint with grant_type client_credentials. Tokens are valid for 15 minutes, so cache and reuse them rather than requesting a new token per call.

How do I create a brokerage account with KYC using Alpaca?

POST to /v1/accounts with contact, identity, disclosures, and agreements objects containing the KYC data. Accounts move through statuses like SUBMITTED, APPROVED, ONBOARDING, and ACTIVE. Use the sandbox environment with test KYC values from the Data Validations documentation.

What is the difference between Alpaca Broker API sandbox and live environments?

The sandbox uses broker-api.sandbox.alpaca.markets and authx.sandbox.alpaca.markets, while live uses broker-api.alpaca.markets and authx.alpaca.markets. Sandbox supports the full account creation flow with test KYC data, pre-funded test accounts, and data reset via the dashboard.

Does the Alpaca Broker API support real-time event streaming?

Yes, it provides SSE endpoints for trades, account activities, journal status, funding status, system events, account status, and IPO lifecycle events. Handle comment lines starting with colons for slow-client warnings, and use since_id and until_id parameters for historical replay.

What are the Alpaca Broker API rate limits?

The standard limit is 1,000 requests per minute, with higher tiers available at 3,000, 5,000, and 10,000 RPM. When you receive a 429 Too Many Requests response, respect the Retry-After header before retrying.

Why does account creation return a 422 error on the Broker API?

A 422 status indicates KYC data validation failure, meaning the submitted identity or contact information failed checks. Use pre-flight data validations before submission and verify your test data against the sandbox-compatible values in the Data Validations documentation.