mcpField
A
alpaca

alpaca

github.com/starchild-ai-agentOther2971 installsUpdated 1w ago
Repository

About alpaca

alpaca is a command-line skill for checking accounts, market data, positions, and orders through Alpaca’s REST API. It supports separate paper and live profiles, with an explicit confirmation gate for live orders.

Key features

  1. 01Paper and live account profiles
  2. 02Account and position checks
  3. 03Quotes and historical data
  4. 04Market and limit orders
  5. 05JSON command output

Use cases

  1. 01Reviewing account status and holdings
  2. 02Checking a symbol quote or history
  3. 03Placing paper trades
  4. 04Submitting live orders with confirmation

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/starchild-ai-agent/official-skills --skill alpaca

After installing, type/alpacain Claude Code to confirm it loaded.

Bundled files_trade_report.pyscripts/alpaca_cli.py

Details

From the project README

What this is

☁️ Cloud broker — Alpaca exposes a public REST API, so this runs directly in the Starchild container, no local gateway needed. US equities and ETFs.

Paper and live are fully separated: different key pairs, different hosts (paper-api.alpaca.markets vs api.alpaca.markets). A paper key physically cannot touch the live account. Live order placement additionally requires the --confirm-live flag.

Get your API keys

  1. Sign up at alpaca.markets (US brokerage; paper trading is free and needs no funding).
  2. Paper keys: log in → switch to Paper Trading (toggle top-left) → Home → "API Keys" panel → Generate New Keys. Copy the Key ID and Secret Key (secret shown once).
  3. Live keys (optional, real money): switch to Live Trading → same API Keys panel → generate. These are a different pair from paper.
  4. Market data: the free IEX feed works out of the box. SIP (full-market) needs a paid data subscription.

Configure (.env)

Request via secure input — never paste keys in chat. Variables:

VariableRequiredNotes
ALPACA_API_KEYyes (paper)paper Key ID
ALPACA_SECRET_KEYyes (paper)paper Secret
ALPACA_LIVE_API_KEYonly for livelive Key ID
ALPACA_LIVE_SECRET_KEYonly for livelive Secret
ALPACA_FEEDnoiex (default) or sip

Usage

pip install alpaca-py (first run). All commands print JSON. Default profile is paper.

python skills/alpaca/scripts/alpaca_cli.py status
python skills/alpaca/scripts/alpaca_cli.py account
python skills/alpaca/scripts/alpaca_cli.py positions
python skills/alpaca/scripts/alpaca_cli.py orders [--executions]
python skills/alpaca/scripts/alpaca_cli.py quote --symbol AAPL
python skills/alpaca/scripts/alpaca_cli.py history --symbol AAPL --period 1d --limit 90
# place (paper): qty OR notional, market OR limit
python skills/alpaca/scripts/alpaca_cli.py place --symbol AAPL --side buy --qty 1 --type market
python skills/alpaca/scripts/alpaca_cli.py place --symbol AAPL --side buy --notional 500 --type limit --limit-price 180
python skills/alpaca/scripts/alpaca_cli.py cancel --order-id <id>
# live: must add --profile live AND --confirm-live
python skills/alpaca/scripts/alpaca_cli.py --profile live --confirm-live place --symbol AAPL --side buy --qty 1

Periods: 1m 5m 15m 30m 1h 1d 1w 1M. Alpaca supports fractional --notional (dollar amount) orders.

Gotchas

  • status is the health check — it reports SDK install state, key presence, and pings the account. Run it first.
  • Free IEX data can be sparse/delayed off-hours; use sip only if the account has the paid feed.
  • Live trading is real money. The --confirm-live gate is intentional; never auto-add it.

Comments

Markdown supported