agentleFS
RoentekRoentek/Claude_Code_Boilerplate_Framework/.claude/skills/alpaca/SKILL.md

alpaca

Skill4 starsChanged 6 months agoMITView on GitHub

Algorithmic trading, market data, and account management via Alpaca. Pattern: CLI-first (alpaca), then alpaca MCP fallback for structured in-session results. Get free paper keys: alpaca.markets → Paper Trading → API Keys Use MCP tools when you need structured, in-session results without spawning a subprocess — e.g., inside an agent workflow or when chaining results across tool calls. Note: The MCP server (alpaca-mcp-server via uvx) is read-only by default. For order placement and position management, use the CLI.

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use MCP tools when you need structured, in-session results without spawning a subprocess — e.g., inside an agent workflow or when chaining …

    line 85
  2. Distinctive:

    Default mode is PAPER trading — no real money at risk

    line 115

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Alpaca Trading Skill

Algorithmic trading, market data, and account management via Alpaca.

Pattern: CLI-first (alpaca), then alpaca MCP fallback for structured in-session results.

When to Use This Skill

  • Trade stocks, crypto, or options via command line or automation
  • Query live/historical market data (bars, quotes, trades, snapshots)
  • Manage positions, orders, watchlists, wallets
  • Build Trigger.dev automations that interact with markets
  • Paper trading and strategy testing (default mode — no real money)

Authentication

# Option A — OAuth (paper trading only)
alpaca profile login

# Option B — API keys (paper + live)
export ALPACA_API_KEY=PKxxx...
export ALPACA_SECRET_KEY=xxx...
export ALPACA_LIVE_TRADE=true   # omit for paper (default)

# Check
alpaca doctor
alpaca account

Get free paper keys: alpaca.markets → Paper Trading → API Keys

CLI-First Commands

# ── Account ──────────────────────────────────────────────────
alpaca account                         # account info + buying power
alpaca account activities              # recent activity
alpaca portfolio history --period 1M   # portfolio P&L chart data

# ── Orders ───────────────────────────────────────────────────
alpaca order list                      # open orders
alpaca order list --status all         # all orders
alpaca order buy AAPL --qty 1          # market buy 1 share (PAPER by default)
alpaca order sell AAPL --qty 1         # market sell
alpaca order buy AAPL --qty 1 --type limit --limit-price 180
alpaca order cancel --all              # cancel all open orders
alpaca order cancel <order-id>

# ── Positions ────────────────────────────────────────────────
alpaca position list                   # all open positions
alpaca position get AAPL               # single position
alpaca position close AAPL             # close a position
alpaca position close --all            # close everything

# ── Market Data ──────────────────────────────────────────────
alpaca data bars AAPL --timeframe 1Day --start 2024-01-01
alpaca data bars AAPL BTC/USD --timeframe 1Hour --limit 48
alpaca data quote AAPL                 # latest quote
alpaca data trade AAPL                 # latest trade
alpaca data snapshot AAPL MSFT NVDA    # multi-symbol snapshot
alpaca data news --symbols AAPL        # recent news

# ── Screeners ────────────────────────────────────────────────
alpaca data screener movers --type gainers --limit 10
alpaca data screener active --by volume --limit 10

# ── Watchlists ───────────────────────────────────────────────
alpaca watchlist list
alpaca watchlist create MyList
alpaca watchlist add MyList AAPL MSFT

# ── Market Clock / Calendar ──────────────────────────────────
alpaca clock                           # current market status (open/closed)
alpaca calendar --start 2025-01-01 --end 2025-01-31

# ── Output control ───────────────────────────────────────────
alpaca data bars AAPL --output json    # JSON for scripting
alpaca data bars AAPL --output csv     # CSV export
alpaca data bars AAPL | jq '.bars[0]' # pipe to jq

MCP Fallback (alpaca MCP)

Use MCP tools when you need structured, in-session results without spawning a subprocess — e.g., inside an agent workflow or when chaining results across tool calls.

# Available MCP tools (read-only by default in settings.local.json.example):
mcp__alpaca__get_account_info
mcp__alpaca__get_all_positions / get_open_position
mcp__alpaca__get_orders / get_order_by_id
mcp__alpaca__get_stock_bars / get_stock_snapshot
mcp__alpaca__get_stock_latest_quote / get_stock_latest_trade
mcp__alpaca__get_crypto_bars / get_crypto_snapshot
mcp__alpaca__get_option_chain / get_option_contracts
mcp__alpaca__get_market_movers / get_most_active_stocks
mcp__alpaca__get_clock / get_calendar
mcp__alpaca__get_watchlists

Note: The MCP server (alpaca-mcp-server via uvx) is read-only by default. For order placement and position management, use the CLI.

Environment Variables

VariablePurpose
ALPACA_API_KEYAPI key (PKxxx...)
ALPACA_SECRET_KEYSecret key
ALPACA_LIVE_TRADEtrue for live; omit for paper (default)
ALPACA_PROFILENamed profile to use
ALPACA_OUTPUTjson or csv output format

Safety

  • Default mode is PAPER trading — no real money at risk
  • Set ALPACA_LIVE_TRADE=true explicitly when switching to live
  • alpaca doctor validates connectivity and auth before running automations
  • CLI executes immediately with no confirmation prompts — review orders before running in live mode

Trigger.dev Integration Example

import { task } from "@trigger.dev/sdk/v3";

export const dailyMarketScan = task({
  id: "daily-market-scan",
  run: async () => {
    // Use alpaca CLI via shell for zero-dependency market data
    const { execSync } = require("child_process");
    const movers = JSON.parse(
      execSync("alpaca data screener movers --type gainers --limit 5 --output json").toString()
    );
    return movers;
  },
});

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.