Several response-model fields used DollarDecimal even though their wire
alias is `_fp` (FixedPointCount). The annotation falsely signaled "dollar
amount" for what are semantically share/contract counts. Both validators
are byte-identical today — runtime behavior unchanged — but if either
parser ever diverges (per-family scale factor, different precision rule)
every mistyped field silently breaks.
Swapped:
- Market: yes_bid_size, yes_ask_size, no_bid_size, no_ask_size, volume,
volume_24h, open_interest
- Candlestick: volume, open_interest
- OrderbookLevel: quantity
- Fill: count
- Trade: count
- MarketPosition: position
- EventPosition: total_cost_shares
- Settlement: yes_count, no_count
- Series: volume
Both DollarDecimal and FixedPointCount resolve to `Decimal` at the type
level, so user code handling these fields as Decimal is unaffected.
Drift tests pass (the spec doesn't constrain SDK-side type names, only
schema names + presence).
The orderbook_delta.py `side: str → Literal["yes", "no"]` fix mentioned
in the issue is in kalshi/ws/ — out of scope for this branch (Wave 3/4
territory). Filed/tracked separately.
Closes #90
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Wave 5 #90 — swap the type annotation for 17 count/size/volume fields across 9 response models from
DollarDecimaltoFixedPointCount. The runtime behavior is byte-identical (both validators wrap the wire_fp/_dollarsint and yield aDecimal), but the annotation now communicates the right semantics: these fields represent integer share/contract counts, not dollar amounts.Fields swapped
Marketyes_bid_size,yes_ask_size,no_bid_size,no_ask_size,volume,volume_24h,open_interestCandlestickvolume,open_interestOrderbookLevelquantityFillcountTradecountMarketPositionpositionEventPositiontotal_cost_sharesSettlementyes_count,no_countSeriesvolumeCHANGELOG
[Unreleased] → Changedentry added.Bugs uncovered
None.
_to_decimal_dollarsand_to_decimal_fpare byte-identical, so no wire-format-mocked test fixtures needed updating.Out of scope
OrderbookDeltaPayload.side: str→Literal["yes", "no"]lives inkalshi/ws/models/orderbook_delta.py(Wave 3/4 territory). Noted in commit body._to_decimal_dollars/_to_decimal_fpinto a single callable was a refactor suggestion in the issue but not required by the title — deferring as easy follow-up.Closes #90
Test plan
uv run ruff check .cleanuv run mypy kalshi/clean (strict)