Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@

All notable changes to kalshi-sdk will be documented in this file.

## 22.14.0 — 2026-11-13

Adds on-request concert cancellation markets (#582) against OpenAPI v3.36.0
and reconciles perps SCM estimate-position quantity drift. Additive only.
No breaking changes.

### Added

- **`markets.create_concert_cancellation_market(...)`** (sync and async) —
`POST /concert_cancellation_markets`, 200 `CreateConcertCancellationMarketResponse`.
Authenticated. Returns the concert cancellation market for a show, date and
cover, creating it if it does not exist. `created` is false when a market
for the same request already existed. Required: `jambase_event_id`,
`scheduled_date` (YYYY-MM-DD), `cover` (`ConcertCoverLiteral`: `"postponed"`
/ `"cancelled"` / `"either"`). Accepts
`request=CreateConcertCancellationMarketRequest(...)` or keyword fields.
POST is never retried.
- **`markets.concert_cancellation_availability(...)`** (sync and async) —
`GET /concert_cancellation_markets/availability`, 200
`GetConcertCancellationAvailabilityResponse` (`enabled`, `covers`,
`max_days_ahead`, `metros` as `ConcertMetro`). Public. Optional `date_from`
/ `date_to` bound the upcoming-show counts.
- **`markets.list_concerts(*, metro_id, ...)`** (sync and async) —
`GET /concert_cancellation_markets/concerts`, 200 `GetConcertsResponse`.
Authenticated. Lists a metro's upcoming concerts. Optional `date_from`,
`date_to`, `page`. No SDK paginator.
- **`markets.search_concerts(*, q)`** (sync and async) —
`GET /concert_cancellation_markets/concerts/search`, 200
`SearchConcertsResponse`. Authenticated. Name search across metros.
(Closes #582).

### Changed

- Perps Klear **`EstimatePortfolioMaintenanceMarginPosition.quantity`** is
optional; new optional **`quantity_fp`** (`FixedPointCount`, serialized as a
string). Provide `quantity` or `quantity_fp`. A position with neither size
field fails validation.

## 22.13.0 — 2026-11-12

Reconciles spec drift (#580): incentive schedules, incentive-program
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ tests/

## API Reference

- OpenAPI spec: https://docs.kalshi.com/openapi.yaml (v3.36.0, 138 operations; 137 mapped in the core SDK — `POST /portfolio/intra_exchange_instance_transfer` is implemented on `PerpsClient.transfers.transfer_instance` and left unimplemented on the core client)
- OpenAPI spec: https://docs.kalshi.com/openapi.yaml (v3.36.0, 142 operations; 141 mapped in the core SDK — `POST /portfolio/intra_exchange_instance_transfer` is implemented on `PerpsClient.transfers.transfer_instance` and left unimplemented on the core client)
- AsyncAPI spec: https://docs.kalshi.com/asyncapi.yaml (16 WebSocket channels; 13 typed `subscribe_*` + escape-hatch)
- Base URL: https://api.elections.kalshi.com/trade-api/v2
- Demo URL: https://demo-api.kalshi.co/trade-api/v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A professional, spec-first Python SDK for the [Kalshi](https://kalshi.com) predi
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Type checked: mypy strict](https://img.shields.io/badge/mypy-strict-blue.svg)](https://mypy.readthedocs.io/)

- **Full coverage** of the Kalshi REST API (137 mapped of 138 operations across 19 resources, OpenAPI v3.36.0) and WebSocket API (13 typed `subscribe_*` channels + escape-hatch).
- **Full coverage** of the Kalshi REST API (141 mapped of 142 operations across 19 resources, OpenAPI v3.36.0) and WebSocket API (13 typed `subscribe_*` channels + escape-hatch).
- **Perps (margin) API**: standalone `PerpsClient` / `AsyncPerpsClient` + `PerpsWebSocket` for the perpetual-futures exchange (54 REST operations, 6 WS channels), plus a `KlearClient` for the Self-Clearing-Member "Klear" settlement API (26 of 27 operations). See [Perps (margin) trading](#perps-margin-trading).
- **FIX protocol**: an async-first FIX engine (FIXT.1.1 / FIX50SP2) for both products — order-entry, drop-copy, market-data, post-trade (prediction), and RFQ (prediction) sessions (plus order-group management over the order-entry session) with typed message models, sequence recovery, and order-book / settlement reassembly. `from kalshi import FixClient` / `MarginFixClient`. See [FIX protocol](#fix-protocol-low-latency-trading).
- **V2 event-market orders**: `create_v2` / `amend_v2` / `decrease_v2` / `cancel_v2` / `cancel_all_v2` plus batched variants on `/portfolio/events/orders/*` — the only order-write surface.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A professional, spec-first Python SDK for the [Kalshi](https://kalshi.com) prediction
markets API.

- **Full REST coverage** — 137 mapped of 138 operations across 19 resources
- **Full REST coverage** — 141 mapped of 142 operations across 19 resources
(OpenAPI v3.36.0), every kwarg drift-tested against the spec.
- **V2 event-market orders** — new `create_v2` / `amend_v2` / `decrease_v2` /
`cancel_v2` / `cancel_all_v2` family on `/portfolio/events/orders/*`. Legacy `/portfolio/orders`
Expand Down
7 changes: 4 additions & 3 deletions docs/perps.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,10 @@ in the v11.0.0 reconcile.)
or `"Energy"`. `klear.margin.settlement_prices(asset_class="Crypto", settlement_time=...)`
returns a ticker → centicents map at a settlement cycle.
`klear.margin.estimate_maintenance_margin(asset_class="Crypto", positions=[...])`
margins a hypothetical portfolio. Optional `date=` (YYYY-MM-DD) and
`clearing_type=` (`"FCM"` / `"SelfClearing"`) select the matrix day and
clearing arrangement.
margins a hypothetical portfolio. Each position takes `market_ticker` and a
size — `quantity` (whole contracts) or `quantity_fp` (fixed-point string such
as `"0.25"`). Optional `date=` (YYYY-MM-DD) and `clearing_type=` (`"FCM"` /
`"SelfClearing"`) select the matrix day and clearing arrangement.
`klear.margin.estimate_maintenance_margin_metadata(asset_class="Crypto", date=...)`
returns the matrices, liquidation configs, and subgroups that feed that
estimate.
Expand Down
34 changes: 34 additions & 0 deletions docs/resources/markets.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ recent trades.
| `list_all_trades(...)` | walks `list_trades` | no |
| `create_weather_point_market(...)` | `POST /weather_point_markets` | **yes** |
| `weather_point_availability()` | `GET /weather_point_markets/availability` | no |
| `create_concert_cancellation_market(...)` | `POST /concert_cancellation_markets` | **yes** |
| `concert_cancellation_availability(...)` | `GET /concert_cancellation_markets/availability` | no |
| `list_concerts(*, metro_id, ...)` | `GET /concert_cancellation_markets/concerts` | **yes** |
| `search_concerts(*, q)` | `GET /concert_cancellation_markets/concerts/search` | **yes** |

!!! warning "Orderbook endpoints require auth"
`orderbook()` and `bulk_orderbooks()` raise `AuthRequiredError` on an
Expand Down Expand Up @@ -173,6 +177,36 @@ unset optional fields are omitted from the wire body. The same request
always returns the same market; `created` is false when it already existed.
The response coordinates are the snapped NOAA MRMS grid-cell center.

## Concert cancellation markets

On-request markets on whether a concert is called off. Creation, listing, and
search are authenticated; availability is public. POST is never retried.

```python
avail = client.markets.concert_cancellation_availability()
print(avail.enabled, avail.covers, avail.max_days_ahead)
print([m.name for m in avail.metros])

page = client.markets.list_concerts(metro_id=avail.metros[0].id)
show = page.concerts[0]

hits = client.markets.search_concerts(q="Madison Square")

resp = client.markets.create_concert_cancellation_market(
jambase_event_id=show.jambase_event_id,
scheduled_date=show.scheduled_date, # YYYY-MM-DD
cover="postponed", # ConcertCoverLiteral: "postponed" / "cancelled" / "either"
)
print(resp.market_ticker, resp.created, resp.cover)
```

Take `jambase_event_id` and `scheduled_date` from `list_concerts` or
`search_concerts`. A cover missing from `avail.covers` cannot be created. The
same request always returns the same market; `created` is false when it already
existed. Pass the returned `market_ticker` to `POST /communications/rfqs`.
`list_concerts` is paged by the server (`page` / `total_pages`); there is no
SDK paginator.

## Reference

::: kalshi.resources.markets.MarketsResource
Expand Down
20 changes: 19 additions & 1 deletion kalshi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@
BookSideLiteral,
CancelOrderV2Response,
Candlestick,
Concert,
ConcertCoverLiteral,
ConcertMarket,
ConcertMetro,
CreateApiKeyRequest,
CreateApiKeyResponse,
CreateConcertCancellationMarketRequest,
CreateConcertCancellationMarketResponse,
CreateFCMPositionTransferRequest,
CreateFCMPositionTransferResponse,
CreateFCMSubtraderRequest,
Expand Down Expand Up @@ -116,6 +122,8 @@
GetApiKeysResponse,
GetBlockTradeProposalsResponse,
GetCommunicationsIDResponse,
GetConcertCancellationAvailabilityResponse,
GetConcertsResponse,
GetEventContractExitTriggersResponse,
GetEventLiveDataResponse,
GetFCMEventContractDailyCapResponse,
Expand Down Expand Up @@ -200,6 +208,7 @@
RfqStatusLiteral,
Schedule,
ScopeList,
SearchConcertsResponse,
SelfTradePreventionTypeLiteral,
Series,
SeriesFeeChange,
Expand Down Expand Up @@ -302,8 +311,14 @@
"BookSideLiteral",
"CancelOrderV2Response",
"Candlestick",
"Concert",
"ConcertCoverLiteral",
"ConcertMarket",
"ConcertMetro",
"CreateApiKeyRequest",
"CreateApiKeyResponse",
"CreateConcertCancellationMarketRequest",
"CreateConcertCancellationMarketResponse",
"CreateFCMPositionTransferRequest",
"CreateFCMPositionTransferResponse",
"CreateFCMSubtraderRequest",
Expand Down Expand Up @@ -365,6 +380,8 @@
"GetApiKeysResponse",
"GetBlockTradeProposalsResponse",
"GetCommunicationsIDResponse",
"GetConcertCancellationAvailabilityResponse",
"GetConcertsResponse",
"GetEventContractExitTriggersResponse",
"GetEventLiveDataResponse",
"GetFCMEventContractDailyCapResponse",
Expand Down Expand Up @@ -480,6 +497,7 @@
"RfqStatusLiteral",
"Schedule",
"ScopeList",
"SearchConcertsResponse",
"SelfTradePreventionTypeLiteral",
"Series",
"SeriesFeeChange",
Expand Down Expand Up @@ -519,4 +537,4 @@
"Withdrawal",
]

__version__ = "22.13.0"
__version__ = "22.14.0"
32 changes: 32 additions & 0 deletions kalshi/_contract_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,38 @@ class ContractEntry:
sdk_model="kalshi.models.markets.GetWeatherPointAvailabilityResponse",
spec_schema="GetWeatherPointAvailabilityResponse",
),
ContractEntry(
sdk_model="kalshi.models.markets.CreateConcertCancellationMarketRequest",
spec_schema="CreateConcertCancellationMarketRequest",
),
ContractEntry(
sdk_model="kalshi.models.markets.CreateConcertCancellationMarketResponse",
spec_schema="CreateConcertCancellationMarketResponse",
),
ContractEntry(
sdk_model="kalshi.models.markets.ConcertMetro",
spec_schema="ConcertMetro",
),
ContractEntry(
sdk_model="kalshi.models.markets.GetConcertCancellationAvailabilityResponse",
spec_schema="GetConcertCancellationAvailabilityResponse",
),
ContractEntry(
sdk_model="kalshi.models.markets.ConcertMarket",
spec_schema="ConcertMarket",
),
ContractEntry(
sdk_model="kalshi.models.markets.Concert",
spec_schema="Concert",
),
ContractEntry(
sdk_model="kalshi.models.markets.GetConcertsResponse",
spec_schema="GetConcertsResponse",
),
ContractEntry(
sdk_model="kalshi.models.markets.SearchConcertsResponse",
spec_schema="SearchConcertsResponse",
),
# -- orders V2 family (#171) -----------------------------------------
ContractEntry(
sdk_model="kalshi.models.orders.CreateOrderV2Request",
Expand Down
18 changes: 18 additions & 0 deletions kalshi/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,16 @@
from kalshi.models.markets import (
BidAskDistribution,
Candlestick,
Concert,
ConcertCoverLiteral,
ConcertMarket,
ConcertMetro,
CreateConcertCancellationMarketRequest,
CreateConcertCancellationMarketResponse,
CreateWeatherPointMarketRequest,
CreateWeatherPointMarketResponse,
GetConcertCancellationAvailabilityResponse,
GetConcertsResponse,
GetWeatherPointAvailabilityResponse,
Market,
MarketCandlesticks,
Expand All @@ -133,6 +141,7 @@
Orderbook,
OrderbookLevel,
PriceDistribution,
SearchConcertsResponse,
WeatherPointDomain,
WeatherPointVariableAvailability,
WeatherPointVariableLiteral,
Expand Down Expand Up @@ -279,8 +288,14 @@
"BookSideLiteral",
"CancelOrderV2Response",
"Candlestick",
"Concert",
"ConcertCoverLiteral",
"ConcertMarket",
"ConcertMetro",
"CreateApiKeyRequest",
"CreateApiKeyResponse",
"CreateConcertCancellationMarketRequest",
"CreateConcertCancellationMarketResponse",
"CreateFCMPositionTransferRequest",
"CreateFCMPositionTransferResponse",
"CreateFCMSubtraderRequest",
Expand Down Expand Up @@ -338,6 +353,8 @@
"GetApiKeysResponse",
"GetBlockTradeProposalsResponse",
"GetCommunicationsIDResponse",
"GetConcertCancellationAvailabilityResponse",
"GetConcertsResponse",
"GetEventContractExitTriggersResponse",
"GetEventLiveDataResponse",
"GetFCMEventContractDailyCapResponse",
Expand Down Expand Up @@ -422,6 +439,7 @@
"RfqStatusLiteral",
"Schedule",
"ScopeList",
"SearchConcertsResponse",
"SelfTradePreventionTypeLiteral",
"Series",
"SeriesFeeChange",
Expand Down
Loading
Loading