alpaca-skills-ruz4

A skill for a quantitative trading API skills library that helps an AI agent efficiently perform related tasks.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "alpaca-skills-ruz4" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-2615fc729144a05c6d198fe2d921cd886c1d9eac9f724c8715858a1ff88f0268. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/alpaca-skills-ruz4 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A skill for a quantitative trading API skills library that helps an AI agent efficiently perform related tasks.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: 量化交易API技能库
slug: alpaca-skills
version: 1.0.0
displayName: 量化交易API技能库
description: >
  量化交易API技能库专用技能,帮助AI Agent高效完成相关任务。
summary: "量化交易API技能库专用技能,帮助AI Agent高效完成相关任务。"
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-png"

Alpaca Skills — 交易与券商 API 技能库

概述

Alpaca Skills 是为 Alpaca Trading API 和 Broker API 设计的 Agent 技能集。每个技能包含 SKILL.md(工作流)+ reference.md(模式、公式、CLI 细节)的文件对。

核心特性:Trading API 技能面向自有账户交易;Broker API 技能面向代客操作——account_id 在路径中,你代表用户账户操作。

适用场景

  • 构建基于 Alpaca 的交易机器人或自动化策略
  • 集成 Broker API 进行代客开户和订单管理
  • 需要回测、纸交易或实盘交易的工作流
  • 处理市场数据订阅、订单生命周期和对账

使用方法

技能架构

路径 用途
skills/trading-api/ Trading API 代理技能
skills/broker-api/ Broker API 代理技能
templates/skill/ 贡献者脚手架

命名规则

技能名称格式:alpaca-<product-scope>-<skill-name>

  • <product-scope>:trading 或 broker(不包含 api)
  • 示例:alpaca-trading-backtest、alpaca-broker-trading-orders

Broker API 核心技能

交易订单管理(trading-orders)

用法:POST /v1/trading/accounts/{id}/orders

// 名义金额市价买入(支持碎股)
{ "symbol": "AAPL", "notional": "25.00", "side": "buy", "type": "market", "time_in_force": "day" }

// 限价数量卖出
{ "symbol": "AAPL", "qty": "3", "side": "sell", "type": "limit", "limit_price": "190.00", "time_in_force": "gtc" }

关键规则:

  • qty 和 notional 互斥——同时提供会返回 400
  • 碎股/名义金额交易的 TIF 必须为 day
  • 碎股不支持做空
  • 精度:qty 和 notional 最多 9 位小数

订单状态生命周期:

状态 含义
accepted 已接收,未路由到交易所
new 已路由到交易所
partially_filled 部分成交
filled 完全成交(终态)
canceled 已取消(终态)
rejected 被拒绝(终态)

常见陷阱:

  • 洗单拒绝(403):使用 bracket/oco/trailing_stop 避免自成交
  • 名义订单不可替换:取消后重新提交
  • 替换不保证成功:原始订单可能先成交
  • 始终设置 client_order_id:作为幂等键和去重标识

其他 Broker API 技能

技能 用途
market-data 市场数据(报价、快照、K 线、交易流)
account-onboarding 账户开通(KYC、文档提交)
funding-transfers 资金转账和 ACH 操作
reconciliation-idempotency 对账和幂等性保证
rate-limits-resilience 速率限制和弹性策略
money-precision 金额精度和格式化
journals 内部转账日志
sse-events 实时 SSE 事件流(交易更新、账户更新)
integration 认证和集成指南

Trading API 技能

技能 用途
backtest 策略回测框架

安全与合规

  • 永远不要提交 API 密钥——优先使用环境变量(ALPACA_API_KEY、ALPACA_SECRET_KEY)
  • 交易技能必须在输出中包含免责声明
  • 使用相对路径引用(reference.md),不要使用绝对安装路径

常见问题与陷阱

问题 解决方案
订单被 403 拒绝 检查是否触发洗单——使用 bracket/oco/trailing_stop
碎股交易失败 确认 TIF 为 day,资产 fractionable: true
替换订单后仍被取消 原始订单可能先成交——监听 SSE 事件流
PDT/日内交易字段废弃 自 2026-04-27 起废弃,不再依赖
new/accepted/pending_new 混淆 都视为"已存在但未完成"——提交后异步等待终态

验证清单

  • [ ] API 密钥通过环境变量配置,未硬编码
  • [ ] 交易技能输出包含免责声明
  • [ ] qty/notional 互斥规则已遵守
  • [ ] 碎股交易 TIF 设为 day
  • [ ] client_order_id 已设置(幂等键)
  • [ ] 使用 SSE 事件流跟踪订单状态而非轮询

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 提供完整的量化交易API技能库,涵盖Trading API和Broker API两大核心场景
  • 包含订单管理、市场数据、账户开通等高价值功能模块
  • 面向专业交易自动化需求,解决用户明确的API集成痛点
Trigger Precision95/100

Highlights

  • description精准描述量化交易API技能库的核心价值
  • 触发词覆盖量化交易、API集成、AI Agent等关键场景
  • 边界清晰,无歧义或重叠风险
Structure and Standards95/100

Highlights

  • 文档结构完整,包含概述、场景、方法、架构、规则等系统章节
  • 提供详细的API调用示例和参数说明
  • frontmatter完整,包含版本、分类、框架等关键信息
Execution Reliability95/100

Highlights

  • 强调环境变量配置,避免API密钥硬编码
  • 提供完整的订单状态生命周期和常见陷阱解决方案
  • 包含验证清单和幂等性保证等可靠性措施
Evidence Verifiability (mean of the first four)95/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.