Reconcile OpenAPI 3.31.0 spec drift (v16.0.0) - #520
Merged
Merged
Conversation
- historical fills/orders(+_all): optional subaccount query param
- markets.list/list_all: optional max_updated_ts
- api_keys.generate: optional key_type (rsa|ed25519); response key_type
- fcm.fills / fcm.fills_all (GET /fcm/fills) + FcmFill, GetFcmFillsResponse
- perps fcm update/delete_notional_risk_limit (PUT/DELETE /margin/fcm/notional_risk_limit)
- perps: required current_im, notional_limits, total_current_usage,
current_usage_by_market_ticker (breaking for constructors)
- extend RestingMarginReservation ('none') and LastUpdateReason ('ReduceOnlyCancel')
- sync pinned specs; bump to 16.0.0 with CHANGELOG + migration note
Closes #519
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #519
Reconciles upstream OpenAPI 3.30.0 → 3.31.0 (plus matching perps OpenAPI / AsyncAPI updates). The nightly strict contract suite had grown from the 8
subaccountfailures in #519 to 18 failures against today's upstream spec; this PR makes all of them pass and bumps to 16.0.0.What changed
Added (non-breaking)
historical.fills/fills_all/orders/orders_all(sync + async): optionalsubaccount=query parammarkets.list/list_all(sync + async): optionalmax_updated_ts=api_keys.generate(..., key_type=)("rsa"/"ed25519"),GenerateApiKeyRequest.key_type, optionalGenerateApiKeyResponse.key_type.KalshiAuthstays RSA-PSS only (documented).fcm.fills()/fcm.fills_all()for newGET /fcm/fills+FcmFill/GetFcmFillsResponsefcm.update_notional_risk_limit()/delete_notional_risk_limit()for newPUT/DELETE /margin/fcm/notional_risk_limit+UpdateFCMNotionalRiskLimitRequest(extra="forbid"); never retriedFCMSubtraderNotionalRiskLimit; optionalNotionalRiskLimitResponse.member_notional_value_risk_limit/effective_account_notional_value_risk_limitRestingMarginReservationLiteral+="none"; perpsLastUpdateReason/LastUpdateReasonLiteral/ WSPerpsLastUpdateReason+="ReduceOnlyCancel"Breaking (constructors only — spec marks these required, and the contract suite enforces required-ness)
FCMSubtraderRiskControls.current_imGetFCMSubtraderRiskControlsResponse.notional_limitsNotionalRiskLimitResponse.total_current_usage,current_usage_by_market_tickerVersion bump in this PR:
pyproject.toml+kalshi/__init__.py→ 16.0.0, CHANGELOG## 16.0.0 — 2026-09-26,docs/migration.mdv15 → v16 note.Blast radius (manual — GitNexus is not installed on the automation host)
HistoricalResource/AsyncHistoricalResource.fills/.fills_all/.orders/.orders_alland helper_historical_fills_or_orders_params: new trailing keyword-only kwarg withNonedefault; no internal callers beyond these methods. Low risk.MarketsResource/AsyncMarketsResource.list/.list_alland_list_markets_params: new keyword-only kwarg,Nonedefault. Low risk.ApiKeysResource/AsyncApiKeysResource.generate+_build_generate_api_key_body+GenerateApiKeyRequest/GenerateApiKeyResponse: new optional field/kwarg. Low risk.FcmResource/AsyncFcmResource: new methods only. PerpsFcmResource/AsyncFcmResource: new methods only.FCMSubtraderRiskControls,GetFCMSubtraderRiskControlsResponse,NotionalRiskLimitResponse: new required fields — affectsperps.fcm.risk_controls()andperps.margin.notional_risk_limit()parsing (server always sends them per spec) and any user code constructing these models. Medium (hence major bump).kalshi/__init__.py,kalshi/models/__init__.py,kalshi/perps/__init__.py,kalshi/perps/models/__init__.py; contract registrations inkalshi/_contract_map.py,tests/_contract_support.py,tests/test_contracts.py.Not in scope (left for follow-up)
user_filtersubscribe option and core WS user-orderlast_update_reasonfield (additive, warning-only)Market.liquidity_dollarsand Klearprev_settlement_prices; SDK keeps its optional fields for nowGates (local)
uv run ruff check .— passuv run mypy kalshi/— pass (160 files)uv run pytest tests/ --ignore=tests/integration -q— 4579 passed, 3 skippeduv run pytest tests/test_contracts.py -q -W error::UserWarningagainst fresh upstream specs (nightly-strict mode) — 838 passed (was 18 failed)Code changes authored with Grok Build (headless), reviewed and gated by the maintainer automation.