Alpaca Trading
gauss314/skills
Trading API de Alpaca: órdenes, posiciones, cuenta. An agent skill from gauss314/skills.
Preview, submit, inspect, and manage Alpaca paper-trading orders across US equities, options, and crypto.
$ npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install alpacahq/alpaca-skills alpaca-trading-paper-trading --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/alpacahq/alpaca-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/trading-api/paper-trading .claude/skills/alpaca-trading-paper-trading && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "alpaca-trading-paper-trading" agent skill from https://github.com/alpacahq/alpaca-skills/tree/main/skills/trading-api/paper-trading into .claude/skills/alpaca-trading-paper-trading/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "alpaca-trading-paper-trading", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/alpacahq/alpaca-skills/tree/main/skills/trading-api/paper-tradingType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install alpacahq/alpaca-skills alpaca-trading-paper-trading --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/alpacahq/alpaca-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/trading-api/paper-trading .agents/skills/alpaca-trading-paper-trading && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "alpaca-trading-paper-trading" agent skill from https://github.com/alpacahq/alpaca-skills/tree/main/skills/trading-api/paper-trading into .agents/skills/alpaca-trading-paper-trading/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "alpaca-trading-paper-trading", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install alpacahq/alpaca-skills alpaca-trading-paper-trading --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/alpacahq/alpaca-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/trading-api/paper-trading .cursor/skills/alpaca-trading-paper-trading && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "alpaca-trading-paper-trading" agent skill from https://github.com/alpacahq/alpaca-skills/tree/main/skills/trading-api/paper-trading into .cursor/skills/alpaca-trading-paper-trading/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "alpaca-trading-paper-trading", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/alpacahq/alpaca-skills.git --path skills/trading-api/paper-trading--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install alpacahq/alpaca-skills alpaca-trading-paper-trading --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/alpacahq/alpaca-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/trading-api/paper-trading .gemini/skills/alpaca-trading-paper-trading && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "alpaca-trading-paper-trading" agent skill from https://github.com/alpacahq/alpaca-skills/tree/main/skills/trading-api/paper-trading into .gemini/skills/alpaca-trading-paper-trading/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "alpaca-trading-paper-trading", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install alpacahq/alpaca-skills alpaca-trading-paper-tradingInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/alpacahq/alpaca-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/trading-api/paper-trading .github/skills/alpaca-trading-paper-trading && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "alpaca-trading-paper-trading" agent skill from https://github.com/alpacahq/alpaca-skills/tree/main/skills/trading-api/paper-trading into .github/skills/alpaca-trading-paper-trading/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "alpaca-trading-paper-trading", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install alpacahq/alpaca-skills alpaca-trading-paper-trading --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/alpacahq/alpaca-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/trading-api/paper-trading .opencode/skills/alpaca-trading-paper-trading && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "alpaca-trading-paper-trading" agent skill from https://github.com/alpacahq/alpaca-skills/tree/main/skills/trading-api/paper-trading into .opencode/skills/alpaca-trading-paper-trading/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "alpaca-trading-paper-trading", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
alpaca-trading-paper-tradingPreview, submit, inspect, and manage Alpaca paper-trading orders across US equities, options, and crypto.
Alpaca Trading Paper Trading is an agent skill from alpacahq/alpaca-skills. Preview, submit, inspect, and manage Alpaca paper-trading orders across US equities, options, and crypto. Use this skill when you want your AI agent to take a strategy signal — from a backtest, manual idea, or automated system — and execute it safely in your Alpaca paper-trading environment. This generic version works with any Alpaca SDK, REST API call, or agent tool that can reach the Trading API.
Its SKILL.md is about 11k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `reference.md`).
It sits in Business, Finance & HR, covering Trading and backtesting. It works with Alpaca. The repository describes itself as: Agent skills for Alpaca's Trading API and Broker API: drop-in SKILL.md files for AI coding assistants. The licence is Apache-2.0.
11 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 39111ab. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
paper-api.alpaca.marketsapi.alpaca.marketsAlso links to:
docs.alpaca.marketsalpaca.marketsFrom URLs in SKILL.md, links to its own repository left out.
Names these keys or tokens, usually read from environment variables:
APCA_API_KEY_IDAPCA_API_SECRET_KEYFrom names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Alpaca Trading Paper Trading loads about 11k tokens when it runs. Until then it costs about 108 tokens; SKILL.md has 4,923 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from alpacahq/alpaca-skills at commit 39111ab, republished under its Apache-2.0 licence (© alpacahq). 4,923 words, ~10,552 tokens.
.claude/skills/alpaca-trading-paper-trading/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.Use this skill when you want your AI agent to preview, submit, inspect, and manage paper-trading orders using Alpaca's Trading API.
This skill is written for you, a Trading API user working with your own Alpaca paper-trading account, credentials, and local workspace. Your agent should make assumptions visible, protect secrets, and confirm order details before submission.
This is the generic (implementation-agnostic) version of the paper-trading skill. It describes the workflow, safety gates, and output contract without binding to any specific execution tool. You can use the Alpaca Python SDK (alpaca-py), the REST API directly, JavaScript/TypeScript, Go, C#, or any tool that speaks to the Trading API. CLI-specific and MCP-specific companion skills exist for users who prefer those execution paths — see §10 for links.
Start with your job. Identify what the signal is — a backtest output, a manual trade idea, a scheduled trigger, or an automated system event. Your agent reads any associated context (backtest run folder, strategy description, alert payload) to understand the intent.
Reiterate the strategy logic. Your agent restates the strategy interpretation in plain language — entry/exit conditions, indicator parameters, position sizing, and any assumptions — and confirms with you that the interpretation is correct before proceeding.
Gather and confirm ALL detailed configurations before execution. Your agent collects every order parameter explicitly:
Confirm which paper account is being used. Your agent verifies that the paper account's configuration meets the strategy's requirements — options approval level, crypto enabled, margin vs cash account, PDT status. It does not assume features are enabled without checking.
Show a complete order preview table before submission. Every order gets a visual preview with all parameters displayed, estimated notional, and buying power check. No order is ever submitted without a preview.
Ask about confirmation preference. Your agent asks whether you want explicit confirmation before each order submission, or whether you prefer auto-submit mode. It respects your preference for the session. Default: confirmation ON.
Submit the order to the paper-trading environment only. Your agent verifies the environment is paper before every submission. It never submits to live.
Return complete post-submission details. After submission, your agent returns the order ID, status, submitted payload summary, and next inspection steps.
Monitor and update on order lifecycle.
Never place live trades. If live credentials are detected — base URL without the paper- prefix, or a profile set to live — your agent stops immediately and warns you. This is a hard block, not a soft warning.
APCA_API_KEY_ID, APCA_API_SECRET_KEY) or SDK/CLI profile — never pasted into chathttps://paper-api.alpaca.markets (for REST) or appropriate SDK configuration pointing to the paper environmentalpaca-py (recommended)@alpacahq/alpaca-trade-api (v4+, first-party and actively maintained)github.com/alpacahq/alpaca-trade-api-go/v3 — the /v3 suffix is required; without it you pull the v1 pathAlpaca.Markets (first-party). Community SDKs exist for Java and others.curl, httpx, requests, or any HTTP clientpaper-api.alpaca.markets)| Input | Description | Default |
|---|---|---|
signal_source | Where the trade idea comes from (backtest, manual, automation) | Must be provided |
symbol | Ticker symbol (e.g., AAPL, BTC/USD, AAPL250718C00200000 for options) | Must be provided |
side | buy or sell | Must be provided |
qty_or_notional | Number of shares/contracts OR dollar amount (use qty for shares/contracts, notional for dollar amount) | Must be provided |
order_type | market, limit, stop, stop_limit, trailing_stop — supported values vary by asset class, see below | market |
time_in_force | day, gtc, ioc, fok, opg, cls — supported values vary by asset class, see below | day for equities; gtc for crypto |
The API rejects combinations outside this matrix, so your agent validates before submitting rather than after:
| Asset class | Order types | Time-in-force | Order classes |
|---|---|---|---|
us_equity | market, limit, stop, stop_limit, trailing_stop | day, gtc, opg, cls, ioc, fok | simple, bracket, oco, oto |
us_option | market, limit, stop, stop_limit (stop types single-leg only) | day, gtc | simple, mleg |
crypto | market, limit, stop_limit | gtc, ioc — stop_limit is gtc-only, and ioc applies only to market and limit | simple |
Treat this as guidance for constructing orders, not as a hard pre-submission gate. Alpaca's sources disagree on the options row: the OpenAPI TimeInForce/OrderType descriptions say market/limit with day only, while the Options Trading page and the Placing Orders matrix both allow gtc and both allow stop/stop_limit on single-leg orders. The two product pages agree against the spec blob, so this table follows them. Default to day for options as the conservative choice, but let Alpaca reject rather than pre-blocking something the matrix permits.
Constraints that cut across order type:
limit type with day or gtc TIF. Everything else is rejected.day and gtc.qty and cannot be replaced — cancel and resubmit instead. For equities they additionally require market type with day TIF; crypto notional orders are market-type and use the crypto TIF set (gtc/ioc), so the equities day restriction does not apply to them.day or gtc, and do not support extended hours.mleg carries up to 4 legs and is how multi-leg options strategies are expressed.| Input | Description | Default |
|---|---|---|
limit_price | Required for limit and stop_limit orders | None |
stop_price | Required for stop and stop_limit orders | None |
trail_price or trail_percent | For trailing stop orders (one or the other, not both) | None |
extended_hours | Allow extended-hours execution (equities only; limit type with day or gtc TIF) | false |
client_order_id | User-supplied idempotency key (max 128 chars) | Auto-generated UUID |
confirmation_mode | Whether your agent asks for explicit confirmation before each order | on |
risk_controls | Max position size, max notional, max loss threshold | None (recommended to set) |
asset_class | us_equity, us_option, crypto | Inferred from symbol format |
order_class | simple, bracket, oco, oto, mleg — see the per-asset-class matrix above | simple |
position_intent | buy_to_open, buy_to_close, sell_to_open, sell_to_close (options only) | Inferred from context |
Before proceeding past the configuration phase, your agent must confirm each of these with you:
| Source | URL | Used for |
|---|---|---|
| Trading API overview | https://docs.alpaca.markets/us/docs/trading-api | API capabilities and structure |
| Working with orders | https://docs.alpaca.markets/us/docs/working-with-orders | Order submission, replacement, cancellation |
| Orders on Alpaca | https://docs.alpaca.markets/us/docs/orders-at-alpaca | Order types, TIF values, status lifecycle |
| Paper trading | https://docs.alpaca.markets/us/docs/paper-trading | Paper environment behavior and limitations |
| Working with positions | https://docs.alpaca.markets/us/docs/working-with-positions | Position retrieval and management |
| Working with account | https://docs.alpaca.markets/us/docs/working-with-account | Account state, buying power, day trade count |
| Working with assets | https://docs.alpaca.markets/us/docs/working-with-assets | Tradability checks, asset attributes |
| Options trading | https://docs.alpaca.markets/us/docs/options-trading | Options order specifics, approval levels |
| Crypto trading | https://docs.alpaca.markets/us/docs/crypto-trading | Crypto order specifics, supported pairs |
| Alpaca disclosures | https://alpaca.markets/disclosures | Required disclosure language |
Step 1 — Identify the signal source. Your agent determines where the trade idea comes from:
notes.md, summary.json) to extract the strategy logic, confirmed parameters, and the last signal. Parse the signal for symbol, side, quantity, and any price targets.Step 2 — Reiterate the strategy logic. Your agent restates the complete strategy interpretation in plain language:
Step 3 — Confirm the interpretation. Your agent asks you to confirm or correct the restatement. It does not proceed until you confirm. If you correct it, your agent restates the corrected version and asks again.
Step 4 — Gather all order parameters. Using the inputs table from §2, your agent collects every required and optional parameter. It asks for anything not already specified.
Step 5 — Show parameter attribution. For each parameter, your agent shows:
Example:
Symbol: AAPL (provided)
Side: buy (provided)
Quantity: 50 shares (provided)
Order type: limit (provided)
Limit price: $180.00 (provided)
TIF: day (defaulted — standard for equities)
Extended hrs: false (defaulted)
Client order: a7b3c9d1-... (auto-generated)Step 6 — Confirm timing. Your agent confirms execution timing:
If the timing is not immediate, your agent explains what tooling you'd need and whether it can help set it up (see §4 Phase 8 for deployment guidance).
Step 7 — Confirm asset class specifics.
For US Equity:
extended_hours is true (only limit orders qualify)For US Options:
AAPL250718C00200000For Crypto:
BTC/USD, ETH/USD)Step 8 — Confirm risk controls. Your agent asks about risk controls:
If you haven't set any risk controls, your agent recommends you consider them. It asks whether you want to set them now or proceed without them. If you proceed without them, your agent notes this in the session log.
Step 9 — Confirm margin usage. Your agent checks:
account.multiplier — the account object has no account_type field. 1 is a limited-margin, cash-style account; 2 is a Reg T margin account with 2x intraday and overnight buying power; 4 is a PDT account with 4x intraday and 2x overnightaccount.shorting_enabled), since the strategy may require itaccount.buying_power) and, for options, account.options_buying_poweraccount.equity)account.maintenance_margin)Step 10 — Verify the environment is paper. Your agent checks the base URL, SDK configuration, or CLI profile to confirm the environment is paper, not live.
| Check | Paper | Live (BLOCKED) |
|---|---|---|
| REST base URL | https://paper-api.alpaca.markets | https://api.alpaca.markets |
| SDK config | paper=True or equivalent | paper=False or missing |
| CLI profile | paper profile selected | live profile selected |
If live credentials are detected: STOP immediately. Your agent displays a clear warning and refuses to proceed. It does not offer to "switch to paper" on your behalf — you must reconfigure your credentials.
Step 11 — Fetch account status. Your agent retrieves the account and verifies:
status is ACTIVE or PAPER_ONLY — a paper-only account is valid for this skill and must not be blockedtrading_blocked is falseaccount_blocked is falsetrade_suspended_by_user is falsebuying_power is sufficient for the planned ordermultiplier for margin classification, which is also the only PDT signal availableThe Trading API account object carries no pattern_day_trader or daytrade_count field. Your agent must not read them. A multiplier of 4 indicates a PDT account; if you need day-trade counts, derive them from GET /v2/account/activities rather than the account object.
Step 12 — Verify options readiness (if trading options).
options_trading_level, not options_approved_level. The effective level is the minimum of options_approved_level and the max_options_trading_level in account configuration, and Alpaca exposes it directly as options_trading_level. An account approved for level 3 but configured to level 1 can only trade level 1.options_trading_level is 0 or below what the strategy needs, your agent stops and explains which level is required and how to request an upgradeStep 13 — Verify crypto readiness (if trading crypto).
crypto_status is ACTIVEStep 14 — Show account summary. Your agent displays a summary of the account state:
┌─────────────────────────────────────────┐
│ PAPER ACCOUNT SUMMARY │
├──────────────┬──────────────────────────┤
│ Account ID │ ****-****-****-a1b2 │
│ Status │ ACTIVE │
│ Equity │ $100,000.00 │
│ Buying Power │ $100,000.00 │
│ Cash │ $100,000.00 │
│ Positions │ 3 open │
│ Multiplier │ 2 (Reg T margin) │
│ Options Lvl │ 2 (effective) │
│ Crypto │ ACTIVE │
└──────────────┴──────────────────────────┘Step 15 — Build the order payload.
Your agent constructs the complete API request body with all confirmed parameters. It sets a unique client_order_id for idempotency.
Step 16 — Display the order preview. Your agent shows a complete order preview table:
┌─────────────────────────────────────────┐
│ ORDER PREVIEW │
├──────────────┬──────────────────────────┤
│ Environment │ PAPER │
│ Symbol │ AAPL │
│ Side │ buy │
│ Quantity │ 10 shares │
│ Order Type │ limit │
│ Limit Price │ $185.50 │
│ Time-in-Force│ day │
│ Extended Hrs │ no │
│ Client Order │ abc-123-def │
│ Est. Notional│ ~$1,855.00 │
│ Buying Power │ $98,500.00 (sufficient) │
└──────────────┴──────────────────────────┘For options, the preview also shows:
AAPL 07/18/2025 $200 CallFor crypto, the preview also shows:
Step 17 — Confirmation-ON mode.
If confirmation_mode is on, your agent asks:
Submit this order? (yes / no)
It waits for your explicit yes before proceeding. Any response other than a clear affirmative is treated as "no" and your agent asks what you'd like to change.
Step 18 — Confirmation-OFF mode.
If confirmation_mode is off, your agent informs you:
Confirmation mode is OFF. This order will be submitted now. The preview is shown above for your review.
Your agent then proceeds to submission.
Step 19 — Submit the order.
Your agent sends the order to the paper trading API via your chosen execution method (SDK, REST, CLI, or MCP tool). The endpoint is POST /v2/orders against the paper base URL.
Step 20 — Capture the response. On success, your agent captures:
id (order ID)client_order_idstatus — usually new, meaning Alpaca received the order and routed it. accepted means received but not yet routed and is common outside trading hours; pending_new and accepted_for_bidding are documented as rarecreated_atsubmitted_atsymbol, side, qty, type, time_in_forceStep 21 — Handle submission failure. If the submission fails, your agent:
Captures the full error response (HTTP status code, error message, error code)
Shows you the error in plain language
Suggests specific remediation. POST /v2/orders documents exactly two error responses, and they do not mean what their generic HTTP names suggest:
403 Forbidden → insufficient buying power or shares, not an auth problem. Show current buying power versus required, or current position versus the quantity being sold422 Unprocessable Entity → input parameters not recognized. Show which ones, and check them against the per-asset-class matrix in section 2429 Too Many Requests → rate limited; honor Retry-After and back off401 Unauthorized → credential problem. Stop; do not retry with the same credentialsA non-tradable or unknown symbol surfaces as 422 from the order endpoint, not 404. Your agent validates the symbol against GET /v2/assets/{symbol_or_asset_id} beforehand, where a genuinely unknown symbol does return 404. Crypto requires the old symbology without a slash (BTCUSD), and any slash that remains must be URL-encoded (/v2/assets/BTC%2FUSDT) or the request is malformed.
Saves the failed attempt to the session log
Does NOT automatically retry for non-idempotent submissions. If it's unclear whether the order was received (e.g., network timeout), your agent checks existing orders by client_order_id first.
Step 22 — Fetch order status.
Immediately after a successful submission, your agent fetches the order by ID (GET /v2/orders/{id}) to confirm the current status.
Step 23 — Return post-submission summary. Your agent shows you:
Order submitted successfully.
Order ID: b1e2f3a4-5678-9012-cdef-abcdef123456
Status: accepted
Symbol: AAPL
Side: buy
Qty: 10
Type: limit
Limit Price: $185.50
TIF: day
Submitted at: 2026-07-26T15:30:00Z
Environment: PAPER
Next steps:
- Ask me to check the status of this order
- Ask me to cancel this order
- Ask me to show your current positions
- Ask me to show your portfolio summaryStep 24 — Order lifecycle updates.
Your agent tracks the order through its lifecycle and reports each transition:
Filled:
✅ Order FILLED
Order ID: b1e2f3a4-...
Symbol: AAPL
Side: buy
Filled Qty: 10 shares
Avg Fill Price: $185.32
Fill Time: 2026-07-26T15:30:05Z
Portfolio impact:
- AAPL position: 10 shares @ $185.32 (new position)
- Position value: $1,853.20
- Portfolio %: 1.85% of equity
- Buying Power: $98,146.80 (was $100,000.00)Partially filled:
⏳ Order PARTIALLY FILLED
Order ID: b1e2f3a4-...
Filled: 6 of 10 shares
Avg Fill Price: $185.35
Remaining: 4 shares (still working)Rejected:
❌ Order REJECTED
Order ID: b1e2f3a4-...
Reason: insufficient buying power
Details: Required ~$1,855.00, available $500.00
Remediation:
- Reduce order quantity
- Close existing positions to free buying power
- If this is unexpected, check your account for pending orders
consuming buying powerCanceled:
🚫 Order CANCELED
Order ID: b1e2f3a4-...
Canceled by: system
Reason: day order expired at market close (16:00 ET)
If you still want this position, consider:
- Resubmitting as a GTC order
- Waiting for the next market openReplaced:
🔄 Order REPLACED
Old Order ID: b1e2f3a4-...
New Order ID: c2d3e4f5-...
Changed:
Limit Price: $185.50 → $186.00
Quantity: 10 → 15Step 25 — Fetch updated positions and account.
After a fill, your agent retrieves the current positions (GET /v2/positions) and account (GET /v2/account) to show the impact.
Step 26 — Show portfolio risk summary.
┌─────────────────────────────────────────┐
│ PORTFOLIO RISK SUMMARY │
├──────────────┬──────────────────────────┤
│ Total Equity │ $100,050.00 │
│ Buying Power │ $98,146.80 │
│ Open Pos. │ 4 positions │
│ Open Orders │ 1 working │
│ │
│ Position Concentration: │
│ AAPL │ 1.85% ($1,853.20) │
│ MSFT │ 3.20% ($3,201.00) │
│ TSLA │ 2.10% ($2,100.50) │
│ BTC/USD │ 5.00% ($5,002.30) │
│ │
│ Unrealized P&L (total): +$50.00 │
└──────────────┴──────────────────────────┘abs(position.market_value) / equity × 100 — the Position field is market_value. (position_market_value exists only on the account payload as an all-positions aggregate.)(current_price - avg_entry_price) × qtyThis phase is optional. Your agent provides this guidance only when you ask about deploying or automating a strategy.
Step 27 — Provide deployment options.
If you ask how to deploy or automate the strategy, your agent outlines these paths:
Local scheduler:
cron (Linux/macOS), launchd (macOS), or Windows Task Scheduleralpaca-py that encapsulates the strategy logicCloud hosting:
Webhook-based:
Every deployed path asserts paper at startup. Scheduling, hosting, and webhook triggers differ, but they share one requirement: the artifact that runs unattended proves it is pointed at paper before it can place an order, and exits if it cannot. There is no operator watching to catch a wrong endpoint, and a live account returns the same response shape as a paper one, so nothing downstream will reveal the mistake.
Two rules make that assertion trustworthy:
alpaca-py that means constructing the client as TradingClient(key, secret, paper=True) with paper=True written literally, never paper=os.getenv(...).Naming a credential or variable "paper" is not evidence. Only the resolved endpoint is.
Important notes your agent always includes:
https://api.alpaca.markets without the paper- prefix, or the SDK/CLI profile is set to live — it must STOP and warn you immediately.client_order_id on every order to prevent duplicate submissions.client_order_id before retrying.client_order_id values are logged in the session's orders.json for audit.X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset; your agent slows down as Remaining approaches zero instead of waiting to be throttled. A figure of 200 requests per minute is widely cited for the Trading API but is not stated in Alpaca's current documentation, so do not hard-code it.X-RateLimit-Reset.US Equity:
extended_hours: true on a limit order with day or gtc TIF, and cover three sessions:fractionable attribute)US Options:
Crypto:
POST /v2/orders, 403 means the tradable balance or share count is insufficient — it is not an auth failure. Show current buying power, required notional, and the shortfall. Suggest reducing quantity or closing positions.422. Show the asset status and suggest checking the symbol. Offer to search for the correct symbol. GET /v2/assets/{symbol_or_asset_id} is the place a 404 legitimately appears.GET /v2/clock).client_order_id) before deciding whether to retry.Order submitted successfully.
Order ID: {order_id}
Status: {status}
Symbol: {symbol}
Side: {side}
Qty: {qty}
Type: {order_type}
TIF: {time_in_force}
Submitted at: {submitted_at}
Environment: PAPER
Next steps:
- Ask me to check the status of this order
- Ask me to cancel this order
- Ask me to show your current positions
- Ask me to show your portfolio summaryWhen the skill is used as part of a session with multiple orders, your agent writes session artifacts to a run folder:
runs/<YYYYMMDD-HHMMSS>-paper-trading/
notes.md # strategy context, confirmation choices, assumptions
orders.json # all orders submitted in this session
order_log.csv # timeline: order_id, timestamp, event, status, details
positions_snapshot.json # positions after last fill
portfolio_summary.md # human-readable portfolio state
review.md # session review and open questionsFile descriptions:
| File | Content | Format |
|---|---|---|
notes.md | Strategy description, signal source, confirmation preferences, assumptions made, risk controls applied | Markdown |
orders.json | Array of all orders submitted, including request payload and response | JSON |
order_log.csv | Chronological event log: order_id, timestamp, event_type, status, details | CSV |
positions_snapshot.json | Positions at the end of the session (from GET /v2/positions) | JSON |
portfolio_summary.md | Human-readable portfolio state: equity, buying power, positions, concentration, P&L | Markdown |
review.md | Session review: what worked, what didn't, open questions, suggested improvements | Markdown |
Validate behavior against:
Run these tests mentally or against a paper account whenever modifying this skill.
Important disclosure: This material is for informational, educational, and research purposes only. It is not investment advice, a recommendation, an offer, or a solicitation to buy or sell securities, options, cryptocurrencies, or any other financial product. All investing and trading involve risk, including possible loss of principal. Paper trading is simulated and may differ from live trading in fills, market impact, liquidity, fees, latency, and other factors. Review Alpaca's disclosures at https://alpaca.markets/disclosures.
Your agent includes this disclosure in every session summary, report, and portfolio review.
When options are involved, your agent includes:
When crypto is involved, your agent includes:
APCA_API_KEY_ID, APCA_API_SECRET_KEY), SDK configuration files, or CLI profile settings.client_order_id for idempotency).| File | Description |
|---|---|
reference.md | API endpoint details, order schemas, status lifecycle diagrams, error codes |
| Skill | Description |
|---|---|
alpaca-trading-paper-trading-cli | CLI-specific version using the Alpaca CLI |
alpaca-trading-paper-trading-mcp | MCP-specific version using Alpaca MCP server tools |
| Skill | Description |
|---|---|
alpaca-trading-backtest | Run historical backtests that produce signals for this skill |
© alpacahq, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file in skills/trading-api/paper-trading of alpacahq/alpaca-skills.
Open the folder on GitHubat commit 39111ab
Alpaca Trading Paper Trading next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Alpaca Trading Paper Trading this skillalpacahq/alpaca-skills | 154 | — | ~11k | Automated safety check: Pass | Apache-2.0 | |
| Alpaca Tradinggauss314/skills | 248 | — | ~2.4k | Automated safety check: Pass | MIT | |
| Tushare Datazillionare/zillionare | 322 | 2 repos | ~2.3k | Automated safety check: Pass | None | |
| Tradingview MCPatilaahmettaner/tradingview-mcp | 5k | — | ~1.3k | Automated safety check: Pass | MIT | |
| Digital Oraclekomako-workshop/digital-oracle | 878 | — | ~5.9k | Automated safety check: Pass | MIT | |
| Polyclawchainstacklabs/polyclaw | 359 | 1 repos | ~2k | Automated safety check: Pass | Apache-2.0 |
gauss314/skills
Trading API de Alpaca: órdenes, posiciones, cuenta. An agent skill from gauss314/skills.
zillionare/zillionare
面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。
atilaahmettaner/tradingview-mcp
AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…
komako-workshop/digital-oracle
Answer prediction questions using market trading data, not opinions.
chainstacklabs/polyclaw
Trade on Polymarket via split + CLOB execution. An agent skill from chainstacklabs/polyclaw.
facioquo/stock-indicators-dotnet
Format and lint Markdown in this repository against GitHub Flavored Markdown and its markdownlint-cli2 configuration — headers, lists, code fences, callouts (VitePress containers on docs-site pages…
alpacahq/alpaca-skills
Open and manage brokerage accounts via the Alpaca Broker API — account creation, KYC/CIP, identity & disclosures, agreements, document upload (incl.
alpacahq/alpaca-skills
Move money between an Alpaca brokerage account and the EXTERNAL banking world via the Broker API — ACH relationships, wire recipient banks, classic transfers (deposits/withdrawals), the v1beta…
alpacahq/alpaca-skills
Entry point for integrating with the Alpaca Broker API (plus Market Data and Trading APIs) in any programming language.
alpacahq/alpaca-skills
Move cash (JNLC) and securities (JNLS) BETWEEN accounts inside your own Alpaca omnibus via the Broker API — single, batch, and reverse-batch journals, the Idempotency-Key header, journal status…
alpacahq/alpaca-skills
Handle money and numeric precision correctly with the Alpaca API — numbers-as-strings on the wire, decimals vs floats, rounding/truncation before sending amounts, fractional-share precision, and…
alpacahq/alpaca-skills
Make Alpaca API clients resilient — rate-limit header handling, HTTP 429 backoff, exponential retry, bounded concurrency/worker pools, pagination loops, batch sizing, and timeouts.
Works with
Categories
Preview, submit, inspect, and manage Alpaca paper-trading orders across US equities, options, and crypto. Alpaca Trading Paper Trading is an agent skill from alpacahq/alpaca-skills. Preview, submit, inspect, and manage Alpaca paper-trading orders across US equities, options, and crypto.
Alpaca Trading Paper Trading fits situations like: you want your AI agent to take a strategy signal — from a backtest; automated system — and execute it safely in your Alpaca paper-trading environment.
Run `npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a claude-code`. Or copy the skill folder (skills/trading-api/paper-trading in alpacahq/alpaca-skills) into .claude/skills/alpaca-trading-paper-trading in your project. Claude Code loads it when a task matches its description.
Run `npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a codex`. Or copy the skill folder (skills/trading-api/paper-trading in alpacahq/alpaca-skills) into .agents/skills/alpaca-trading-paper-trading in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add alpacahq/alpaca-skills --skill alpaca-trading-paper-trading -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/alpaca-trading-paper-trading, .gemini/skills/alpaca-trading-paper-trading, .github/skills/alpaca-trading-paper-trading and .opencode/skills/alpaca-trading-paper-trading in your project.
Going by SKILL.md and its folder, Alpaca Trading Paper Trading needs credentials named APCA_API_KEY_ID and APCA_API_SECRET_KEY. Our summary lists: Python 3; A credential in APCA_API_SECRET_KEY.
SKILL.md names 4 domains. In commands or code: paper-api.alpaca.markets and api.alpaca.markets; the agent is likely to contact these when it follows the instructions. As links in the text: docs.alpaca.markets and alpaca.markets. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Alpaca Trading Paper Trading is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 11k tokens (SKILL.md is roughly 42k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Alpaca Trading Paper Trading: Alpaca Trading (gauss314/skills, 248 stars), Tushare Data (zillionare/zillionare, 322 stars), Tradingview MCP (atilaahmettaner/tradingview-mcp, 5k stars) and Digital Oracle (komako-workshop/digital-oracle, 878 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
alpacahq (a GitHub organization) maintains it in alpacahq/alpaca-skills, which has 154 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on September 8, 2026.
Source: alpacahq/alpaca-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.