Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

alpaca-py-cli

FreeNo executable scriptsNot checked

AI agent skill for Alpaca Markets trading. Intelligent setup wizard (alpaca init) guides users through registration. Trade stocks/crypto, manage portfolios…

modbenderby modbender★ 21 GitHub stars

About this skill

Alpaca Trading (Python CLI) - OpenClaw Agent Skill

ClawHub GitHub

Trade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool.

⚠️ Security & Setup Requirements

IMPORTANT - READ BEFORE USE:

This skill stores API keys as environment variables in your shell config file.

What happens during setup:

  • alpaca init displays registration steps for agent automation
  • alpaca auth saves API keys to shell startup files (~/.zshrc, ~/.bashrc, or ~/.profile)
  • This creates persistent environment variables accessible to all shell sessions

Security considerations:

  • ✅ API keys are stored as environment variables (standard practice)
  • ✅ Paper trading by default (virtual money, no risk)
  • ⚠️ Keys in shell config are accessible to any process in that shell
  • ⚠️ Setup modifies user's shell configuration files

Recommended practices:

  1. Get user consent - Explain that setup will modify shell config
  2. Use paper trading keys - Test with virtual money first ($100k virtual)
  3. Least privilege - Use API keys with minimal required permissions
  4. Monitor activity - Check your Alpaca account regularly

For agents:

  • Get explicit user permission before running alpaca auth (saves keys to shell config)
  • alpaca init is safe to run - it only displays instructions
  • Use browser automation to complete registration steps automatically
  • After obtaining keys via browser, call alpaca auth to save them

Links:

Alpaca Trading (Python CLI)

ClawHub GitHub

Trade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool.

Links:

Overview

Manage your Alpaca Markets trading account using the alpaca CLI tool and Python SDK. Supports both paper trading (simulated) and live trading.

Installation

Recommended: Homebrew Python (avoids urllib3/LibreSSL warnings)

# Install Homebrew Python 3.11+
brew install [email protected]

# Install alpaca-py
/opt/homebrew/bin/pip3.11 install alpaca-py pytz

Alternative: System Python

pip3 install alpaca-py pytz

Note: System Python may show urllib3 warnings on macOS due to LibreSSL compatibility. Use Homebrew Python for a cleaner experience.

Configuration

Quick Setup with CLI

alpaca auth

This will interactively prompt you for:

  • API Key
  • Secret Key (hidden input)
  • Trading mode (Paper or Live)

The command automatically saves your credentials to your shell config file (~/.zshrc, ~/.bashrc, or ~/.profile).

Manual Setup

Alternatively, set these in your shell profile manually:

export ALPACA_API_KEY="your_api_key"
export ALPACA_SECRET_KEY="your_secret_key"
export ALPACA_PAPER="true"  # Use "false" for live trading

Get your API keys from https://alpaca.markets (Dashboard → API Keys)

Paper Trading (recommended for testing):

  • Use paper trading API keys
  • Virtual $100,000 starting balance
  • No real money at risk

Live Trading (real money):

  • Use live trading API keys
  • Real money, real risk
  • Test thoroughly with paper trading first

CLI Commands

Setup & Configuration

Configure Credentials

alpaca auth

Interactive setup wizard that guides you through:

  1. Enter API Key
  2. Enter Secret Key (hidden)
  3. Choose trading mode (Paper/Live)
  4. Automatically saves to shell config

Account & Market Info

Check Account

alpaca account

Shows:

  • Account number and status
  • Portfolio value, cash, buying power
  • P&L (equity, last equity)
  • Trading restrictions (pattern day trader, blocks)

Check Market Status

alpaca clock

Shows:

  • Market status (🟢 OPEN or 🔴 CLOSED)
  • Current time
  • Next open/close times

View Market Calendar

# Show next 30 trading days (default)
alpaca calendar

# Show next 7 trading days
alpaca calendar --days 7

Shows trading days with open/close times (Eastern Time).

View Portfolio History

# Default: 1 month, daily bars
alpaca history

# Last week
alpaca history --period 1W

# Last 3 months with hourly bars
alpaca history
Full SKILL.md on GitHub

Install alpaca-py-cli in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

README.mdsetup.json

FAQ

What does the alpaca-py-cli skill do?

AI agent skill for Alpaca Markets trading. Intelligent setup wizard (alpaca init) guides users through registration. Trade stocks/crypto, manage portfolios, execute orders via natural language. Token-efficient design with runtime guidance. Paper trading by default ($100k virtual money). IMPORTANT - Setup requires user interaction to configure API keys in shell environment.

How do I install the alpaca-py-cli skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the alpaca-py-cli skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare alpaca-py-cli with