alpaca-broker-money-precision
Handle money and numeric precision correctly with the Alpaca API — numbers-as-strings on the wire, decimals vs floats, rounding/truncation before sending amounts, fractional-share precision, and safe DB storage. Use when handling monetary amounts, order quantities, or prices in any Alpaca integration in any language.
npx skills add alpacahq/alpaca-skills --skill money-precision --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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.
- 1. Numbers come as strings — keep them that way
- 2. Round/truncate before sending — and know the direction
- 3. Fractional shares
- 4. Storage
- 5. Multi-currency notes
- 6. Checklist
What does the alpaca-broker-money-precision skill do?
Handle money and numeric precision correctly with the Alpaca API — numbers-as-strings on the wire, decimals vs floats, rounding/truncation before sending amounts, fractional-share precision, and safe DB storage. Use when handling monetary amounts, order quantities, or prices in any Alpaca integration in any language.
How do I install it?
Run `npx skills add alpacahq/alpaca-skills --skill money-precision --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From alpacahq/alpaca-skills, a repository with 106 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
