Skip to content

feat: reconcile Klear spec drift #563 (22.6.0) - #564

Merged
TexasCoding merged 5 commits into
mainfrom
fix/563-klear-fp-rename
Oct 31, 2026
Merged

TexasCoding merged 5 commits into
mainfrom
fix/563-klear-fp-rename

Conversation

@TexasCoding

Copy link
Copy Markdown
Owner

Closes #563

Fixes the spec drift from Spec Drift run 41197408777. Minor (22.6.0): no public Python attribute or method was renamed or removed, and no new required request field was added.

What changed

  • Klear margin money fields: the updated SCM spec adds *_fp fixed-point dollar strings next to the existing int64 *_centicents fields; the old fields are still in the spec. So the 13 affected models get new optional *_fp: DollarDecimal | None attributes, and *_centicents stays a plain int. (An earlier WIP commit aliased the two onto one attribute. That was reverted because it would have silently turned centicent ints into dollar Decimals.)
  • margin.withdraw_settlement_balance (sync and async) now posts to POST /margin/settlement_balance_withdrawal. Method name and request/response models are unchanged.
  • Small optional additions that only produced warnings: rfq_batch_id (RFQ, RfqCreated/RfqDeleted), orderbook snapshot/delta clock, UserOrdersPayload.last_update_reason, perps ExchangeStatus resume-time/index-statuses/intra-transfers fields (+ ExchangeIndexStatus), MarginMarket.market_id, IntraExchangeInstanceTransfer.client_transfer_id.
  • Specs re-synced, METHOD_ENDPOINT_MAP and BODY_MODEL_MAP updated, regression tests added (centicents-only payloads, payloads with both names, serialization, new withdrawal path), CHANGELOG and docs/perps.md updated, version bumped to 22.6.0.

Blast radius (by hand, GitNexus isn't available)

  • kalshi/perps/klear/models/margin.py: only additive optional fields. Existing attribute types are unchanged. Responses that leave out *_fp still parse.
  • kalshi/perps/klear/resources/margin.py: only the URL path changed. Anyone still calling the old path directly would get a 404 upstream anyway, because Kalshi removed it.
  • Core/WS/perps models (communications, portfolio, orderbook_delta, user_orders, exchange, markets): optional fields default to None. Models with extra="forbid" are response models only, so no request body changes.
  • New export ExchangeIndexStatus in kalshi.perps. Additive.
  • Nothing hand-edited under kalshi/_generated/.

Gates

  • uv run ruff check .: pass
  • uv run mypy kalshi/: pass (161 files)
  • uv run pytest tests/ --ignore=tests/integration -q: 5062 passed, 3 skipped
  • uv run pytest tests/test_contracts.py -W error::UserWarning: 930 passed

@TexasCoding
TexasCoding merged commit 1874cec into main Oct 31, 2026
6 checks passed
@TexasCoding
TexasCoding deleted the fix/563-klear-fp-rename branch November 1, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly spec-drift: strict contract tests failing (since 2026-10-31)

1 participant