alpaca-broker-rate-limits-resilience
Make Alpaca API clients resilient — rate-limit header handling, HTTP 429 backoff, exponential retry, bounded concurrency/worker pools, pagination loops, batch sizing, and timeouts. Use when building robust REST clients, bulk/cron jobs, or reconciliation sweeps against Alpaca in any language.
npx skills add alpacahq/alpaca-skills --skill rate-limits-resilience --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Alpaca — Rate Limits & Resilience Alpaca's APIs are rate-limited and occasionally flaky under load. Any client that does more than a handful of calls — especially bulk jobs, backfills, and reconciliation sweeps — needs disciplined retry, backoff, and concurrency control. These patterns are transport-level and apply in any language. > Read `alpaca-broker-integration` first. ## 1. Rate-limit headers — read them on every response Alpaca returns standard headers: | Header | Meaning | |--------|---------| | `X-RateLimit-Limit` | requests allowed in the window | | `X-RateLimit-Remaining` | requests left in the current window | | `X-RateLimit-Reset` | **unix timestamp (seconds)** when the window resets | **Parse them on every response, not just on errors.** Two uses: - **Proactive:** when `Remaining` drops below a threshold (e.g. ≤ 50), log a warning and/or slow down — you're about to get throttled. - **Reactive:** on `429`, use `Reset` to wait exactly until the window opens. > Limits vary by endpoint and plan; market-data limits differ from broker limits. Don't hardcode a number — react to the headers. ## 2. The retry loop (pseudocode) ``` MAX_ATTEMPTS = 10 INITIAL_DELAY_MS = 1000 for
- 1. Rate-limit headers — read them on every response
- 2. The retry loop (pseudocode)
- 3. Bounded concurrency
- 4. Pagination loops
- 5. Timeouts & batch sizing
- 6. Resilience checklist for a bulk/cron job
What does the alpaca-broker-rate-limits-resilience skill do?
Make Alpaca API clients resilient — rate-limit header handling, HTTP 429 backoff, exponential retry, bounded concurrency/worker pools, pagination loops, batch sizing, and timeouts. Use when building robust REST clients, bulk/cron jobs, or reconciliation sweeps against Alpaca in any language.
How do I install it?
Run `npx skills add alpacahq/alpaca-skills --skill rate-limits-resilience --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From alpacahq/alpaca-skills, a repository with 106 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
