Alpaca Trading
Trade stocks, ETFs, options, and crypto via Alpaca's REST API using curl. Full options support (buy/sell calls & puts, covered calls, cash-secured puts, spre...
Trade stocks, ETFs, options, and crypto via Alpaca's REST API using curl. Full options support (buy/sell calls & puts, covered calls, cash-secured puts, spre...
Real data. Real impact.
Emerging
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
Trade and manage portfolios via Alpaca's REST API using
scripts/alpaca.sh.
| Variable | Purpose |
|---|---|
| Alpaca API key |
| Alpaca API secret |
| Variable | Default | Purpose |
|---|---|---|
| | Trading endpoint. Set to for live |
| | Market data endpoint |
Paper trading is the default. Always confirm with the user before switching to live.
Source
scripts/alpaca.sh from this skill directory. Usage:
alpaca METHOD PATH [JSON_BODY] # Market data: ALPACA_DATA=1 alpaca METHOD PATH
alpaca GET /v2/account # balance, equity, buying power alpaca GET /v2/account/configurations # trading config alpaca GET '/v2/account/portfolio/history?period=1M&timeframe=1D' # portfolio chart alpaca GET '/v2/account/activities?activity_types=FILL,DIV' # trade/dividend history alpaca GET /v2/clock # market open/closed alpaca GET '/v2/calendar?start=2026-03-01&end=2026-03-31' # trading days
# Market buy (by qty or dollar amount) alpaca POST /v2/orders '{"symbol":"AAPL","qty":"10","side":"buy","type":"market","time_in_force":"day"}' alpaca POST /v2/orders '{"symbol":"AAPL","notional":"1000","side":"buy","type":"market","time_in_force":"day"}'Crypto (24/7)
alpaca POST /v2/orders '{"symbol":"BTC/USD","qty":"0.001","side":"buy","type":"market","time_in_force":"gtc"}'
Limit / stop / stop-limit / trailing stop / bracket / OTO / OCO — see references/api.md
List / get / replace / cancel
alpaca GET /v2/orders alpaca GET /v2/orders/ORDER_ID alpaca PATCH /v2/orders/ORDER_ID '{"qty":"20","limit_price":"190.00"}' alpaca DELETE /v2/orders/ORDER_ID alpaca DELETE /v2/orders # cancel ALL
# Buy call (Level 2+) alpaca POST /v2/orders '{"symbol":"AAPL260418C00260000","qty":"1","side":"buy","type":"market","time_in_force":"day"}'Sell covered call (Level 1+, must own 100 shares per contract)
alpaca POST /v2/orders '{"symbol":"AAPL260418C00270000","qty":"1","side":"sell","type":"limit","limit_price":"2.00","time_in_force":"day"}'
Buy/sell puts, cash-secured puts, spreads (Level 3) — see references/api.md
Exercise option
alpaca POST /v2/positions/AAPL260418C00260000/exercise
Look up contracts
alpaca GET '/v2/options/contracts?underlying_symbols=AAPL&expiration_date_gte=2026-04-01&type=call&limit=10' alpaca GET /v2/options/contracts/AAPL260418C00260000
alpaca GET /v2/positions # all open alpaca GET '/v2/positions?asset_class=us_option' # options only alpaca GET /v2/positions/AAPL # single equity alpaca GET /v2/positions/NVDA260417C00220000 # single option alpaca DELETE /v2/positions/AAPL # close alpaca DELETE '/v2/positions/AAPL?qty=5' # close partial alpaca DELETE '/v2/positions?cancel_orders=true' # close ALL
ALPACA_DATA=1 alpaca GET /v2/stocks/AAPL/snapshot # quote + trade + bar ALPACA_DATA=1 alpaca GET '/v2/stocks/snapshots?symbols=AAPL,MSFT,GOOGL' # multi-snapshot ALPACA_DATA=1 alpaca GET '/v2/stocks/AAPL/bars?timeframe=1Day&start=2026-03-01&limit=30' ALPACA_DATA=1 alpaca GET /v1beta1/screener/stocks/most-actives ALPACA_DATA=1 alpaca GET '/v1beta1/screener/stocks/movers?top=10' ALPACA_DATA=1 alpaca GET '/v1beta1/news?symbols=AAPL&limit=5'
ALPACA_DATA=1 alpaca GET '/v1beta1/options/snapshots/AAPL?feed=indicative&limit=10' # option chain ALPACA_DATA=1 alpaca GET '/v1beta1/options/bars?symbols=NVDA260417C00220000&timeframe=1Day&limit=10' ALPACA_DATA=1 alpaca GET '/v1beta1/options/quotes/latest?symbols=NVDA260417C00220000' ALPACA_DATA=1 alpaca GET '/v1beta1/options/trades/latest?symbols=NVDA260417C00220000' # feed: indicative (free/delayed) or opra (subscription required)
ALPACA_DATA=1 alpaca GET '/v1beta3/crypto/us/latest/quotes?symbols=BTC/USD' ALPACA_DATA=1 alpaca GET '/v1beta3/crypto/us/bars?symbols=BTC/USD&timeframe=1Day&limit=30' ALPACA_DATA=1 alpaca GET '/v1beta3/crypto/us/snapshots?symbols=BTC/USD,ETH/USD'
ALPACA_DATA=1 alpaca GET '/v1/corporate-actions?symbols=AAPL&types=cash_dividend' # Types: forward_split, reverse_split, cash_dividend, stock_dividend, spin_off, etc.
alpaca GET /v2/assets/AAPL # asset info alpaca GET '/v2/assets?status=active&attributes=has_options' # options-enabled stocks alpaca GET /v2/watchlists # list watchlists alpaca POST /v2/watchlists '{"name":"Tech","symbols":["AAPL","MSFT","GOOGL"]}'
Read
references/api.md for complete endpoint documentation including:
APCA_API_BASE_URL to live without explicit user confirmation.extended_hours: true on limit orders.GET /v2/account before large orders.| Symptom | Fix |
|---|---|
| Check / are set and valid |
| Paper keys on live URL or vice versa; check |
(insufficient qty) | Check buying power, fractional support, or symbol validity |
| Rate limited — wait and retry; Alpaca allows 200 req/min |
| Order rejected outside hours | Add (limit orders only) or wait for market open |
| Script falls back to ; install jq for better output |
No automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.