alpaca-broker-money-precision

alpaca-broker-money-precision is a skill for Claude Code, Codex from alpacahq/alpaca-skills. It costs 69 tokens per session (1,125 once invoked), scanned A, original, Apache-2.0.

A set of rules for handling money and numeric values safely when using the Alpaca trading API. Alpaca is a service that provides stock-trading and market-data APIs.

In plain words
What is it for?
It is for storing, calculating, rounding, and sending Alpaca prices, order quantities, notional amounts, and fractional-share values.
Why use it?
It prevents rounding errors and loss of decimal accuracy when prices, quantities, and money amounts move between the API and an application.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for storing, calculating, rounding, and sending Alpaca prices, order quantities, notional amounts, and fractional-share values.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alpacahq/alpaca-skills/money-precision
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alpacahq/alpaca-skills --skill money-precision
Clone the repo
git clone --depth 1 https://github.com/alpacahq/alpaca-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for alpaca-broker-money-precision

README.md
[![agentmods](https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/money-precision/github.svg)](https://agentmods.dev/skills/alpacahq/alpaca-skills/money-precision)
Your own site
<a href="https://agentmods.dev/skills/alpacahq/alpaca-skills/money-precision"><img src="https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/money-precision/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for alpaca-broker-money-precision

Your own site · 80×15
<a href="https://agentmods.dev/skills/alpacahq/alpaca-skills/money-precision"><img src="https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/money-precision.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,125 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00069 $0.01125
Opus 5 $0.00034 $0.00562
Sonnet 5 $0.00014 $0.00225
Haiku 4.5 $0.00007 $0.00112

Measured 12d ago against content hash 1dc6f4f5db91, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

alpaca-broker-money-precision scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/broker-api/money-precision/SKILL.md · 69 lines

How it starts

The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Alpaca — Money & Numeric Precision

Financial bugs are silent and expensive. Alpaca's wire format and the realities of decimal arithmetic create a few specific traps. This skill is short, opinionated, and language-agnostic.

Read alpaca-broker-integration first.

1. Numbers come as strings — keep them that way

Alpaca returns prices, quantities, notional, and money amounts as JSON strings ("100.50", "1.5", "190.2345"), and accepts them as strings on the way in. This is deliberate: it avoids the precision loss of JSON's binary floats.

Rule: parse string money fields into a decimal type, never a binary float/double. Serialize back to a string. Don't let a number ever live as an IEEE-754 float in the money path.

Language Use Avoid
Python decimal.Decimal("100.50") float("100.50")
TypeScript/JS a decimal lib (decimal.js/big.js) or string arithmetic Number(...), parseFloat
Go shopspring/decimal float64 for accumulation
Java/Kotlin java.math.BigDecimal double

Real-world caveat: not every Alpaca endpoint is consistent — some market-data numeric fields come as JSON numbers (e.g. bar OHLC). Prices for display/analytics can tolerate floats; money you move or store must not. Know which field you're touching.

2. Round/truncate before sending — and know the direction

Alpaca generally accepts 2 decimal places for cash amounts and up to 9 for fractional share qty/notional. If you send more precision than allowed, you risk rejection or silent rounding on their side.

Rule: explicitly round/truncate to the target precision before the API call, using a deliberate rounding mode.

  • For money you're moving out / charging, truncate (round down) to 2 dp so you never move more than intended. (e.g. floor(amount * 100) / 100.)
  • Pick the rounding mode consciously (ROUND_DOWN vs ROUND_HALF_UP) — don't inherit whatever the default float formatting does.
  • Re-round after every arithmetic step that could reintroduce precision (e.g. computing amount * percentage for a split allocation), not just at the end.

Read the full file on GitHub · 69 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 69 lines · 69 tokens per session scan A 1dc6f4f5db91

Subscribe to this mod's changes

alpaca-broker-money-precision is a skill published in the GitHub repository alpacahq/alpaca-skills (147 stars, last pushed 3d ago), licensed Apache-2.0. It adds 69 tokens to every session and 1,125 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.