alpaca-broker-trading-orders-1qn8
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "alpaca-broker-trading-orders-1qn8":https://skillpi.com/zh/skills/deepskill-a73f1eced4e2dcb0df5ae6929ceec13f88296fd171c9a4390fb0247d084cf1e7。安装前核对上游来源和版本:https://skillhub.cn/skills/user_3c6cb52e/alpaca-broker-trading-orders-1qn8。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skillhub.cn
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Alpaca券商交易订单技能,辅助AI Agent进行投资分析与交易决策,面向需要下单与分析支持的智能代理。
介绍来源: third_party · user_3c6cb52e · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: Alpaca券商交易订单
slug: alpaca-broker-trading-orders
version: 1.0.0
displayName: Alpaca券商交易订单
description: >
Alpaca券商交易订单技能,帮助AI Agent进行投资分析和交易决策。
summary: "Place and manage orders on behalf of accounts via the Alpaca Broker API — order creation (qty vs notional, fractional shares, order types/TIF/classes), order status lifecycle, replace/cancel, position..."
license: MIT
category: 量化交易
framework:
- Claude Code
- Codex
- Hermes Agent
- OpenClaw
- QClaw
- WorkBuddy
platform: multi-platform
homepage: https://github.com/1991513ccie-png
repository: https://github.com/1991513ccie-pngAlpaca Broker API — Trading on Behalf of Accounts
Place, modify, cancel, and track orders for an end-user account, and read positions & buying power. The defining feature of Broker API trading: account_id is in the path — you act for a user account, not your own.
Read
alpaca-broker-integrationfirst. Broker API + HTTP Basic auth. (The standalone Trading API uses/v2/orderswith no account in the path; everything else here transfers.)
Reference
- Guides:
https://docs.alpaca.markets/docs/orders-at-alpaca,https://docs.alpaca.markets/docs/fractional-trading - API ref:
https://docs.alpaca.markets/reference/postorder - Live schema:
alpaca-docsMCP →get-endpointtitle"Broker API"path/v1/trading/accounts/{account_id}/orders
1. Endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/trading/accounts/{id}/orders |
Create order |
| GET | /v1/trading/accounts/{id}/orders |
List orders (filter by status, symbols, after…) |
| GET | /v1/trading/accounts/{id}/orders/{order_id} |
Get order by ID |
| GET | /v1/trading/accounts/{id}/orders:by_client_order_id?client_order_id=… |
Get by your client ID |
| PATCH | /v1/trading/accounts/{id}/orders/{order_id} |
Replace (modify) order |
| DELETE | /v1/trading/accounts/{id}/orders/{order_id} |
Cancel one order (204) |
| DELETE | /v1/trading/accounts/{id}/orders |
Cancel all (207 Multi-Status) |
| POST | /v1/trading/accounts/{id}/orders/estimation |
Cost-estimate an order |
| GET / DELETE | /v1/trading/accounts/{id}/positions[/{symbol_or_asset_id}] |
List / close positions |
| GET | /v1/trading/accounts/{id}/account |
Trading-account details (buying power etc.) |
2. Create-order request
Schema-required: type and time_in_force. Conditionally required: symbol, side, and exactly one of qty/notional.
// notional market buy (dollar-based, fractional)
{ "symbol": "AAPL", "notional": "25.00", "side": "buy", "type": "market", "time_in_force": "day",
"client_order_id": "your-own-uuid" }
// limit qty sell
{ "symbol": "AAPL", "qty": "3", "side": "sell", "type": "limit", "limit_price": "190.00", "time_in_force": "gtc" }
| Field | Values / notes |
|---|---|
symbol |
required (except mleg multi-leg options) |
qty |
decimal string, up to 9 dp. Fractional only for market+day |
notional |
decimal string, up to 9 dp. Mutually exclusive with qty |
side |
buy, sell (plus advanced: sell_short, …) |
type |
market, limit, stop, stop_limit, trailing_stop |
time_in_force |
day, gtc, opg, cls, ioc, fok |
limit_price / stop_price |
required for limit/stop variants |
trail_price / trail_percent |
one required for trailing_stop |
extended_hours |
bool; only with type=limit and TIF day/gtc |
client_order_id |
≤128 chars; your idempotency key (auto-generated if omitted) |
order_class |
simple (default), bracket, oco, oto, mleg |
take_profit / stop_loss |
{limit_price} / {stop_price, limit_price?} for bracket/oco/oto |
position_intent |
buy_to_open, sell_to_close, … |
qty XOR notional (verbatim rule): pass one or the other — supplying both → 400. In the response, whichever you didn't use comes back null.
3. Fractional / notional rules
- On by default for all accounts (live + paper).
- Asset must have
fractionable: true(check the Assets API — seealpaca-broker-market-data), elserequested asset is not fractionable. - TIF must be
dayfor fractional/notional. - Notional is limited to
marketandlimit(day); onlylimitfor extended hours. Fractionalqtyadditionally allowsstop/stop_limitper the guide. - No shorting fractional — all fractional sells are marked long.
- Precision: up to 9 decimal places for both
qtyandnotional.
4. Order status lifecycle
OrderStatus (the order object's status): new, partially_filled, filled, done_for_day, canceled, expired, replaced, pending_cancel, pending_replace, accepted, pending_new, accepted_for_bidding, stopped, rejected, suspended, calculated.
Order
status≠ trade-eventevent. The order object'sstatusis the enum above. The SSE trade-update stream reports a richereventenum that adds operational events not present as a status — includingheld(multi-leg secondary legs awaiting trigger),trade_bust,trade_correct,restated,order_cancel_rejected,order_replace_rejected. Soheldexists as a trade event but never as an order status. Seealpaca-broker-sse-events.
Terminal: filled, canceled, expired, rejected (and replaced for the original order). Everything else is in-flight.
Early-state distinctions (these trip people up):
accepted— received by Alpaca, not yet routed to a venue (common outside market hours).new— received and routed to exchanges; the usual initial live state.pending_new— routed but not yet accepted for execution (rare).
So the typical opening sequence is accepted → pending_new → new, then fills. Lesson: treat new/accepted/pending_new as "exists but not done." Persist the order on submit, then update on fill/cancel/reject events — don't block the user waiting for a terminal state synchronously.
5. Positions & trading account
Position key fields: symbol, asset_id, qty, qty_available (free of open orders), side (long/short), avg_entry_price, market_value, cost_basis, unrealized_pl, unrealized_plpc, current_price, change_today.
TradeAccount key fields:
buying_power(with marginmultiplier1–4),cash,cash_withdrawable,equity,last_equity.- Blockers:
trading_blocked,account_blocked,transfers_blocked,trade_suspended_by_user. multiplier,regt_buying_power,non_marginable_buying_power,long_market_value,initial_margin,maintenance_margin,sma.
Lesson — check buying power before notional orders. For a "spend $X" UX, read buying_power/cash first and reject/notify on insufficient funds, rather than letting Alpaca reject the order. (Cache it per account within a batch run to avoid re-fetching.)
PDT/day-trade fields are deprecated (since 2026-04-27, sunset 2026-07-06) following FINRA's intraday-margin rule change:
daytrade_count,pattern_day_trader,daytrading_buying_power,bod_dtbp, plus configdtbp_check/pdt_check. They still exist in the schema today but stop relying on them.
6. Documented gotchas
- Wash-trade rejection (403): if a user's two orders could self-cross (opposite sides, crossable prices), Alpaca rejects. Opposing market/stop pairs are always rejected; opposing limits rejected when buy-limit ≥ sell-limit. Use
bracket/oco/trailing_stopfor simultaneous take-profit + stop-loss — they're exempt. - Bracket constraints: requires both
take_profit.limit_priceandstop_loss.stop_price; TP must be above SL for a buy; no extended hours; TIFday/gtc; child legs activate only after the entry fully fills; canceling one cancels the group. - Notional orders can't be replaced — cancel and resubmit (IPO-class notional is the exception). Fractional
qtycan't be changed on replace ("full shares only"). - Replace ≠ guaranteed: a
200from PATCH can still be rejected if the original fills first; watch the trade-updates stream. Can't replace whileaccepted/pending_new/pending_cancel/pending_replace. - Cancel semantics: single cancel →
204, or422if no longer cancelable; cancel-all →207per-order results; close-all positions →207. Close-single accepts mutually-exclusiveqtyorpercentage.
7. Idempotency & recurring-invest lessons
- Always set
client_order_idfrom your own transaction record. It's your dedup key and lets you look the order up (orders:by_client_order_id) if the create response is lost. Note it dedups lookup, not necessarily replay — combine it with a local "already-submitted?" guard. - Recurring/scheduled buys (lesson): the robust pattern is — fetch pending invest instructions from your DB → check buying power → place a
notionalmarket/dayorder per instruction → record the returned order → mark the instruction done only after a successful create. On insufficient funds, cancel the instruction and notify, don't silently skip. Schedule the batch shortly before market open and respect the market clock (alpaca-broker-market-data). - Track fills via the trade events SSE stream, not by polling each order — see
alpaca-broker-sse-events.
Related skills: prices/assets/clock → alpaca-broker-market-data; fills in real time → alpaca-broker-sse-events; rate limits on bulk placement → alpaca-broker-rate-limits-resilience; money formatting → alpaca-broker-money-precision.
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 直接解决量化交易核心任务,具备高频刚需特性
- 提供完整的订单生命周期管理能力
- 支持多种订单类型和高级交易策略
亮点
- 触发词精准完整,覆盖多种变体
- 边界清晰,不易与其他Skill重叠
- description位置正确且内容完整
待提升项
-
文档长度 原报告严重程度:轻微
文档内容较为详尽,超过500行
改进建议:建议适当精简文档内容,保持核心信息即可
亮点
- Phase/步骤清晰,有出口条件
- 包含端到端示例,frontmatter完整
- 结构组织良好,易于理解执行流程
亮点
- 工具来源明确,参数正确
- 覆盖主要异常情况,不可逆操作有确认机制
- 提供了详细的错误处理和最佳实践指导
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- docs.alpaca.markets
- github.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。