Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
AI agent skill for Alpaca Markets trading. Intelligent setup wizard (alpaca init) guides users through registration. Trade stocks/crypto, manage portfolios,...
AI agent skill for Alpaca Markets trading. Intelligent setup wizard (alpaca init) guides users through registration. Trade stocks/crypto, manage portfolios,...
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
Trade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool.
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: 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 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: ClawHub: https://clawhub.ai/skills/alpaca-py-cli GitHub: https://github.com/zijunl/alpaca-py-cli Alpaca Markets: https://alpaca.markets
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
Manage your Alpaca Markets trading account using the alpaca CLI tool and Python SDK. Supports both paper trading (simulated) and live trading.
# Install Homebrew Python 3.11+ brew install python@3.11 # Install alpaca-py /opt/homebrew/bin/pip3.11 install alpaca-py pytz
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.
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).
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
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
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 --period 3M --timeframe 1H Periods: 1D, 1W, 1M, 3M, 1Y, all Timeframes: 1Min, 5Min, 15Min, 1H, 1D Shows: Start and end equity Total change ($ and %) Recent history (last 10 data points)
View Positions alpaca positions Shows all current holdings with: Symbol, quantity, current price Entry price and market value Unrealized P&L ($ and %) Total portfolio value and P&L Get Stock Quotes # Single symbol alpaca quote AAPL # Multiple symbols alpaca quote AAPL,TSLA,MSFT Shows: Bid and ask prices Mid price and spread Quote timestamp Note: Quotes may show incomplete data when market is closed. Best used during market hours (9:30 AM - 4:00 PM ET).
View Orders # Show open orders (default) alpaca orders # Show all recent orders alpaca orders --status all # Show last 20 closed orders alpaca orders --status closed --limit 20 Shows: Order status with emoji indicators (โณ pending, โ filled, โ canceled) Symbol, side (BUY/SELL), quantity Order ID and creation time Fill price (if filled) Place Orders # Buy shares alpaca buy AAPL 10 # Sell shares alpaca sell AAPL 5 Places a market order that executes at market price when market is open. Cancel Orders # Cancel specific order alpaca cancel <order_id> # Cancel all open orders alpaca cancel-all
Close Positions # Close specific position alpaca close AAPL # Close all positions (requires confirmation) alpaca close-all Note: close-all will prompt for confirmation before closing all positions.
# Configure credentials alpaca auth # Check account alpaca account # Check if market is open alpaca clock
# Check current price alpaca quote TSLA # Check account balance alpaca account # Buy some shares alpaca buy TSLA 5 # Check pending orders alpaca orders # View positions (after order fills) alpaca positions # Get updated quote alpaca quote TSLA # Sell some shares alpaca sell TSLA 2 # Check order history alpaca orders --status all
# View current positions alpaca positions # View portfolio history alpaca history --period 1M # Check market calendar alpaca calendar --days 7
# Check all open orders alpaca orders # Cancel specific order alpaca cancel <order_id> # Cancel all orders alpaca cancel-all # Close specific position alpaca close AAPL # Close all positions alpaca close-all
When a user wants to start trading but hasn't configured Alpaca yet, agents can automate the entire setup process using browser automation.
Run alpaca init - Displays clear registration steps Use browser automation to complete steps 1-3: Navigate to https://alpaca.markets Click "Sign Up" and fill registration form Verify email (can use email skill to automate) Log in and navigate to Dashboard โ API Keys โ Paper Trading Generate new API key pair Extract both keys (API Key and Secret Key) Run alpaca auth - Save the extracted keys to shell config
User: "I want to start trading stocks" Agent: 1. Runs: alpaca init (gets registration steps) 2. Uses browser skill to: - Open https://alpaca.markets - Fill registration form with user info - Verify email automatically - Navigate to API Keys page - Generate and extract keys 3. Runs: alpaca auth (with extracted keys) 4. Confirms: "โ Setup complete! You have $100k in paper money."
alpaca init is non-interactive - just displays steps Agents should use browser automation to follow the steps alpaca auth requires user consent (modifies shell config) After setup, verify with alpaca clock or alpaca account
When the user asks about their portfolio or wants to trade: Configure credentials: Run alpaca auth for first-time setup Check market status: Run alpaca clock to see if market is open Check account: Run alpaca account to see current balance and buying power Get positions: Run alpaca positions to list current holdings View orders: Run alpaca orders to see pending/recent orders Get quotes: Run alpaca quote <symbols> to check current prices Place orders: Run alpaca buy/sell to execute trades Manage risk: Run alpaca cancel/close commands as needed
Always test with paper trading first (ALPACA_PAPER=true) Use alpaca auth to safely configure credentials (secret key is hidden) Check alpaca clock before trading to see if market is open Check quotes before placing orders to understand current prices Check account.buying_power before placing orders Use TimeInForce.DAY to auto-cancel unfilled orders at market close Monitor positions regularly with alpaca positions Check order status with alpaca orders Review portfolio performance with alpaca history Use alpaca cancel-all to quickly cancel all pending orders Use alpaca close-all with caution (requires confirmation) Set stop-loss orders for risk management Never share your API keys publicly
US stock market hours (Eastern Time): Regular hours: 9:30 AM - 4:00 PM ET Pre-market: 4:00 AM - 9:30 AM ET After-hours: 4:00 PM - 8:00 PM ET Orders placed outside market hours will be queued and executed when market opens. Quotes may show incomplete or stale data when market is closed. Use alpaca clock to check current market status.
If you see: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently using LibreSSL Solution: Install and use Homebrew Python 3.11+ which uses OpenSSL: brew install python@3.11 /opt/homebrew/bin/pip3.11 install alpaca-py pytz Then update the script shebang to use Homebrew Python: sed -i '' '1s|#!/usr/bin/env python3|#!/opt/homebrew/bin/python3.11|' ~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca
If you see: ModuleNotFoundError: No module named 'pytz' Solution: pip3 install pytz # or /opt/homebrew/bin/pip3.11 install pytz
If alpaca command is not found, use the full path: ~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca Or add to PATH in your shell config: export PATH="$HOME/.openclaw/workspace/skills/alpaca-py-cli/scripts:$PATH"
CLI Tool: ~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca Config: Environment variables in ~/.zshrc (or ~/.bashrc, ~/.profile)
Python SDK: https://alpaca.markets/docs/python-sdk/ API Reference: https://docs.alpaca.markets/reference/ Trading API: https://docs.alpaca.markets/docs/trading-api Market Data API: https://docs.alpaca.markets/docs/market-data
See the "Automated Setup for Agents" section above for the complete workflow. Quick summary: Run alpaca init to see registration steps Use browser automation to complete registration and extract API keys Run alpaca auth to save keys (with user consent) Verify with alpaca clock or alpaca account The new alpaca init command is non-interactive and agent-friendly - it simply displays clear steps that an agent can follow using browser automation.
Code helpers, APIs, CLIs, browser automation, testing, and developer operations.
Largest current source with strong distribution and engagement signals.