alpaca-broker-journals-sh-worzpx

A skill dedicated to Alpaca broker journals, intended to help an AI Agent efficiently perform tasks related to Alpaca broker journals.

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-broker-journals-sh-worzpx" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-f43280e3c9ebf2103899872774ef7625b5c237873392901ba896eea8cda0fc6f. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/alpaca-broker-journals-sh-worzpx 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 dedicated to Alpaca broker journals, intended to help an AI Agent efficiently perform tasks related to Alpaca broker journals.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
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`).
Limits and differences
**Eligibility:** the cash-pooling/journals use case requires Alpaca review and possibly a local license — check with counsel. **JNLS account states:** `to_account` must be `ACTIVE`; `from_account` must be `ACTIVE` or `CLOSE`. **Sufficient funds:** JNLC create → `403` if the amount isn't available; reverse-batch `403` = insufficient balance/assets. **Daily limits push to `pending`** (manual ops approval). **`GET /v1/journals` returns `422` if the result set exceeds 100,000 records** — always filter with `after`/`before`/`limit`. **Delete is pending-only:** `DELETE` succeeds (204) only when `pending`; an executed journal → `422`. **To reverse an executed journal, create a mirror journal in the
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: Alpaca券商日志
slug: alpaca-broker-journals
version: 1.0.0
displayName: Alpaca券商日志
description: >
  Alpaca券商日志专用技能,帮助AI Agent高效完成相关任务。
summary: "Alpaca券商日志专用技能,帮助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 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-integration first. 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-docs MCP → get-endpoint title "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:

  1. executed ≠ final. Don't treat executed as irreversible — Alpaca cashiering can reverse a journal that wasn't permitted. Reconcile against later events.
  2. correct creates 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 to correct/cancelled while a different ID carries the real funds. Handle both. (This is why event consumers must be idempotent and ID-keyed — see alpaca-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_account must be ACTIVE; from_account must be ACTIVE or CLOSE.
  • Sufficient funds: JNLC create → 403 if the amount isn't available; reverse-batch 403 = insufficient balance/assets.
  • Daily limits push to pending (manual ops approval).
  • GET /v1/journals returns 422 if the result set exceeds 100,000 records — always filter with after/before/limit.
  • Delete is pending-only: DELETE succeeds (204) only when pending; 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 simulate rejected/pending outcomes 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.

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 Value82/100

Highlights

  • 提供 Alpaca 券商日志的完整 API 封装,涵盖 JNLC/JNLS 转账、批量操作、状态管理、SSE 事件流等核心功能
  • 面向量化交易开发者,解决实际资金划转与对账痛点,具备高实用价值
Trigger Precision95/100

Highlights

  • description 明确说明为 'Alpaca券商日志专用技能',功能边界清晰(仅账户间划转,不涉及外部银行)
  • 触发词精准,覆盖多种使用场景,无歧义
Structure and Standards90/100

Highlights

  • 文档结构完整,含端到端示例、状态机说明、约束条件、相关技能链接
  • frontmatter 完整,单文件未超限,符合规范
Execution Reliability88/100

Highlights

  • 工具来源明确(Alpaca Broker API),参数说明详尽
  • 覆盖主要异常处理、幂等性机制、状态生命周期、反向操作指导,可靠性高
Evidence Verifiability (mean of the first four)89/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.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

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.

  • docs.alpaca.markets
  • 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.