{
  "schemaVersion": "1.0",
  "item": {
    "slug": "alpaca-py-cli",
    "name": "Alpaca Py Cli",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/zijunl/alpaca-py-cli",
    "canonicalUrl": "https://clawhub.ai/zijunl/alpaca-py-cli",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/alpaca-py-cli",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=alpaca-py-cli",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "_meta.json",
      "setup.json"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "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."
        },
        {
          "label": "Upgrade existing",
          "body": "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."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/alpaca-py-cli"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/alpaca-py-cli",
    "agentPageUrl": "https://openagent3.xyz/skills/alpaca-py-cli/agent",
    "manifestUrl": "https://openagent3.xyz/skills/alpaca-py-cli/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/alpaca-py-cli/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "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."
      },
      {
        "label": "Upgrade existing",
        "body": "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."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Alpaca Trading (Python CLI) - OpenClaw Agent Skill",
        "body": "Trade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool."
      },
      {
        "title": "⚠️ Security & Setup Requirements",
        "body": "IMPORTANT - READ BEFORE USE:\n\nThis skill stores API keys as environment variables in your shell config file.\n\nWhat happens during setup:\n\nalpaca init displays registration steps for agent automation\nalpaca auth saves API keys to shell startup files (~/.zshrc, ~/.bashrc, or ~/.profile)\nThis creates persistent environment variables accessible to all shell sessions\n\nSecurity considerations:\n\n✅ API keys are stored as environment variables (standard practice)\n✅ Paper trading by default (virtual money, no risk)\n⚠️ Keys in shell config are accessible to any process in that shell\n⚠️ Setup modifies user's shell configuration files\n\nRecommended practices:\n\nGet user consent - Explain that setup will modify shell config\nUse paper trading keys - Test with virtual money first ($100k virtual)\nLeast privilege - Use API keys with minimal required permissions\nMonitor activity - Check your Alpaca account regularly\n\nFor agents:\n\nGet explicit user permission before running alpaca auth (saves keys to shell config)\nalpaca init is safe to run - it only displays instructions\nUse browser automation to complete registration steps automatically\nAfter obtaining keys via browser, call alpaca auth to save them\n\nLinks:\n\nClawHub: https://clawhub.ai/skills/alpaca-py-cli\nGitHub: https://github.com/zijunl/alpaca-py-cli\nAlpaca Markets: https://alpaca.markets"
      },
      {
        "title": "Alpaca Trading (Python CLI)",
        "body": "Trade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool.\n\nLinks:\n\nClawHub: https://clawhub.ai/skills/alpaca-py-cli\nGitHub: https://github.com/zijunl/alpaca-py-cli\nAlpaca Markets: https://alpaca.markets"
      },
      {
        "title": "Overview",
        "body": "Manage your Alpaca Markets trading account using the alpaca CLI tool and Python SDK. Supports both paper trading (simulated) and live trading."
      },
      {
        "title": "Recommended: Homebrew Python (avoids urllib3/LibreSSL warnings)",
        "body": "# Install Homebrew Python 3.11+\nbrew install python@3.11\n\n# Install alpaca-py\n/opt/homebrew/bin/pip3.11 install alpaca-py pytz"
      },
      {
        "title": "Alternative: System Python",
        "body": "pip3 install alpaca-py pytz\n\nNote: System Python may show urllib3 warnings on macOS due to LibreSSL compatibility. Use Homebrew Python for a cleaner experience."
      },
      {
        "title": "Quick Setup with CLI",
        "body": "alpaca auth\n\nThis will interactively prompt you for:\n\nAPI Key\nSecret Key (hidden input)\nTrading mode (Paper or Live)\n\nThe command automatically saves your credentials to your shell config file (~/.zshrc, ~/.bashrc, or ~/.profile)."
      },
      {
        "title": "Manual Setup",
        "body": "Alternatively, set these in your shell profile manually:\n\nexport ALPACA_API_KEY=\"your_api_key\"\nexport ALPACA_SECRET_KEY=\"your_secret_key\"\nexport ALPACA_PAPER=\"true\"  # Use \"false\" for live trading\n\nGet your API keys from https://alpaca.markets (Dashboard → API Keys)\n\nPaper Trading (recommended for testing):\n\nUse paper trading API keys\nVirtual $100,000 starting balance\nNo real money at risk\n\nLive Trading (real money):\n\nUse live trading API keys\nReal money, real risk\nTest thoroughly with paper trading first"
      },
      {
        "title": "Setup & Configuration",
        "body": "Configure Credentials\n\nalpaca auth\n\nInteractive setup wizard that guides you through:\n\nEnter API Key\nEnter Secret Key (hidden)\nChoose trading mode (Paper/Live)\nAutomatically saves to shell config"
      },
      {
        "title": "Account & Market Info",
        "body": "Check Account\n\nalpaca account\n\nShows:\n\nAccount number and status\nPortfolio value, cash, buying power\nP&L (equity, last equity)\nTrading restrictions (pattern day trader, blocks)\n\nCheck Market Status\n\nalpaca clock\n\nShows:\n\nMarket status (🟢 OPEN or 🔴 CLOSED)\nCurrent time\nNext open/close times\n\nView Market Calendar\n\n# Show next 30 trading days (default)\nalpaca calendar\n\n# Show next 7 trading days\nalpaca calendar --days 7\n\nShows trading days with open/close times (Eastern Time).\n\nView Portfolio History\n\n# Default: 1 month, daily bars\nalpaca history\n\n# Last week\nalpaca history --period 1W\n\n# Last 3 months with hourly bars\nalpaca history --period 3M --timeframe 1H\n\nPeriods: 1D, 1W, 1M, 3M, 1Y, all\nTimeframes: 1Min, 5Min, 15Min, 1H, 1D\n\nShows:\n\nStart and end equity\nTotal change ($ and %)\nRecent history (last 10 data points)"
      },
      {
        "title": "Portfolio Management",
        "body": "View Positions\n\nalpaca positions\n\nShows all current holdings with:\n\nSymbol, quantity, current price\nEntry price and market value\nUnrealized P&L ($ and %)\nTotal portfolio value and P&L\n\nGet Stock Quotes\n\n# Single symbol\nalpaca quote AAPL\n\n# Multiple symbols\nalpaca quote AAPL,TSLA,MSFT\n\nShows:\n\nBid and ask prices\nMid price and spread\nQuote timestamp\n\nNote: Quotes may show incomplete data when market is closed. Best used during market hours (9:30 AM - 4:00 PM ET)."
      },
      {
        "title": "Order Management",
        "body": "View Orders\n\n# Show open orders (default)\nalpaca orders\n\n# Show all recent orders\nalpaca orders --status all\n\n# Show last 20 closed orders\nalpaca orders --status closed --limit 20\n\nShows:\n\nOrder status with emoji indicators (⏳ pending, ✓ filled, ✗ canceled)\nSymbol, side (BUY/SELL), quantity\nOrder ID and creation time\nFill price (if filled)\n\nPlace Orders\n\n# Buy shares\nalpaca buy AAPL 10\n\n# Sell shares\nalpaca sell AAPL 5\n\nPlaces a market order that executes at market price when market is open.\n\nCancel Orders\n\n# Cancel specific order\nalpaca cancel <order_id>\n\n# Cancel all open orders\nalpaca cancel-all"
      },
      {
        "title": "Position Management",
        "body": "Close Positions\n\n# Close specific position\nalpaca close AAPL\n\n# Close all positions (requires confirmation)\nalpaca close-all\n\nNote: close-all will prompt for confirmation before closing all positions."
      },
      {
        "title": "First Time Setup",
        "body": "# Configure credentials\nalpaca auth\n\n# Check account\nalpaca account\n\n# Check if market is open\nalpaca clock"
      },
      {
        "title": "Trading Workflow",
        "body": "# Check current price\nalpaca quote TSLA\n\n# Check account balance\nalpaca account\n\n# Buy some shares\nalpaca buy TSLA 5\n\n# Check pending orders\nalpaca orders\n\n# View positions (after order fills)\nalpaca positions\n\n# Get updated quote\nalpaca quote TSLA\n\n# Sell some shares\nalpaca sell TSLA 2\n\n# Check order history\nalpaca orders --status all"
      },
      {
        "title": "Portfolio Analysis",
        "body": "# View current positions\nalpaca positions\n\n# View portfolio history\nalpaca history --period 1M\n\n# Check market calendar\nalpaca calendar --days 7"
      },
      {
        "title": "Risk Management",
        "body": "# Check all open orders\nalpaca orders\n\n# Cancel specific order\nalpaca cancel <order_id>\n\n# Cancel all orders\nalpaca cancel-all\n\n# Close specific position\nalpaca close AAPL\n\n# Close all positions\nalpaca close-all"
      },
      {
        "title": "Automated Setup for Agents",
        "body": "When a user wants to start trading but hasn't configured Alpaca yet, agents can automate the entire setup process using browser automation."
      },
      {
        "title": "Setup Workflow",
        "body": "Run alpaca init - Displays clear registration steps\nUse browser automation to complete steps 1-3:\n\nNavigate to https://alpaca.markets\nClick \"Sign Up\" and fill registration form\nVerify email (can use email skill to automate)\nLog in and navigate to Dashboard → API Keys → Paper Trading\nGenerate new API key pair\nExtract both keys (API Key and Secret Key)\n\n\nRun alpaca auth - Save the extracted keys to shell config"
      },
      {
        "title": "Example Agent Flow",
        "body": "User: \"I want to start trading stocks\"\n\nAgent: \n1. Runs: alpaca init (gets registration steps)\n2. Uses browser skill to:\n   - Open https://alpaca.markets\n   - Fill registration form with user info\n   - Verify email automatically\n   - Navigate to API Keys page\n   - Generate and extract keys\n3. Runs: alpaca auth (with extracted keys)\n4. Confirms: \"✓ Setup complete! You have $100k in paper money.\""
      },
      {
        "title": "Key Points",
        "body": "alpaca init is non-interactive - just displays steps\nAgents should use browser automation to follow the steps\nalpaca auth requires user consent (modifies shell config)\nAfter setup, verify with alpaca clock or alpaca account"
      },
      {
        "title": "Agent Usage",
        "body": "When the user asks about their portfolio or wants to trade:\n\nConfigure credentials: Run alpaca auth for first-time setup\nCheck market status: Run alpaca clock to see if market is open\nCheck account: Run alpaca account to see current balance and buying power\nGet positions: Run alpaca positions to list current holdings\nView orders: Run alpaca orders to see pending/recent orders\nGet quotes: Run alpaca quote <symbols> to check current prices\nPlace orders: Run alpaca buy/sell to execute trades\nManage risk: Run alpaca cancel/close commands as needed"
      },
      {
        "title": "Safety Tips",
        "body": "Always test with paper trading first (ALPACA_PAPER=true)\nUse alpaca auth to safely configure credentials (secret key is hidden)\nCheck alpaca clock before trading to see if market is open\nCheck quotes before placing orders to understand current prices\nCheck account.buying_power before placing orders\nUse TimeInForce.DAY to auto-cancel unfilled orders at market close\nMonitor positions regularly with alpaca positions\nCheck order status with alpaca orders\nReview portfolio performance with alpaca history\nUse alpaca cancel-all to quickly cancel all pending orders\nUse alpaca close-all with caution (requires confirmation)\nSet stop-loss orders for risk management\nNever share your API keys publicly"
      },
      {
        "title": "Market Hours",
        "body": "US stock market hours (Eastern Time):\n\nRegular hours: 9:30 AM - 4:00 PM ET\nPre-market: 4:00 AM - 9:30 AM ET\nAfter-hours: 4:00 PM - 8:00 PM ET\n\nOrders placed outside market hours will be queued and executed when market opens.\n\nQuotes may show incomplete or stale data when market is closed.\n\nUse alpaca clock to check current market status."
      },
      {
        "title": "urllib3 Warning (LibreSSL)",
        "body": "If you see:\n\nNotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently using LibreSSL\n\nSolution: Install and use Homebrew Python 3.11+ which uses OpenSSL:\n\nbrew install python@3.11\n/opt/homebrew/bin/pip3.11 install alpaca-py pytz\n\nThen update the script shebang to use Homebrew Python:\n\nsed -i '' '1s|#!/usr/bin/env python3|#!/opt/homebrew/bin/python3.11|' ~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca"
      },
      {
        "title": "Missing pytz",
        "body": "If you see:\n\nModuleNotFoundError: No module named 'pytz'\n\nSolution:\n\npip3 install pytz\n# or\n/opt/homebrew/bin/pip3.11 install pytz"
      },
      {
        "title": "Command Not Found",
        "body": "If alpaca command is not found, use the full path:\n\n~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca\n\nOr add to PATH in your shell config:\n\nexport PATH=\"$HOME/.openclaw/workspace/skills/alpaca-py-cli/scripts:$PATH\""
      },
      {
        "title": "Files",
        "body": "CLI Tool: ~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca\nConfig: Environment variables in ~/.zshrc (or ~/.bashrc, ~/.profile)"
      },
      {
        "title": "Official Documentation",
        "body": "Python SDK: https://alpaca.markets/docs/python-sdk/\nAPI Reference: https://docs.alpaca.markets/reference/\nTrading API: https://docs.alpaca.markets/docs/trading-api\nMarket Data API: https://docs.alpaca.markets/docs/market-data"
      },
      {
        "title": "Initialization (For Agents)",
        "body": "See the \"Automated Setup for Agents\" section above for the complete workflow.\n\nQuick summary:\n\nRun alpaca init to see registration steps\nUse browser automation to complete registration and extract API keys\nRun alpaca auth to save keys (with user consent)\nVerify with alpaca clock or alpaca account\n\nThe new alpaca init command is non-interactive and agent-friendly - it simply displays clear steps that an agent can follow using browser automation."
      }
    ],
    "body": "Alpaca Trading (Python CLI) - OpenClaw Agent Skill\n\nTrade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool.\n\n⚠️ Security & Setup Requirements\n\nIMPORTANT - READ BEFORE USE:\n\nThis skill stores API keys as environment variables in your shell config file.\n\nWhat happens during setup:\n\nalpaca init displays registration steps for agent automation\nalpaca auth saves API keys to shell startup files (~/.zshrc, ~/.bashrc, or ~/.profile)\nThis creates persistent environment variables accessible to all shell sessions\n\nSecurity considerations:\n\n✅ API keys are stored as environment variables (standard practice)\n✅ Paper trading by default (virtual money, no risk)\n⚠️ Keys in shell config are accessible to any process in that shell\n⚠️ Setup modifies user's shell configuration files\n\nRecommended practices:\n\nGet user consent - Explain that setup will modify shell config\nUse paper trading keys - Test with virtual money first ($100k virtual)\nLeast privilege - Use API keys with minimal required permissions\nMonitor activity - Check your Alpaca account regularly\n\nFor agents:\n\nGet explicit user permission before running alpaca auth (saves keys to shell config)\nalpaca init is safe to run - it only displays instructions\nUse browser automation to complete registration steps automatically\nAfter obtaining keys via browser, call alpaca auth to save them\n\nLinks:\n\nClawHub: https://clawhub.ai/skills/alpaca-py-cli\nGitHub: https://github.com/zijunl/alpaca-py-cli\nAlpaca Markets: https://alpaca.markets\nAlpaca Trading (Python CLI)\n\nTrade stocks and crypto programmatically via Alpaca's API using a Python-based CLI tool.\n\nLinks:\n\nClawHub: https://clawhub.ai/skills/alpaca-py-cli\nGitHub: https://github.com/zijunl/alpaca-py-cli\nAlpaca Markets: https://alpaca.markets\nOverview\n\nManage your Alpaca Markets trading account using the alpaca CLI tool and Python SDK. Supports both paper trading (simulated) and live trading.\n\nInstallation\nRecommended: Homebrew Python (avoids urllib3/LibreSSL warnings)\n# Install Homebrew Python 3.11+\nbrew install python@3.11\n\n# Install alpaca-py\n/opt/homebrew/bin/pip3.11 install alpaca-py pytz\n\nAlternative: System Python\npip3 install alpaca-py pytz\n\n\nNote: System Python may show urllib3 warnings on macOS due to LibreSSL compatibility. Use Homebrew Python for a cleaner experience.\n\nConfiguration\nQuick Setup with CLI\nalpaca auth\n\n\nThis will interactively prompt you for:\n\nAPI Key\nSecret Key (hidden input)\nTrading mode (Paper or Live)\n\nThe command automatically saves your credentials to your shell config file (~/.zshrc, ~/.bashrc, or ~/.profile).\n\nManual Setup\n\nAlternatively, set these in your shell profile manually:\n\nexport ALPACA_API_KEY=\"your_api_key\"\nexport ALPACA_SECRET_KEY=\"your_secret_key\"\nexport ALPACA_PAPER=\"true\"  # Use \"false\" for live trading\n\n\nGet your API keys from https://alpaca.markets (Dashboard → API Keys)\n\nPaper Trading (recommended for testing):\n\nUse paper trading API keys\nVirtual $100,000 starting balance\nNo real money at risk\n\nLive Trading (real money):\n\nUse live trading API keys\nReal money, real risk\nTest thoroughly with paper trading first\nCLI Commands\nSetup & Configuration\nConfigure Credentials\nalpaca auth\n\n\nInteractive setup wizard that guides you through:\n\nEnter API Key\nEnter Secret Key (hidden)\nChoose trading mode (Paper/Live)\nAutomatically saves to shell config\nAccount & Market Info\nCheck Account\nalpaca account\n\n\nShows:\n\nAccount number and status\nPortfolio value, cash, buying power\nP&L (equity, last equity)\nTrading restrictions (pattern day trader, blocks)\nCheck Market Status\nalpaca clock\n\n\nShows:\n\nMarket status (🟢 OPEN or 🔴 CLOSED)\nCurrent time\nNext open/close times\nView Market Calendar\n# Show next 30 trading days (default)\nalpaca calendar\n\n# Show next 7 trading days\nalpaca calendar --days 7\n\n\nShows trading days with open/close times (Eastern Time).\n\nView Portfolio History\n# Default: 1 month, daily bars\nalpaca history\n\n# Last week\nalpaca history --period 1W\n\n# Last 3 months with hourly bars\nalpaca history --period 3M --timeframe 1H\n\n\nPeriods: 1D, 1W, 1M, 3M, 1Y, all\nTimeframes: 1Min, 5Min, 15Min, 1H, 1D\n\nShows:\n\nStart and end equity\nTotal change ($ and %)\nRecent history (last 10 data points)\nPortfolio Management\nView Positions\nalpaca positions\n\n\nShows all current holdings with:\n\nSymbol, quantity, current price\nEntry price and market value\nUnrealized P&L ($ and %)\nTotal portfolio value and P&L\nGet Stock Quotes\n# Single symbol\nalpaca quote AAPL\n\n# Multiple symbols\nalpaca quote AAPL,TSLA,MSFT\n\n\nShows:\n\nBid and ask prices\nMid price and spread\nQuote timestamp\n\nNote: Quotes may show incomplete data when market is closed. Best used during market hours (9:30 AM - 4:00 PM ET).\n\nOrder Management\nView Orders\n# Show open orders (default)\nalpaca orders\n\n# Show all recent orders\nalpaca orders --status all\n\n# Show last 20 closed orders\nalpaca orders --status closed --limit 20\n\n\nShows:\n\nOrder status with emoji indicators (⏳ pending, ✓ filled, ✗ canceled)\nSymbol, side (BUY/SELL), quantity\nOrder ID and creation time\nFill price (if filled)\nPlace Orders\n# Buy shares\nalpaca buy AAPL 10\n\n# Sell shares\nalpaca sell AAPL 5\n\n\nPlaces a market order that executes at market price when market is open.\n\nCancel Orders\n# Cancel specific order\nalpaca cancel <order_id>\n\n# Cancel all open orders\nalpaca cancel-all\n\nPosition Management\nClose Positions\n# Close specific position\nalpaca close AAPL\n\n# Close all positions (requires confirmation)\nalpaca close-all\n\n\nNote: close-all will prompt for confirmation before closing all positions.\n\nExample Workflows\nFirst Time Setup\n# Configure credentials\nalpaca auth\n\n# Check account\nalpaca account\n\n# Check if market is open\nalpaca clock\n\nTrading Workflow\n# Check current price\nalpaca quote TSLA\n\n# Check account balance\nalpaca account\n\n# Buy some shares\nalpaca buy TSLA 5\n\n# Check pending orders\nalpaca orders\n\n# View positions (after order fills)\nalpaca positions\n\n# Get updated quote\nalpaca quote TSLA\n\n# Sell some shares\nalpaca sell TSLA 2\n\n# Check order history\nalpaca orders --status all\n\nPortfolio Analysis\n# View current positions\nalpaca positions\n\n# View portfolio history\nalpaca history --period 1M\n\n# Check market calendar\nalpaca calendar --days 7\n\nRisk Management\n# Check all open orders\nalpaca orders\n\n# Cancel specific order\nalpaca cancel <order_id>\n\n# Cancel all orders\nalpaca cancel-all\n\n# Close specific position\nalpaca close AAPL\n\n# Close all positions\nalpaca close-all\n\nAutomated Setup for Agents\n\nWhen a user wants to start trading but hasn't configured Alpaca yet, agents can automate the entire setup process using browser automation.\n\nSetup Workflow\nRun alpaca init - Displays clear registration steps\nUse browser automation to complete steps 1-3:\nNavigate to https://alpaca.markets\nClick \"Sign Up\" and fill registration form\nVerify email (can use email skill to automate)\nLog in and navigate to Dashboard → API Keys → Paper Trading\nGenerate new API key pair\nExtract both keys (API Key and Secret Key)\nRun alpaca auth - Save the extracted keys to shell config\nExample Agent Flow\nUser: \"I want to start trading stocks\"\n\nAgent: \n1. Runs: alpaca init (gets registration steps)\n2. Uses browser skill to:\n   - Open https://alpaca.markets\n   - Fill registration form with user info\n   - Verify email automatically\n   - Navigate to API Keys page\n   - Generate and extract keys\n3. Runs: alpaca auth (with extracted keys)\n4. Confirms: \"✓ Setup complete! You have $100k in paper money.\"\n\nKey Points\nalpaca init is non-interactive - just displays steps\nAgents should use browser automation to follow the steps\nalpaca auth requires user consent (modifies shell config)\nAfter setup, verify with alpaca clock or alpaca account\nAgent Usage\n\nWhen the user asks about their portfolio or wants to trade:\n\nConfigure credentials: Run alpaca auth for first-time setup\nCheck market status: Run alpaca clock to see if market is open\nCheck account: Run alpaca account to see current balance and buying power\nGet positions: Run alpaca positions to list current holdings\nView orders: Run alpaca orders to see pending/recent orders\nGet quotes: Run alpaca quote <symbols> to check current prices\nPlace orders: Run alpaca buy/sell to execute trades\nManage risk: Run alpaca cancel/close commands as needed\nSafety Tips\nAlways test with paper trading first (ALPACA_PAPER=true)\nUse alpaca auth to safely configure credentials (secret key is hidden)\nCheck alpaca clock before trading to see if market is open\nCheck quotes before placing orders to understand current prices\nCheck account.buying_power before placing orders\nUse TimeInForce.DAY to auto-cancel unfilled orders at market close\nMonitor positions regularly with alpaca positions\nCheck order status with alpaca orders\nReview portfolio performance with alpaca history\nUse alpaca cancel-all to quickly cancel all pending orders\nUse alpaca close-all with caution (requires confirmation)\nSet stop-loss orders for risk management\nNever share your API keys publicly\nMarket Hours\n\nUS stock market hours (Eastern Time):\n\nRegular hours: 9:30 AM - 4:00 PM ET\nPre-market: 4:00 AM - 9:30 AM ET\nAfter-hours: 4:00 PM - 8:00 PM ET\n\nOrders placed outside market hours will be queued and executed when market opens.\n\nQuotes may show incomplete or stale data when market is closed.\n\nUse alpaca clock to check current market status.\n\nTroubleshooting\nurllib3 Warning (LibreSSL)\n\nIf you see:\n\nNotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently using LibreSSL\n\n\nSolution: Install and use Homebrew Python 3.11+ which uses OpenSSL:\n\nbrew install python@3.11\n/opt/homebrew/bin/pip3.11 install alpaca-py pytz\n\n\nThen update the script shebang to use Homebrew Python:\n\nsed -i '' '1s|#!/usr/bin/env python3|#!/opt/homebrew/bin/python3.11|' ~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca\n\nMissing pytz\n\nIf you see:\n\nModuleNotFoundError: No module named 'pytz'\n\n\nSolution:\n\npip3 install pytz\n# or\n/opt/homebrew/bin/pip3.11 install pytz\n\nCommand Not Found\n\nIf alpaca command is not found, use the full path:\n\n~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca\n\n\nOr add to PATH in your shell config:\n\nexport PATH=\"$HOME/.openclaw/workspace/skills/alpaca-py-cli/scripts:$PATH\"\n\nFiles\nCLI Tool: ~/.openclaw/workspace/skills/alpaca-py-cli/scripts/alpaca\nConfig: Environment variables in ~/.zshrc (or ~/.bashrc, ~/.profile)\nOfficial Documentation\nPython SDK: https://alpaca.markets/docs/python-sdk/\nAPI Reference: https://docs.alpaca.markets/reference/\nTrading API: https://docs.alpaca.markets/docs/trading-api\nMarket Data API: https://docs.alpaca.markets/docs/market-data\nInitialization (For Agents)\n\nSee the \"Automated Setup for Agents\" section above for the complete workflow.\n\nQuick summary:\n\nRun alpaca init to see registration steps\nUse browser automation to complete registration and extract API keys\nRun alpaca auth to save keys (with user consent)\nVerify with alpaca clock or alpaca account\n\nThe new alpaca init command is non-interactive and agent-friendly - it simply displays clear steps that an agent can follow using browser automation."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/zijunl/alpaca-py-cli",
    "publisherUrl": "https://clawhub.ai/zijunl/alpaca-py-cli",
    "owner": "zijunl",
    "version": "2.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/alpaca-py-cli",
    "downloadUrl": "https://openagent3.xyz/downloads/alpaca-py-cli",
    "agentUrl": "https://openagent3.xyz/skills/alpaca-py-cli/agent",
    "manifestUrl": "https://openagent3.xyz/skills/alpaca-py-cli/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/alpaca-py-cli/agent.md"
  }
}