alpaca-py-cli
FreeNo executable scriptsNot checkedAI agent skill for Alpaca Markets trading. Intelligent setup wizard (alpaca init) guides users through registration. Trade stocks/crypto, manage portfolios…
by modbender★ 21 GitHub starsAbout this skill
Alpaca Trading (Python CLI) - OpenClaw Agent Skill
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 initdisplays registration steps for agent automationalpaca authsaves 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:
- Get user consent - Explain that setup will modify shell config
- Use paper trading keys - Test with virtual money first ($100k virtual)
- Least privilege - Use API keys with minimal required permissions
- Monitor activity - Check your Alpaca account regularly
For agents:
- Get explicit user permission before running
alpaca auth(saves keys to shell config) alpaca initis safe to run - it only displays instructions- Use browser automation to complete registration steps automatically
- After obtaining keys via browser, call
alpaca authto save them
Links:
- ClawHub: https://clawhub.ai/skills/alpaca-py-cli
- GitHub: https://github.com/zijunl/alpaca-py-cli
- Alpaca Markets: https://alpaca.markets
Alpaca Trading (Python CLI)
Trade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool.
Links:
- ClawHub: https://clawhub.ai/skills/alpaca-py-cli
- GitHub: https://github.com/zijunl/alpaca-py-cli
- Alpaca Markets: https://alpaca.markets
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:
- Enter API Key
- Enter Secret Key (hidden)
- Choose trading mode (Paper/Live)
- 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
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
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
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
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic