Skip to main content
Partially verified. As of v0.8.8+, the Alpaca client has been byte-for-byte audited against alpaca-py. Several critical bugs were fixed:
  • Fill polling now uses /v2/account/activities/FILL instead of the invalid /v2/orders?status=filled query (which was silently returning zero fills). Each execution now arrives as its own dedup’d record, so partial fills are no longer lost.
  • client_order_id is generated per submit so retries on network errors are idempotent (no risk of duplicate orders).
  • Limit-price formatter no longer rounds to 2 decimal places — sub-dollar stocks and crypto pairs trade at their native tick size.
  • Day time-in-force is now supported (required for equity options).
  • Short positions parse with their signed quantity preserved.
These fixes have not been live-tested against a real Alpaca account. Polymarket remains the only exchange with end-to-end verified live trading. Use small size first.
Alpaca Markets is a commission-free stock trading API. Horizon supports Alpaca as a first-class exchange for equity trading, stock/ETF hedging, and multi-asset strategies.

Quick Setup

Standalone Equity Trading

Credentials

Paper vs Live

Test with paper=True before switching to live. Paper mode uses the same API with simulated fills, so your strategy logic runs the same way.

Alpaca Configuration

Authentication

Alpaca uses header-based auth. No token refresh needed.
  • APCA-API-KEY-ID: {api_key}
  • APCA-API-SECRET-KEY: {api_secret}
Both headers are sent on every request.

Market Data Feed

Stock quotes via WebSocket:
The feed connects to wss://stream.data.alpaca.markets/v2/{source} and subscribes to both trades and quotes for each symbol. Each symbol gets its own snapshot entry keyed by {feed_name}:{SYMBOL} (e.g., tlt:TLT), plus a feed-level entry under the feed name with the last update across all symbols.

Symbol Mapping

Alpaca uses standard stock tickers. No token ID resolution needed:
Alpaca uses Side.Long for all positions. Prediction market concepts like Side.Yes / Side.No do not apply to stock orders.

Fill Polling

Alpaca fills are polled from the GET /v2/orders?status=filled endpoint. Each cycle:
  1. Queries recently filled orders
  2. Deduplicates against previously seen fill IDs (FIFO eviction at 10k)
  3. Maps Alpaca’s response to Horizon Fill objects with exchange-assigned timestamps

Multi-Exchange Hedging

Use Alpaca alongside Polymarket or Kalshi for hedged strategies:
The first exchange (Polymarket) becomes the primary. Orders are routed based on market.exchange.

Feature Support Matrix

Getting API Keys

  1. Sign up at alpaca.markets
  2. Go to Paper Trading > API Keys
  3. Generate a new key pair
  4. For live trading, switch to Live Trading and generate live keys
See Stock Market Hedging for the full hedging guide and Stock Hedge Strategy for a complete worked example.