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
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

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

## 22.12.0 — 2026-11-11

Adds on-request weather point markets (#578) against OpenAPI v3.36.0.
Additive only. No breaking changes.

### Added

- **`markets.create_weather_point_market(...)`** (sync and async) —
`POST /weather_point_markets`, 200 `CreateWeatherPointMarketResponse`.
Authenticated. Returns the weather market for a location, time window and
threshold, creating it if it does not exist. `created` is false when a
market for the same request already existed. Required: `latitude`,
`longitude`, `variable` (`WeatherPointVariableLiteral`: `"precip_hours"` /
`"precip_total"` / `"max_temp"` / `"min_temp"`), `strike_type`
(`"greater"` / `"less"` / `"between"`), `date` (YYYY-MM-DD), `start_hour`,
`end_hour`, `timezone` (IANA). Optional: `floor_value`, `cap_value`.
Accepts `request=CreateWeatherPointMarketRequest(...)` or keyword fields.
POST is never retried. (Closes #578).
- **`markets.weather_point_availability()`** (sync and async) —
`GET /weather_point_markets/availability`, 200
`GetWeatherPointAvailabilityResponse` (`enabled`, `domains` as
`WeatherPointDomain`, `variables` as `WeatherPointVariableAvailability`).
Public. Whether creation is on, the NOAA MRMS domains a location may lie
in, and which variables are offered in which domains.

## 22.11.0 — 2026-11-10

Reconciles nightly spec drift (#575) against the latest AsyncAPI (new
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.35.0, 133 operations; 132 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, 137 operations; 136 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 (132 mapped of 133 operations across 19 resources, OpenAPI v3.35.0) and WebSocket API (13 typed `subscribe_*` channels + escape-hatch).
- **Full coverage** of the Kalshi REST API (136 mapped of 137 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
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
A professional, spec-first Python SDK for the [Kalshi](https://kalshi.com) prediction
markets API.

- **Full REST coverage** — 132 mapped of 133 operations across 19 resources
(OpenAPI v3.35.0), every kwarg drift-tested against the spec.
- **Full REST coverage** — 136 mapped of 137 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`
keeps working; deprecation no earlier than May 6, 2026.
Expand Down
31 changes: 31 additions & 0 deletions docs/resources/markets.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ recent trades.
| `bulk_orderbooks(*, tickers)` | `GET /markets/orderbooks` | **yes** |
| `list_trades(...)` | `GET /markets/trades` | no |
| `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 |

!!! warning "Orderbook endpoints require auth"
`orderbook()` and `bulk_orderbooks()` raise `AuthRequiredError` on an
Expand Down Expand Up @@ -142,6 +144,35 @@ block trade. Omit it to return all trades. Each `Trade` also carries an

[issue-349]: https://github.com/TexasCoding/kalshi-python-sdk/issues/349

## Weather point markets

On-request weather markets for a location, time window, and threshold.
Creation is authenticated; availability is public. POST is never retried.

```python
avail = client.markets.weather_point_availability()
print(avail.enabled, [d.name for d in avail.domains])

resp = client.markets.create_weather_point_market(
latitude=40.785,
longitude=-73.965,
variable="precip_hours", # WeatherPointVariableLiteral
strike_type="greater", # "greater" / "less" / "between"
date="2026-11-11", # YYYY-MM-DD in timezone
start_hour=0,
end_hour=24,
timezone="America/New_York",
floor_value=2,
)
print(resp.market_ticker, resp.created, resp.latitude, resp.longitude)
```

`floor_value` is required by the server for `"greater"` and `"between"`;
`cap_value` for `"less"` and `"between"`. The SDK does not enforce that —
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.

## Reference

::: kalshi.resources.markets.MarketsResource
Expand Down
14 changes: 13 additions & 1 deletion kalshi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
CreateRFQResponse,
CreateSubaccountRequest,
CreateSubaccountResponse,
CreateWeatherPointMarketRequest,
CreateWeatherPointMarketResponse,
CreditHistory,
CreditStatusLiteral,
DailySchedule,
Expand Down Expand Up @@ -143,6 +145,7 @@
GetTargetBalanceAllocationResponse,
GetWeatherIndexCalibrationsResponse,
GetWeatherIndexResponse,
GetWeatherPointAvailabilityResponse,
HistoricalCutoff,
IncentiveProgram,
IncentiveProgramStatusLiteral,
Expand Down Expand Up @@ -226,6 +229,9 @@
WeatherIndexCalibrationStation,
WeatherIndexPoint,
WeatherIndexStationReading,
WeatherPointDomain,
WeatherPointVariableAvailability,
WeatherPointVariableLiteral,
WeeklySchedule,
Withdrawal,
)
Expand Down Expand Up @@ -318,6 +324,8 @@
"CreateRFQResponse",
"CreateSubaccountRequest",
"CreateSubaccountResponse",
"CreateWeatherPointMarketRequest",
"CreateWeatherPointMarketResponse",
"CreditHistory",
"CreditStatusLiteral",
"DailySchedule",
Expand Down Expand Up @@ -384,6 +392,7 @@
"GetTargetBalanceAllocationResponse",
"GetWeatherIndexCalibrationsResponse",
"GetWeatherIndexResponse",
"GetWeatherPointAvailabilityResponse",
"HistoricalCutoff",
"IncentiveProgram",
"IncentiveProgramStatusLiteral",
Expand Down Expand Up @@ -499,8 +508,11 @@
"WeatherIndexCalibrationStation",
"WeatherIndexPoint",
"WeatherIndexStationReading",
"WeatherPointDomain",
"WeatherPointVariableAvailability",
"WeatherPointVariableLiteral",
"WeeklySchedule",
"Withdrawal",
]

__version__ = "22.11.0"
__version__ = "22.12.0"
20 changes: 20 additions & 0 deletions kalshi/_contract_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,26 @@ class ContractEntry:
sdk_model="kalshi.models.markets.GetMarketOrderbooksResponse",
spec_schema="GetMarketOrderbooksResponse",
),
ContractEntry(
sdk_model="kalshi.models.markets.CreateWeatherPointMarketRequest",
spec_schema="CreateWeatherPointMarketRequest",
),
ContractEntry(
sdk_model="kalshi.models.markets.CreateWeatherPointMarketResponse",
spec_schema="CreateWeatherPointMarketResponse",
),
ContractEntry(
sdk_model="kalshi.models.markets.WeatherPointDomain",
spec_schema="WeatherPointDomain",
),
ContractEntry(
sdk_model="kalshi.models.markets.WeatherPointVariableAvailability",
spec_schema="WeatherPointVariableAvailability",
),
ContractEntry(
sdk_model="kalshi.models.markets.GetWeatherPointAvailabilityResponse",
spec_schema="GetWeatherPointAvailabilityResponse",
),
# -- orders V2 family (#171) -----------------------------------------
ContractEntry(
sdk_model="kalshi.models.orders.CreateOrderV2Request",
Expand Down
12 changes: 12 additions & 0 deletions kalshi/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,19 @@
from kalshi.models.markets import (
BidAskDistribution,
Candlestick,
CreateWeatherPointMarketRequest,
CreateWeatherPointMarketResponse,
GetWeatherPointAvailabilityResponse,
Market,
MarketCandlesticks,
MarketStatusLiteral,
MveFilterLiteral,
Orderbook,
OrderbookLevel,
PriceDistribution,
WeatherPointDomain,
WeatherPointVariableAvailability,
WeatherPointVariableLiteral,
)
from kalshi.models.milestones import (
GetMilestoneResponse,
Expand Down Expand Up @@ -295,6 +301,8 @@
"CreateRFQResponse",
"CreateSubaccountRequest",
"CreateSubaccountResponse",
"CreateWeatherPointMarketRequest",
"CreateWeatherPointMarketResponse",
"CreditHistory",
"CreditStatusLiteral",
"DailySchedule",
Expand Down Expand Up @@ -357,6 +365,7 @@
"GetTargetBalanceAllocationResponse",
"GetWeatherIndexCalibrationsResponse",
"GetWeatherIndexResponse",
"GetWeatherPointAvailabilityResponse",
"HistoricalCutoff",
"IncentiveProgram",
"IncentiveProgramStatusLiteral",
Expand Down Expand Up @@ -440,6 +449,9 @@
"WeatherIndexCalibrationStation",
"WeatherIndexPoint",
"WeatherIndexStationReading",
"WeatherPointDomain",
"WeatherPointVariableAvailability",
"WeatherPointVariableLiteral",
"WeeklySchedule",
"Withdrawal",
]
70 changes: 70 additions & 0 deletions kalshi/models/markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,73 @@ class GetMarketOrderbooksResponse(BaseModel):
orderbooks: NullableList[dict[str, Any]]

model_config = {"extra": "allow"}


WeatherPointVariableLiteral = Literal["precip_hours", "precip_total", "max_temp", "min_temp"]
"""What a weather point market measures. Spec: WeatherPointVariable enum."""


class CreateWeatherPointMarketRequest(BaseModel):
"""Body for POST /weather_point_markets.

Matches spec ``components.schemas.CreateWeatherPointMarketRequest``.
Required: ``latitude``, ``longitude``, ``variable``, ``strike_type``,
``date``, ``start_hour``, ``end_hour``, ``timezone``. Optional:
``floor_value``, ``cap_value``.
"""

latitude: float
longitude: float
variable: WeatherPointVariableLiteral
strike_type: Literal["greater", "less", "between"]
date: str
start_hour: int
end_hour: int
timezone: str
floor_value: int | None = None
cap_value: int | None = None

model_config = {"extra": "forbid"}


class CreateWeatherPointMarketResponse(BaseModel):
"""Response from POST /weather_point_markets."""

event_ticker: str
market_ticker: str
created: bool
latitude: float
longitude: float

model_config = {"extra": "allow"}


class WeatherPointDomain(BaseModel):
"""A NOAA MRMS domain a weather-point location may lie in."""

name: str
north: float
south: float
west: float
east: float

model_config = {"extra": "allow"}


class WeatherPointVariableAvailability(BaseModel):
"""Where new markets of one weather-point variable may be created."""

variable: WeatherPointVariableLiteral
domains: NullableList[str]

model_config = {"extra": "allow"}


class GetWeatherPointAvailabilityResponse(BaseModel):
"""Response from GET /weather_point_markets/availability."""

enabled: bool
domains: NullableList[WeatherPointDomain]
variables: NullableList[WeatherPointVariableAvailability]

model_config = {"extra": "allow"}
Loading
Loading