alpaca-broker-journals
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "alpaca-broker-journals":https://skillpi.com/zh/skills/deepskill-bccebcd5be4739d8b5bd26b6915e6378d91e978f9e8a965c119923b9bf9321d3。安装前核对上游来源和版本:https://skillhub.cn/skills/user_3c6cb52e/alpaca-broker-journals。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skillhub.cn
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
在Alpaca托管账户内通过Broker API在账户之间移动现金(JNLC)和证券(JNLS)的专用技能,支持单笔、批量和反向批量流水、Idempotency-Key头以及流水状态生命周期相关任务。
介绍来源: third_party · user_3c6cb52e · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: "Alpaca券商日志"
slug: alpaca-broker-journals
version: "1.0.0"
displayName: "Alpaca券商日志"
summary: "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 lifecy..."
license: "MIT"
description: "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 lifecycle including corrections, and the firm/sweep-account pattern that powers instant funding and share rewards. Use for internal account-to-account movement in any language. For deposits/withdrawals to EXTERNAL banks, use funding-transfers instead."
category: "Quantitative Trading"
framework: "Multi-Framework"Alpaca Broker API — Journals
Journals move value between two accounts within your own Alpaca omnibus — typically between a pre-funded firm/sweep account and a user account. They are the engine behind "instant funding," cashback, and share rewards. They never touch the outside banking world (that's alpaca-broker-funding-transfers).
Read
alpaca-broker-integrationfirst. Broker API + HTTP Basic auth.
Reference
- Guide:
https://docs.alpaca.markets/docs/funding-via-journals - API ref:
https://docs.alpaca.markets/reference/createjournal - Live schema:
alpaca-docsMCP →get-endpointtitle"Broker API"path/v1/journals
1. Endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/journals |
Single journal (JNLC cash or JNLS shares) |
| POST | /v1/journals/batch |
One source → many destinations (JNLC only) |
| POST | /v1/journals/reverse_batch |
Many sources → one destination (JNLC only) |
| GET | /v1/journals |
List (filters: after, before, status, entry_type, to_account, from_account, limit) |
| GET | /v1/journals/{journal_id} |
Retrieve one |
| DELETE | /v1/journals/{journal_id} |
Cancel a pending journal (204) |
| GET | /v2/events/journals/status |
SSE journal status stream (v1 is legacy) |
2. JNLC vs JNLS
entry_type is exactly "JNLC" or "JNLS".
JNLC— cash. Moves USD between accounts. Allowed firm ↔ user, both directions. Not customer-to-customer.JNLS— securities. Moves whole/fractional shares. Allowed firm → user only. Used for signup/referral share rewards.
// JNLC (cash)
{ "entry_type": "JNLC", "from_account": "<firm-uuid>", "to_account": "<user-uuid>", "amount": "100.00" }
// JNLS (shares)
{ "entry_type": "JNLS", "from_account": "<firm-uuid>", "to_account": "<user-uuid>", "symbol": "AAPL", "qty": "0.5" }
| Field | JNLC | JNLS | Notes |
|---|---|---|---|
from_account / to_account |
required | required | account UUIDs |
amount |
required | — | decimal string |
symbol / qty |
— | required | qty is a string; fractional allowed |
currency |
optional | optional | defaults USD |
description |
optional | optional | ≤1024 chars; accepts sandbox fixtures |
transmitter_* |
optional (JNLC) | n/a | Travel Rule fields |
Responses: 200 journal · 403 amount/assets not available · 404 account not found · 422 idempotency-key reused with a different body.
3. Idempotency-Key header — USE IT
Pass an Idempotency-Key header (≤128 chars; a client-generated UUID is recommended) on journal creates.
- Same key + identical body → returns the original journal (no duplicate).
- Same key + different body →
422.
Lesson: this is the correct way to make money movement retry-safe. Without it, a network timeout on POST /v1/journals leaves you unsure whether the cash moved — and a blind retry can double-fund. Generate the key deterministically from your own transaction ID and send it on every attempt.
4. Batch vs reverse-batch (JNLC only, all-or-nothing)
Batch — one-to-many (fan a sweep account out to many users):
{ "entry_type": "JNLC", "from_account": "<firm-uuid>",
"entries": [ { "to_account": "<u1>", "amount": "1000" }, { "to_account": "<u2>", "amount": "250" } ] }
Reverse batch — many-to-one (pull cash from many users back to the firm account):
{ "entry_type": "JNLC", "to_account": "<firm-uuid>",
"entries": [ { "from_account": "<u1>", "amount": "10" }, { "from_account": "<u2>", "amount": "100" } ] }
Every entry must validate or the entire batch fails (one bad account ID kills it). The response is an array of BatchJournalResponse (the Journal object + an error_message per entry that failed). Idempotency-Key is supported with the same semantics.
5. Status lifecycle
JournalStatus: queued, sent_to_clearing, pending, executed, rejected, canceled, refused, deleted, correct.
Happy path: queued → sent_to_clearing → executed.
| Status | Meaning | Terminal |
|---|---|---|
queued |
In queue | no |
sent_to_clearing |
Submitted to books-and-records | no |
pending |
Needs Alpaca ops approval (e.g. hit a JNLC daily limit) | no |
executed |
Balances updated — but NOT final, can still be reversed by cashiering | no (not final) |
rejected |
Manually rejected | no |
refused |
Failed preliminary checks; never hit the ledger (e.g. a fast replay failing the balance check) | no |
canceled |
Canceled via API/ops | FINAL |
deleted |
Removed from ledger | FINAL |
correct |
A prior executed journal was cancelled and re-created with a corrected amount | FINAL |
Two critical lessons:
executed≠ final. Don't treatexecutedas irreversible — Alpaca cashiering can reverse a journal that wasn't permitted. Reconcile against later events.correctcreates a NEW journal ID. A correction cancels the original and issues a new journal with the corrected amount — it is not an in-place edit. If you reconcile by journal ID, the original ID transitions tocorrect/cancelled while a different ID carries the real funds. Handle both. (This is why event consumers must be idempotent and ID-keyed — seealpaca-broker-reconciliation-idempotency.)
6. SSE journal events
GET /v2/events/journals/status pushes JournalStatusEventV2: event_id (ULID, sortable), journal_id, entry_type, status_from, status_to, description, idempotency_key, idempotency_key_type (single|batch), batch_error_message. Replay rules: since required if until set; since_id required if until_id set; can't mix since with since_id. Without a since/since_id, no history is returned. See alpaca-broker-sse-events.
7. Constraints & gotchas
- Eligibility: the cash-pooling/journals use case requires Alpaca review and possibly a local license — check with counsel.
- JNLS account states:
to_accountmust beACTIVE;from_accountmust beACTIVEorCLOSE. - Sufficient funds: JNLC create →
403if the amount isn't available; reverse-batch403= insufficient balance/assets. - Daily limits push to
pending(manual ops approval). GET /v1/journalsreturns422if the result set exceeds 100,000 records — always filter withafter/before/limit.- Delete is pending-only:
DELETEsucceeds (204) only whenpending; an executed journal →422. To reverse an executed journal, create a mirror journal in the opposite direction, don't try to delete it. - Travel Rule: include transmitter info on money-moving journals (required on all incoming deposits regardless of amount).
- Sandbox fixtures: put fixtures in
description(e.g./fixtures/status=rejected/fixtures/) to simulaterejected/pendingoutcomes for testing.
8. The sweep-account funding pattern (why journals exist)
The canonical Broker API funding architecture:
Bulk external wire ──> FIRM / SWEEP account (pre-funded) ──JNLC──> user accounts (instant)
user account ──JNLC──> FIRM account ──external wire/ACH──> outside world (withdrawal)
You collect money your own way, hold it in a firm account, and journal it to users instantly rather than running a per-user external transfer. Withdrawals reverse the flow. This is what makes "instant deposit" UX possible on top of slow banking rails.
Related skills: external money in/out → alpaca-broker-funding-transfers; retry-safety & corrections → alpaca-broker-reconciliation-idempotency; decimal handling → alpaca-broker-money-precision; events → alpaca-broker-sse-events.
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Alpaca 券商内部账户间现金与证券划转的完整生产级解决方案
- 覆盖单笔、批量、反向批量操作及幂等性控制,解决‘即时入金’等核心业务痛点
- 详细说明状态生命周期与事件流监听,具备高实用价值
待提升项
-
触发词未独立字段化 原报告严重程度:轻微
description 内容完整但未在 frontmatter 中提供独立的触发词字段(如 keywords/triggers)
改进建议:建议在 frontmatter 中添加 keywords 字段以提升平台自动匹配精度
亮点
- 功能边界清晰,明确区分内部划转与外部银行出入金场景
待提升项
-
缺少显式 When to Use 章节 原报告严重程度:轻微
文档实质包含使用场景说明但未使用显式章节标题
改进建议:建议添加 'When to Use' 章节以提升可读性
亮点
- 结构清晰,8 个章节完整覆盖端到端流程
- 包含状态机、约束条件、最佳实践及多语言适用说明
亮点
- 工具来源明确,参数定义准确,覆盖主要异常状态与错误码
- 对幂等性、撤销机制、事件监听等关键可靠性问题有详细说明
- 明确警告 executed 状态非最终并提供应对建议
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- docs.alpaca.markets
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。