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

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

## 22.13.0 — 2026-11-12

Reconciles spec drift (#580): incentive schedules, incentive-program
series/event filters, optional perps `settled_funds`, and new perps WS
`lastUpdateReason` values. Additive only. No breaking changes.

### Added

- **`incentive_programs.list_schedules()`** (sync and async) —
`GET /incentive_schedules`, 200 list of `IncentiveSchedule`. Public.
Recurring incentive terms for a series, or for one event of a series.
No pagination. `event_ticker` / `event_title` are empty (or `None`) when
the schedule covers the whole series; `ends` is `None` when it has no end.
`reward` is int64 centi-cents (same convention as `period_reward`).
- Optional **`series_ticker`** / **`event_ticker`** query filters on
`incentive_programs.list` / `list_all`, and matching optional fields on
`IncentiveProgram`. A perpetual's incentives belong to no event.
(Closes #580).

### Changed

- Perps **`GetMarginBalanceResponse.settled_funds`** is optional
(`DollarDecimal | None`). Omitted for subaccount-restricted API keys.
- Perps WS **`PerpsLastUpdateReason`** gains `"CloseCancel"`,
`"HaltCancel"`, and `"SettlementBoundsCancel"` (spec order). REST
`LastUpdateReason` is unchanged.

## 22.12.0 — 2026-11-11

Adds on-request weather point markets (#578) against OpenAPI v3.36.0.
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, 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)
- 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)
- 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 (136 mapped of 137 operations across 19 resources, OpenAPI v3.36.0) and WebSocket API (13 typed `subscribe_*` channels + escape-hatch).
- **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).
- **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** — 136 mapped of 137 operations across 19 resources
- **Full REST coverage** — 137 mapped of 138 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
22 changes: 22 additions & 0 deletions docs/resources/incentive-programs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Public — no auth required.
| Method | Endpoint |
|---|---|
| `list(...)` / `list_all(...)` | `GET /incentive_programs` |
| `list_schedules()` | `GET /incentive_schedules` |

## List active programs

Expand All @@ -19,6 +20,8 @@ page = client.incentive_programs.list(
status="active", # IncentiveProgramStatusLiteral
incentive_type="liquidity", # IncentiveProgramTypeLiteral — spec "type"
incentive_description="Q2 maker", # new in v2.1.0 — exact-match filter
series_ticker="KXHIGHNY", # optional — one series' incentives
event_ticker="KXHIGHNY-24", # optional — one event; omit for a perpetual
limit=100,
)
for p in page:
Expand All @@ -27,6 +30,8 @@ for p in page:

`incentive_description` (added in v2.1.0) is an exact-string filter on the
program's description — useful when multiple programs share a status/type.
`series_ticker` and `event_ticker` (added in v22.13.0) restrict the list to
one series or one event. A perpetual's incentives belong to no event.

Use `list_all` to walk every program:

Expand All @@ -51,6 +56,23 @@ for p in client.incentive_programs.list_all(status="active"):
`"closed"`, and additional server-side categories.
- `IncentiveProgramTypeLiteral`: `"all"`, `"liquidity"`, `"volume"`.

## Incentive schedules

Recurring terms for what each market of a series — or of one event — can
expect to earn window after window. Public, no pagination. A schedule is
anticipated unless `all_markets` is true.

```python
schedules = client.incentive_programs.list_schedules()
for s in schedules:
print(s.series_ticker, s.incentive_type, s.reward, s.window_days)
```

`event_ticker` / `event_title` are empty (or `None` if the server omits
them) when the schedule covers the whole series. `ends` is `None` when the schedule has
no end. `reward` is centi-cents, the same convention as
`IncentiveProgram.period_reward`.

## Reference

::: kalshi.resources.incentive_programs.IncentiveProgramsResource
Expand Down
6 changes: 5 additions & 1 deletion kalshi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
GetFiltersBySportsResponse,
GetGameStatsResponse,
GetIncentiveProgramsResponse,
GetIncentiveSchedulesResponse,
GetLiveDataResponse,
GetLiveDatasResponse,
GetMilestoneResponse,
Expand All @@ -150,6 +151,7 @@
IncentiveProgram,
IncentiveProgramStatusLiteral,
IncentiveProgramTypeLiteral,
IncentiveSchedule,
IndexedBalance,
IntraExchangeInstanceTransfer,
IntraExchangeInstanceTransferStatusLiteral,
Expand Down Expand Up @@ -371,6 +373,7 @@
"GetFiltersBySportsResponse",
"GetGameStatsResponse",
"GetIncentiveProgramsResponse",
"GetIncentiveSchedulesResponse",
"GetLiveDataResponse",
"GetLiveDatasResponse",
"GetMilestoneResponse",
Expand All @@ -397,6 +400,7 @@
"IncentiveProgram",
"IncentiveProgramStatusLiteral",
"IncentiveProgramTypeLiteral",
"IncentiveSchedule",
"IndexedBalance",
"IntraExchangeInstanceTransfer",
"IntraExchangeInstanceTransferStatusLiteral",
Expand Down Expand Up @@ -515,4 +519,4 @@
"Withdrawal",
]

