Skip to content

feat(perps): swaps subaccount type + 2026-11-23 spec sync (#588) — 22.16.0 - #589

Merged
TexasCoding merged 2 commits into
mainfrom
fix/588-spec-drift-2026-11-23
Nov 24, 2026
Merged

TexasCoding merged 2 commits into
mainfrom
fix/588-spec-drift-2026-11-23

Conversation

@TexasCoding

Copy link
Copy Markdown
Owner

Closes #588

Reconciles the 2026-11-23 nightly spec drift (OpenAPI 3.37.0 content-changed, perps OpenAPI, perps SCM/Klear). Release 22.16.0 (minor, additive) folded in.

Spec diff

  • specs/perps_openapi.yaml: SubaccountType enum gains swaps (cross-margined swaps wallet; subaccount number is its swaps code). User-facing: REST responses with subaccount_type: "swaps" failed validation before this.
  • specs/openapi.yaml: GET /historical/fills ticker now documented as a comma-separated list of up to 100 tickers (type unchanged, still str). Description changes for weather point / concert cancellation / flight disruption create (6h lead time, 7-day concert window, per-account daily limits, location time zone, cover semantics).
  • specs/perps_scm_openapi.yaml (newer than the issue's checksum; synced to latest): description-only — obligation maintenance_margin_centicents is the margin change settled, detail delta sign, obligation history cardinality.
  • kalshi/_generated/models.py: regenerated, no diff. Paths 123 → 123, no new endpoints.

Changes

  • SubaccountTypeLiteral += "swaps" (shared by MarginPosition, MarginSubaccountBalance, MarginRiskPosition, MarginFundingHistoryEntry, and perps WS orderbook delta / fill / user-order payloads). Unknown values still rejected.
  • Docstrings/docs updated where they were now stale: historical fills/fills_all ticker note; weather/concert create docstrings and docs/resources/markets.md; Klear ObligationEntry field docs and docs/perps.md.
  • Version 22.16.0 in pyproject.toml, kalshi/__init__.py, CHANGELOG.

Blast radius (by hand; GitNexus not installed)

  • Literal widening is a strict superset: no existing value rejected, no type narrowing for callers; mypy users matching exhaustively on SubaccountTypeLiteral may see a new unhandled case (typing-only, runtime-safe).
  • No request bodies, signatures, retries, or endpoint maps changed. No EXCLUSIONS changes. Docstring-only edits elsewhere.

Tests

  • New/extended: swaps parses on all four REST models and the three WS payloads; unknown value still raises.
  • Gates: ruff ✅, mypy ✅, full unit suite ✅, strict contracts (-W error::UserWarning) ✅ — see counts in the comment below/CI.

@TexasCoding
TexasCoding merged commit 3b988bf into main Nov 24, 2026
6 checks passed
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.

Spec drift 2026-11-23: openapi 3.37.0 [content-changed] (paths 123→123, fp 8db67058)

1 participant