alpaca-broker-money-precision

Installation
SKILL.md

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
Installs
80
GitHub Stars
143
First Seen
Jun 30, 2026
alpaca-broker-money-precision — alpacahq/alpaca-skills