__version__ = "22.12.0"
__version__ = "22.13.0"
9 changes: 9 additions & 0 deletions kalshi/_contract_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,15 @@ class ContractEntry:
spec_schema="IncentiveProgram",
notes="period_reward is int centi-cents; target_size_fp DollarDecimal",
),
ContractEntry(
sdk_model="kalshi.models.incentive_programs.IncentiveSchedule",
spec_schema="IncentiveSchedule",
notes="reward is int centi-cents; event_ticker/event_title optional (server omits empties)",
),
ContractEntry(
sdk_model="kalshi.models.incentive_programs.GetIncentiveSchedulesResponse",
spec_schema="GetIncentiveSchedulesResponse",
),
ContractEntry(
sdk_model="kalshi.models.portfolio.TotalRestingOrderValue",
spec_schema="GetPortfolioRestingOrderTotalValueResponse",
Expand Down
4 changes: 4 additions & 0 deletions kalshi/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@
from kalshi.models.historical import HistoricalCutoff, MveHistoricalFilterLiteral, Trade
from kalshi.models.incentive_programs import (
GetIncentiveProgramsResponse,
GetIncentiveSchedulesResponse,
IncentiveProgram,
IncentiveProgramStatusLiteral,
IncentiveProgramTypeLiteral,
IncentiveSchedule,
)
from kalshi.models.live_data import (
EventLiveData,
Expand Down Expand Up @@ -344,6 +346,7 @@
"GetFiltersBySportsResponse",
"GetGameStatsResponse",
"GetIncentiveProgramsResponse",
"GetIncentiveSchedulesResponse",
"GetLiveDataResponse",
"GetLiveDatasResponse",
"GetMilestoneResponse",
Expand All @@ -370,6 +373,7 @@
"IncentiveProgram",
"IncentiveProgramStatusLiteral",
"IncentiveProgramTypeLiteral",
"IncentiveSchedule",
"IndexedBalance",
"IntraExchangeInstanceTransfer",
"IntraExchangeInstanceTransferStatusLiteral",
Expand Down
36 changes: 36 additions & 0 deletions kalshi/models/incentive_programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class IncentiveProgram(BaseModel):
id: str
market_id: str
market_ticker: str
series_ticker: str | None = None
event_ticker: str | None = None
incentive_type: str # "liquidity" | "volume"
start_date: AwareDatetime
end_date: AwareDatetime
Expand Down Expand Up @@ -54,3 +56,37 @@ class GetIncentiveProgramsResponse(BaseModel):
next_cursor: str | None = None

model_config = {"extra": "allow"}


class IncentiveSchedule(BaseModel):
"""Recurring incentive terms for a series, or for one event of a series."""

series_ticker: str
series_title: str
series_category: str
# Spec-required but empty when the schedule covers the whole series;
# the server may omit empties.
event_ticker: str | None = None
event_title: str | None = None
incentive_type: str # "liquidity" | "volume"
source: str
# Spec: integer (int64), centi-cents. Same convention as period_reward.
reward: int
window_days: int
discount_factor_bps: int | None = None
target_size_fp: FixedPointCount | None = None
ends: AwareDatetime | None = None
description: str
all_markets: bool
posted_ts: AwareDatetime
updated_ts: AwareDatetime

model_config = {"extra": "allow"}


class GetIncentiveSchedulesResponse(BaseModel):
"""Response for GET /incentive_schedules."""

schedules: NullableList[IncentiveSchedule] = []

model_config = {"extra": "allow"}
3 changes: 2 additions & 1 deletion kalshi/perps/models/margin_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class GetMarginBalanceResponse(BaseModel):
model_config = ConfigDict(extra="allow")

subaccount_balances: NullableList[MarginSubaccountBalance]
settled_funds: DollarDecimal
# Omitted for subaccount-restricted API keys.
settled_funds: DollarDecimal | None = None


class MarginRiskPosition(BaseModel):
Expand Down
3 changes: 3 additions & 0 deletions kalshi/perps/ws/models/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
"MarginCancel",
"SelfTradeCancel",
"ExpiryCancel",
"CloseCancel",
"HaltCancel",
"Trade",
"PostOnlyCrossCancel",
"ReduceOnlyCancel",
"SettlementBoundsCancel",
]

# Spec ``orderGroupUpdatesPayload.msg.event_type`` enum.
Expand Down
33 changes: 33 additions & 0 deletions kalshi/resources/incentive_programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

from __future__ import annotations

import builtins
from collections.abc import AsyncIterator, Iterator

from kalshi.models.common import Page
from kalshi.models.incentive_programs import (
GetIncentiveSchedulesResponse,
IncentiveProgram,
IncentiveProgramStatusLiteral,
IncentiveProgramTypeLiteral,
IncentiveSchedule,
)
from kalshi.resources._base import (
AsyncResource,
Expand All @@ -37,6 +40,8 @@ def list(
status: IncentiveProgramStatusLiteral | None = None,
incentive_type: IncentiveProgramTypeLiteral | None = None,
incentive_description: str | None = None,
series_ticker: str | None = None,
event_ticker: str | None = None,
limit: int | None = None,
cursor: str | None = None,
extra_headers: dict[str, str] | None = None,
Expand All @@ -46,6 +51,8 @@ def list(
status=status,
type=incentive_type,
incentive_description=incentive_description,
series_ticker=series_ticker,
event_ticker=event_ticker,
limit=limit,
cursor=cursor,
)
Expand All @@ -64,6 +71,8 @@ def list_all(
status: IncentiveProgramStatusLiteral | None = None,
incentive_type: IncentiveProgramTypeLiteral | None = None,
incentive_description: str | None = None,
series_ticker: str | None = None,
event_ticker: str | None = None,
limit: int | None = None,
max_pages: int | None = None,
extra_headers: dict[str, str] | None = None,
Expand All @@ -74,6 +83,8 @@ def list_all(
status=status,
type=incentive_type,
incentive_description=incentive_description,
series_ticker=series_ticker,
event_ticker=event_ticker,
limit=limit,
)
return self._list_all(
Expand All @@ -86,6 +97,13 @@ def list_all(
extra_headers=extra_headers,
)

def list_schedules(
self, *, extra_headers: dict[str, str] | None = None
) -> builtins.list[IncentiveSchedule]:
"""``GET /incentive_schedules``. Public. No pagination."""
data = self._get("/incentive_schedules", extra_headers=extra_headers)
return GetIncentiveSchedulesResponse.model_validate(data).schedules


class AsyncIncentiveProgramsResource(AsyncResource):
"""Async incentive programs API."""
Expand All @@ -96,6 +114,8 @@ async def list(
status: IncentiveProgramStatusLiteral | None = None,
incentive_type: IncentiveProgramTypeLiteral | None = None,
incentive_description: str | None = None,
series_ticker: str | None = None,
event_ticker: str | None = None,
limit: int | None = None,
cursor: str | None = None,
extra_headers: dict[str, str] | None = None,
Expand All @@ -105,6 +125,8 @@ async def list(
status=status,
type=incentive_type,
incentive_description=incentive_description,
series_ticker=series_ticker,
event_ticker=event_ticker,
limit=limit,
cursor=cursor,
)
Expand All @@ -123,6 +145,8 @@ def list_all(
status: IncentiveProgramStatusLiteral | None = None,
incentive_type: IncentiveProgramTypeLiteral | None = None,
incentive_description: str | None = None,
series_ticker: str | None = None,
event_ticker: str | None = None,
limit: int | None = None,
max_pages: int | None = None,
extra_headers: dict[str, str] | None = None,
Expand All @@ -134,6 +158,8 @@ def list_all(
status=status,
type=incentive_type,
incentive_description=incentive_description,
series_ticker=series_ticker,
event_ticker=event_ticker,
limit=limit,
)
return self._list_all(
Expand All @@ -145,3 +171,10 @@ def list_all(
cursor_key="next_cursor",
extra_headers=extra_headers,
)

async def list_schedules(
self, *, extra_headers: dict[str, str] | None = None
) -> builtins.list[IncentiveSchedule]:
"""Async :meth:`IncentiveProgramsResource.list_schedules`."""
data = await self._get("/incentive_schedules", extra_headers=extra_headers)
return GetIncentiveSchedulesResponse.model_validate(data).schedules
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kalshi-sdk"
version = "22.12.0"
version = "22.13.0"
description = "A professional Python SDK for the Kalshi prediction markets and Perps (margin) APIs"
readme = "README.md"
license = { text = "MIT" }
Expand Down
Loading
Loading