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

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

## 22.3.0 — 2026-10-22

Reconciles nightly spec drift (#553). Maps the ten core RFQ batch
endpoints added upstream.

### Added

- Communications **`rfq_batches`** (sync + async) —
`client.communications.rfq_batches`. Backs
`/communications/rfq_batches`: `list()` / `list_all()` (cursor
paginated, max 20 per page), `get()`, `create()`, `delete()`,
`accept()`, `best_quotes()`. Nested
**`rfq_batches.quotes`**: `list()` (not paginated), `create()`,
`delete()`, `confirm()`. Auth required. Create sizes every child via
`contracts` (`contracts_fp` on the wire) or `target_cost`
(`target_cost_dollars`). Batch-quote bids use `yes_bid` / `no_bid`
(no `_dollars` suffix); accept `min_bids` use Python name `bid`,
serialized as `bid_dollars`. (Closes #553).

- Optional **`QuoteExecutedPayload.rfq_batch_id`** — set when the
executed quote is a child of an RFQ batch.

### Changed

- Re-vendored `specs/` (OpenAPI 3.34.0 still, plus AsyncAPI and Klear
SCM). Besides RFQ batches the upstream changes are description,
example, vendor-extension, and response-side additive optional
fields (`IntraExchangeInstanceTransfer.client_transfer_id`, perps
`ExchangeStatus` / `MarginMarket` extras, WS `batch_communications`
and `pyth_value` channels). Those additive fields and new WS
channels are not mapped in this release.

## 22.2.0 — 2026-10-20

### Added
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ tests/

## API Reference

- OpenAPI spec: https://docs.kalshi.com/openapi.yaml (v3.34.0, 118 operations; 117 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 (15 WebSocket channels; 12 typed `subscribe_*` + escape-hatch)
- OpenAPI spec: https://docs.kalshi.com/openapi.yaml (v3.34.0, 128 operations; 127 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; 12 typed `subscribe_*` + escape-hatch)
- Base URL: https://api.elections.kalshi.com/trade-api/v2
- Demo URL: https://demo-api.kalshi.co/trade-api/v2
- Auth: RSA-PSS / SHA256 / MGF1(SHA256) / salt_length=DIGEST_LENGTH / base64
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 (117 mapped of 118 operations across 19 resources, OpenAPI v3.34.0) and WebSocket API (12 typed `subscribe_*` channels + escape-hatch).
- **Full coverage** of the Kalshi REST API (127 mapped of 128 operations across 19 resources, OpenAPI v3.34.0) and WebSocket API (12 typed `subscribe_*` channels + escape-hatch).
- **Perps (margin) API**: standalone `PerpsClient` / `AsyncPerpsClient` + `PerpsWebSocket` for the perpetual-futures exchange (50 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** — 117 mapped of 118 operations across 19 resources
- **Full REST coverage** — 127 mapped of 128 operations across 19 resources
(OpenAPI v3.34.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
6 changes: 6 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ every exception class.

::: kalshi.models.communications.AcceptBlockTradeProposalRequest

::: kalshi.models.communications.CreateRFQBatchRequest

::: kalshi.models.communications.CreateRFQBatchQuoteRequest

::: kalshi.models.communications.AcceptRFQBatchRequest

::: kalshi.models.multivariate.CreateMarketInMultivariateEventCollectionRequest

::: kalshi.models.order_groups.CreateOrderGroupRequest
Expand Down
81 changes: 81 additions & 0 deletions docs/resources/communications.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ Auth required throughout.
| `block_trade_proposals.list(...)` / `block_trade_proposals.list_all(...)` | `GET /communications/block-trade-proposals` |
| `block_trade_proposals.create(...)` | `POST /communications/block-trade-proposals` |
| `block_trade_proposals.accept(block_trade_proposal_id, *, subtrader_id=None, subaccount=None)` | `POST /communications/block-trade-proposals/{block_trade_proposal_id}/accept` |
| `rfq_batches.list(...)` / `rfq_batches.list_all(...)` | `GET /communications/rfq_batches` |
| `rfq_batches.get(rfq_batch_id)` | `GET /communications/rfq_batches/{rfq_batch_id}` |
| `rfq_batches.create(...)` | `POST /communications/rfq_batches` |
| `rfq_batches.delete(rfq_batch_id)` | `DELETE /communications/rfq_batches/{rfq_batch_id}` |
| `rfq_batches.accept(rfq_batch_id, *, accepted_side, min_bids)` | `PUT /communications/rfq_batches/{rfq_batch_id}/accept` |
| `rfq_batches.best_quotes(rfq_batch_id)` | `GET /communications/rfq_batches/{rfq_batch_id}/best_quotes` |
| `rfq_batches.quotes.list(rfq_batch_id)` | `GET /communications/rfq_batches/{rfq_batch_id}/quotes` |
| `rfq_batches.quotes.create(rfq_batch_id, ...)` | `POST /communications/rfq_batches/{rfq_batch_id}/quotes` |
| `rfq_batches.quotes.delete(rfq_batch_id, batch_quote_id)` | `DELETE /communications/rfq_batches/{rfq_batch_id}/quotes/{batch_quote_id}` |
| `rfq_batches.quotes.confirm(rfq_batch_id, batch_quote_id)` | `PUT /communications/rfq_batches/{rfq_batch_id}/quotes/{batch_quote_id}/confirm` |

`get_id()` returns your `participant_id` — the value you'll pass as
`quote_creator_user_id` / `rfq_creator_user_id` when filtering lists. It stays
Expand Down Expand Up @@ -211,6 +221,61 @@ client.communications.block_trade_proposals.accept(proposal_id)
`_dollars` / `_fp` aliasing applies. `price_centi_cents` and `centicount`
must each be `>= 1`.

## RFQ batches (v22.3.0)

`client.communications.rfq_batches` backs `/communications/rfq_batches` —
request quotes on several combo markets at once. Makers quote the whole
batch; each child is accepted from whichever maker quotes it best on your
side. Accepting fills every child or none.

```python
# Create a batch of two combos, sized the same way.
resp = client.communications.rfq_batches.create(
children=[
{"market_ticker": "COMBO-A"},
{"market_ticker": "COMBO-B"},
],
contracts="10.00",
rest_remainder=True,
)
batch_id = resp.rfq_batch.id

# Maker: quote every child.
quote = client.communications.rfq_batches.quotes.create(
batch_id,
quotes=[
{"rfq_id": resp.rfq_batch.rfqs[0].id, "yes_bid": "0.56", "no_bid": "0.44"},
{"rfq_id": resp.rfq_batch.rfqs[1].id, "yes_bid": "0.50", "no_bid": "0.50"},
],
rest_remainder=True,
)

# Requester: read the best bid on each child (makers are not identified).
best = client.communications.rfq_batches.best_quotes(batch_id)
accepted = client.communications.rfq_batches.accept(
batch_id,
accepted_side="yes",
min_bids=[
{"rfq_id": q.rfq_id, "bid": q.yes_bid}
for q in best.best_quotes.rfqs
if q.yes_bid is not None
],
)

# Winning maker confirms the children it won.
client.communications.rfq_batches.quotes.confirm(batch_id, quote.id)
```

`list()` / `list_all()` are cursor-paginated (max 20 batches per page).
`quotes.list()` is not paginated — it returns the batch quotes visible to
you on that one batch.

Prices on create-quote entries use `yes_bid` / `no_bid` (no `_dollars`
suffix), matching `quotes.create()`. Accept `min_bids` use Python name
`bid`, serialized as `bid_dollars`. Batch create sizes every child via
`contracts` (`contracts_fp` on the wire) or `target_cost`
(`target_cost_dollars`).

## Migrating from v2.x

| v2.x (deprecated) | v3.0.0 (canonical) |
Expand Down Expand Up @@ -248,6 +313,14 @@ client.communications.block_trade_proposals.accept(proposal_id)
options:
heading_level: 3

::: kalshi.resources.communications.RFQBatchesResource
options:
heading_level: 3

::: kalshi.resources.communications.RFQBatchQuotesResource
options:
heading_level: 3

::: kalshi.resources.communications.AsyncCommunicationsResource
options:
heading_level: 3
Expand All @@ -263,3 +336,11 @@ client.communications.block_trade_proposals.accept(proposal_id)
::: kalshi.resources.communications.AsyncBlockTradeProposalsResource
options:
heading_level: 3

::: kalshi.resources.communications.AsyncRFQBatchesResource
options:
heading_level: 3

::: kalshi.resources.communications.AsyncRFQBatchQuotesResource
options:
heading_level: 3
48 changes: 47 additions & 1 deletion kalshi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
RFQ,
AcceptBlockTradeProposalRequest,
AcceptQuoteRequest,
AcceptRFQBatchRequest,
AcceptRFQBatchResponse,
AccountApiLimits,
AccountApiUsageLevelVolumeGoal,
AccountApiUsageLevelVolumeProgress,
Expand Down Expand Up @@ -68,6 +70,11 @@
CreateOrderV2Response,
CreateQuoteRequest,
CreateQuoteResponse,
CreateRFQBatchChild,
CreateRFQBatchQuoteRequest,
CreateRFQBatchQuoteResponse,
CreateRFQBatchRequest,
CreateRFQBatchResponse,
CreateRFQRequest,
CreateRFQResponse,
CreateSubaccountRequest,
Expand Down Expand Up @@ -110,6 +117,10 @@
GetOrderGroupResponse,
GetQuoteResponse,
GetQuotesResponse,
GetRFQBatchBestQuotesResponse,
GetRFQBatchesResponse,
GetRFQBatchQuotesResponse,
GetRFQBatchResponse,
GetRFQResponse,
GetRFQsResponse,
GetStructuredTargetResponse,
Expand Down Expand Up @@ -161,6 +172,14 @@
QuoteStatusLiteral,
RateLimit,
RestingMarginReservationLiteral,
RFQBatch,
RFQBatchAcceptLimit,
RFQBatchBestQuote,
RFQBatchBestQuotes,
RFQBatchQuote,
RFQBatchQuoteEntry,
RfqBatchQuoteStatusLiteral,
RfqBatchStatusLiteral,
RfqStatusLiteral,
Schedule,
ScopeList,
Expand Down Expand Up @@ -208,9 +227,13 @@
from kalshi.resources.communications import (
AsyncBlockTradeProposalsResource,
AsyncQuotesResource,
AsyncRFQBatchesResource,
AsyncRFQBatchQuotesResource,
AsyncRFQsResource,
BlockTradeProposalsResource,
QuotesResource,
RFQBatchesResource,
RFQBatchQuotesResource,
RFQsResource,
)
from kalshi.types import NullableList, StrictInt
Expand All @@ -219,6 +242,8 @@
"RFQ",
"AcceptBlockTradeProposalRequest",
"AcceptQuoteRequest",
"AcceptRFQBatchRequest",
"AcceptRFQBatchResponse",
"AccountApiLimits",
"AccountApiUsageLevelVolumeGoal",
"AccountApiUsageLevelVolumeProgress",
Expand All @@ -237,6 +262,8 @@
"AsyncKlearClient",
"AsyncPerpsClient",
"AsyncQuotesResource",
"AsyncRFQBatchQuotesResource",
"AsyncRFQBatchesResource",
"AsyncRFQsResource",
"AuthRequiredError",
"Balance",
Expand Down Expand Up @@ -267,6 +294,11 @@
"CreateOrderV2Response",
"CreateQuoteRequest",
"CreateQuoteResponse",
"CreateRFQBatchChild",
"CreateRFQBatchQuoteRequest",
"CreateRFQBatchQuoteResponse",
"CreateRFQBatchRequest",
"CreateRFQBatchResponse",
"CreateRFQRequest",
"CreateRFQResponse",
"CreateSubaccountRequest",
Expand Down Expand Up @@ -313,6 +345,10 @@
"GetOrderGroupResponse",
"GetQuoteResponse",
"GetQuotesResponse",
"GetRFQBatchBestQuotesResponse",
"GetRFQBatchQuotesResponse",
"GetRFQBatchResponse",
"GetRFQBatchesResponse",
"GetRFQResponse",
"GetRFQsResponse",
"GetStructuredTargetResponse",
Expand Down Expand Up @@ -390,9 +426,19 @@
"Quote",
"QuoteStatusLiteral",
"QuotesResource",
"RFQBatch",
"RFQBatchAcceptLimit",
"RFQBatchBestQuote",
"RFQBatchBestQuotes",
"RFQBatchQuote",
"RFQBatchQuoteEntry",
"RFQBatchQuotesResource",
"RFQBatchesResource",
"RFQsResource",
"RateLimit",
"RestingMarginReservationLiteral",
"RfqBatchQuoteStatusLiteral",
"RfqBatchStatusLiteral",
"RfqStatusLiteral",
"Schedule",
"ScopeList",
Expand Down Expand Up @@ -431,4 +477,4 @@
"Withdrawal",
]

__version__ = "22.2.0"
__version__ = "22.3.0"
46 changes: 46 additions & 0 deletions kalshi/_contract_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,52 @@ class ContractEntry:
sdk_model="kalshi.models.communications.AcceptBlockTradeProposalRequest",
spec_schema="AcceptBlockTradeProposalRequest",
),
# RFQ batches. Response items + request bodies, matching Quote/RFQ and
# CreateQuoteRequest/AcceptQuoteRequest. List/create wrappers omitted.
ContractEntry(
sdk_model="kalshi.models.communications.RFQBatch",
spec_schema="RFQBatch",
),
ContractEntry(
sdk_model="kalshi.models.communications.RFQBatchQuote",
spec_schema="RFQBatchQuote",
),
ContractEntry(
sdk_model="kalshi.models.communications.RFQBatchBestQuote",
spec_schema="RFQBatchBestQuote",
notes="bid/contracts fields use short names with _dollars/_fp aliases",
),
ContractEntry(
sdk_model="kalshi.models.communications.RFQBatchBestQuotes",
spec_schema="RFQBatchBestQuotes",
),
ContractEntry(
sdk_model="kalshi.models.communications.CreateRFQBatchRequest",
spec_schema="CreateRFQBatchRequest",
notes="Uses serialization_alias for contracts_fp / target_cost_dollars",
),
ContractEntry(
sdk_model="kalshi.models.communications.CreateRFQBatchQuoteRequest",
spec_schema="CreateRFQBatchQuoteRequest",
),
ContractEntry(
sdk_model="kalshi.models.communications.AcceptRFQBatchRequest",
spec_schema="AcceptRFQBatchRequest",
notes="bid serializes as bid_dollars",
),
ContractEntry(
sdk_model="kalshi.models.communications.CreateRFQBatchChild",
spec_schema="CreateRFQBatchChild",
),
ContractEntry(
sdk_model="kalshi.models.communications.RFQBatchQuoteEntry",
spec_schema="RFQBatchQuoteEntry",
),
ContractEntry(
sdk_model="kalshi.models.communications.RFQBatchAcceptLimit",
spec_schema="RFQBatchAcceptLimit",
notes="bid serializes as bid_dollars",
),
ContractEntry(
sdk_model="kalshi.models.subaccounts.SubaccountBalance",
spec_schema="SubaccountBalance",
Expand Down
Loading
Loading