diff --git a/CHANGELOG.md b/CHANGELOG.md index 34ac465..d1e04cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,53 @@ All notable changes to kalshi-sdk will be documented in this file. +## 12.0.0 — 2026-08-16 + +Reconciles upstream OpenAPI **3.27.0 → 3.28.0**, plus additive perps FCM +risk-control endpoints and a Klear settlement-estimate field, after nightly +contract failures (Closes #503). **Breaking** for constructors of +`TotalRestingOrderValue` that omit the new required breakdown. + +### Changed (breaking) + +- **`TotalRestingOrderValue.resting_order_value_breakdown`** (`list[IndexedBalance]`, + required) — per-shard resting-order value. Each `IndexedBalance.balance` is a + `DollarDecimal`, not integer cents (same type collision as + `Balance.balance_breakdown`). `client.portfolio.total_resting_order_value()` + callers are unaffected; tests/mocks that construct the model must pass the + list (empty is valid). + +### Added + +- Optional **`exchange_index`** query filter on: + - `orders.list()` / `orders.list_all()` (`GET /portfolio/orders`) + - `orders.fills()` / `orders.fills_all()` (deprecated aliases) + - `portfolio.positions()` / `portfolio.positions_all()` + - `portfolio.fills()` / `portfolio.fills_all()` + Omit to return results from every shard (unlike `portfolio.balance()`, + which defaults to shard 0 server-side). +- **Perps FCM** initial-margin caps (sync + async): + - `fcm.risk_controls(subtrader_id, market_ticker=)` + - `fcm.update_risk_controls(subtrader_id, im_cap, market_ticker=)` + (or `request=UpdateFCMSubtraderRiskControlsRequest`) + - `fcm.delete_risk_controls(subtrader_id, market_ticker=)` + Models: `FCMSubtraderRiskControls`, `GetFCMSubtraderRiskControlsResponse`, + `UpdateFCMSubtraderRiskControlsRequest`. +- **Klear** `MarketSettlementEstimate.session_avg_price_fp` (`DollarDecimal`, + optional) — session average entry price; omitted when position quantity is + zero. + +### Spec notes + +- Core OpenAPI `info.version` **3.28.0** (paths 93; 104 operations; 103 + mapped). Still unimplemented on the core client: + `POST /portfolio/intra_exchange_instance_transfer` (use + `PerpsClient.transfers.transfer_instance()`). +- AsyncAPI unchanged (14 channels). +- Perps OpenAPI: paths 35→38 (FCM subtrader risk-control GET/PUT/DELETE). +- Perps SCM OpenAPI: `MarketSettlementEstimate.session_avg_price_fp` optional. + Still unimplemented: `GET /margin/large_trader_positions` (surveillance). + ## 11.0.1 — 2026-08-09 ### Fixed diff --git a/CLAUDE.md b/CLAUDE.md index 41a6449..c3d007c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -122,7 +122,7 @@ tests/ ## API Reference -- OpenAPI spec: https://docs.kalshi.com/openapi.yaml (v3.27.0, 104 operations; 103 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.28.0, 104 operations; 103 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 (14 WebSocket channels; 11 typed `subscribe_*` + escape-hatch) - Base URL: https://api.elections.kalshi.com/trade-api/v2 - Demo URL: https://demo-api.kalshi.co/trade-api/v2 diff --git a/README.md b/README.md index f542b6c..536a2d0 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ 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 (103 mapped of 104 operations across 19 resources, OpenAPI v3.27.0) and WebSocket API (11 typed `subscribe_*` channels + 2 escape-hatch). -- **Perps (margin) API**: standalone `PerpsClient` / `AsyncPerpsClient` + `PerpsWebSocket` for the perpetual-futures exchange (35 REST operations, 6 WS channels), plus a `KlearClient` for the Self-Clearing-Member "Klear" settlement API (16 operations). See [Perps (margin) trading](#perps-margin-trading). +- **Full coverage** of the Kalshi REST API (103 mapped of 104 operations across 19 resources, OpenAPI v3.28.0) and WebSocket API (11 typed `subscribe_*` channels + 2 escape-hatch). +- **Perps (margin) API**: standalone `PerpsClient` / `AsyncPerpsClient` + `PerpsWebSocket` for the perpetual-futures exchange (38 REST operations, 6 WS channels), plus a `KlearClient` for the Self-Clearing-Member "Klear" settlement API (16 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` plus batched variants on `/portfolio/events/orders/*` — the only order-write surface. - **Funding & cost introspection**: `portfolio.deposits()`, `portfolio.withdrawals()`, `account.endpoint_costs()`. diff --git a/ROADMAP.md b/ROADMAP.md index 92c2d66..541ace1 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,6 +2,12 @@ ## Shipped +- **v12.0.0 (2026-08-16)** — Spec-drift reconcile (#503). OpenAPI + 3.27.0 → 3.28.0. **Breaking:** `TotalRestingOrderValue` requires + `resting_order_value_breakdown`. Additive: `exchange_index` query on + orders/positions/fills list endpoints; perps FCM + `risk_controls` / `update_risk_controls` / `delete_risk_controls`; + Klear `MarketSettlementEstimate.session_avg_price_fp`. - **v11.0.0 (2026-08-09)** — Spec-drift reconcile (#499). **Breaking:** removed Klear `active_obligation()` / `settlement_estimate()` after upstream deleted the singular endpoints. Additive: Klear paged obligation detail endpoints diff --git a/docs/index.md b/docs/index.md index ed8d650..654d05d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ A professional, spec-first Python SDK for the [Kalshi](https://kalshi.com) predi markets API. - **Full REST coverage** — 103 mapped of 104 operations across 19 resources - (OpenAPI v3.27.0), every kwarg drift-tested against the spec. + (OpenAPI v3.28.0), every kwarg drift-tested against the spec. - **V2 event-market orders** — new `create_v2` / `amend_v2` / `decrease_v2` / `cancel_v2` family on `/portfolio/events/orders/*`. Legacy `/portfolio/orders` keeps working; deprecation no earlier than May 6, 2026. @@ -16,7 +16,7 @@ markets API. channels), backpressure strategies, and an in-memory orderbook builder. Async-only — access via `AsyncKalshiClient.ws`. - **Perps (margin) API** — standalone `PerpsClient` / `AsyncPerpsClient` + - `PerpsWebSocket` for the perpetual-futures exchange (35 REST operations, 6 WS + `PerpsWebSocket` for the perpetual-futures exchange (38 REST operations, 6 WS) channels), and a `KlearClient` for the Self-Clearing-Member settlement API (16 operations, Bearer token auth). See [Perps](perps.md). - **FIX protocol** — a hand-rolled, async-first FIX engine (FIXT.1.1 / FIX50SP2) diff --git a/docs/migration.md b/docs/migration.md index 383f829..8df737e 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -1,5 +1,45 @@ # Migration +## v11.0 → v12.0.0 + +Reconciles upstream OpenAPI **3.27.0 → 3.28.0**, plus additive perps FCM +risk-control endpoints and a Klear settlement-estimate field (Closes #503). +**Breaking** only for code that constructs `TotalRestingOrderValue` without +the new required breakdown. + +### Response model field changes + +- **`TotalRestingOrderValue.resting_order_value_breakdown`** — required + `list[IndexedBalance]`. Live `portfolio.total_resting_order_value()` + callers are unaffected. + +```python +# Before (constructors / test fixtures): +# TotalRestingOrderValue(total_resting_order_value=12345) + +# After: +TotalRestingOrderValue( + total_resting_order_value=12345, + resting_order_value_breakdown=[], # or parsed IndexedBalance rows +) +``` + +Each breakdown row's `.balance` is a `DollarDecimal`, not integer cents — +same type collision as `Balance.balance_breakdown`. + +### Added (non-breaking) + +- Optional **`exchange_index`** query on `orders.list` / `list_all`, + `portfolio.positions` / `positions_all`, and `portfolio.fills` / + `fills_all` (and the deprecated `orders.fills` aliases). Omit for every + shard. +- **Perps** `fcm.risk_controls()` / `update_risk_controls()` / + `delete_risk_controls()`. +- **Klear** `MarketSettlementEstimate.session_avg_price_fp` (optional). + +See the [changelog](https://github.com/TexasCoding/kalshi-python-sdk/blob/main/CHANGELOG.md) +for the full list. + ## v10.0 → v11.0.0 Reconciles upstream OpenAPI **3.27.0** content, AsyncAPI trade payload fields, diff --git a/docs/perps.md b/docs/perps.md index 9e3e000..c659e7b 100644 --- a/docs/perps.md +++ b/docs/perps.md @@ -66,7 +66,7 @@ async with AsyncPerpsClient.from_env(demo=True) as perps: | `margin` | `balance()`, `risk()`, `notional_risk_limit()`, `fee_tiers()`, `api_limits()` | | `funding` | `rate_estimate()`, `historical_rates()`, `history()` | | `transfers` | `transfer_instance()`, `create_subaccount()`, `transfer_subaccount()` | -| `fcm` | `create_subtrader(subtrader_suffix=...)` — `POST /margin/fcm/subtraders` | +| `fcm` | `create_subtrader(subtrader_suffix=...)`; `risk_controls` / `update_risk_controls` / `delete_risk_controls` | The margin order side is `bid` / `ask` (not the prediction API's `yes` / `no`). Orders create/cancel/decrease/amend are POSTs/DELETEs and are **never retried**. @@ -78,6 +78,22 @@ Orders create/cancel/decrease/amend are POSTs/DELETEs and are **never retried**. once the removal is confirmed permanent. Prediction-API FCM (`client.fcm.*` on `/fcm/*`) is unchanged. +FCM members can set per-subtrader initial-margin caps. A cap with no +`market_ticker` applies across all markets; a ticker scopes it to one +market. `im_cap` is a non-negative `OrderPrice` (fixed-point dollars): + +```python +from decimal import Decimal + +caps = perps.fcm.risk_controls(subtrader_id="user_desk1") +perps.fcm.update_risk_controls( + subtrader_id="user_desk1", + im_cap=Decimal("100.0000"), + market_ticker="BTC-PERP", +) +perps.fcm.delete_risk_controls(subtrader_id="user_desk1", market_ticker="BTC-PERP") +``` + ## Value types & timestamps - Prices are `DollarDecimal` — `FixedPointDollars` strings with up to 6 decimal @@ -228,7 +244,9 @@ klear.margin.delete_subtrader_group(created.group_id) ``` Money fields on the Klear margin schemas are integer **centicents** (`1 USD = -10,000 centicents`); only the withdrawal `amount` is a fixed-point dollar string. +10,000 centicents`); the withdrawal `amount` and +`MarketSettlementEstimate.session_avg_price_fp` are fixed-point dollar +strings. `klear.margin.withdraw_settlement_balance(amount="500.00")` validates the amount as positive at construction (the single real-money write) before any request is sent. The Bearer `access_token` is never logged and is redacted in `repr()` (only the diff --git a/docs/resources/orders.md b/docs/resources/orders.md index 013745e..3064574 100644 --- a/docs/resources/orders.md +++ b/docs/resources/orders.md @@ -19,7 +19,7 @@ Reads stay on `/portfolio/orders/*`. | `amend_v2(order_id, *, request, subaccount)` | `POST /portfolio/events/orders/{order_id}/amend` | never | | `decrease_v2(order_id, *, request, subaccount)` | `POST /portfolio/events/orders/{order_id}/decrease` | never | | `get(order_id)` | `GET /portfolio/orders/{order_id}` | yes (GET) | -| `list(...)` / `list_all(...)` | `GET /portfolio/orders` | yes | +| `list(...)` / `list_all(..., exchange_index=None)` | `GET /portfolio/orders` | yes | | ~~`fills(...)` / `fills_all(...)`~~ | moved to `PortfolioResource` in v3.0.0 — see [Portfolio › Fills](portfolio.md#fills); the old methods remain as deprecated aliases until removal in a future release. | | `queue_positions(*, market_tickers, event_ticker)` | `GET /portfolio/orders/queue_positions` | yes | | `queue_position(order_id)` | `GET /portfolio/orders/{order_id}/queue_position` | yes | @@ -212,6 +212,8 @@ for order in client.orders.list_all(status="resting"): `status` accepts an `OrderStatusLiteral`: `"resting"`, `"canceled"`, `"executed"`. `min_ts` / `max_ts` (Unix seconds) bound by created time. +Optional `exchange_index` (OpenAPI 3.28.0) filters to one shard; omit it +to return orders from every shard. Fills (`fills` / `fills_all`) moved to `PortfolioResource` in v3.0.0 — see [Portfolio › Fills](portfolio.md#fills). `client.orders.fills(...)` / diff --git a/docs/resources/portfolio.md b/docs/resources/portfolio.md index 6205470..d7f8e92 100644 --- a/docs/resources/portfolio.md +++ b/docs/resources/portfolio.md @@ -8,9 +8,9 @@ Auth required throughout. | Method | Endpoint | |---|---| | `balance(*, subaccount=None, exchange_index=None)` | `GET /portfolio/balance` | -| `positions(*, ...)` | `GET /portfolio/positions` | +| `positions(*, ..., exchange_index=None)` | `GET /portfolio/positions` | | `settlements(...)` / `settlements_all(...)` | `GET /portfolio/settlements` | -| `fills(...)` / `fills_all(...)` | `GET /portfolio/fills` | +| `fills(...)` / `fills_all(..., exchange_index=None)` | `GET /portfolio/fills` | | `total_resting_order_value()` | `GET /portfolio/summary/total_resting_order_value` (FCM only) | | `deposits(*, limit, cursor)` / `deposits_all(*, limit, max_pages)` | `GET /portfolio/deposits` | | `withdrawals(*, limit, cursor)` / `withdrawals_all(*, limit, max_pages)` | `GET /portfolio/withdrawals` | @@ -22,6 +22,9 @@ Auth required throughout. `subaccount: int` to scope the read to a specific subaccount (omit for the primary account). `balance()` also takes an optional `exchange_index: int` (spec v3.24.0) to target a specific exchange shard (defaults to 0 server-side). +`positions()` / `positions_all()` and `fills()` / `fills_all()` take an +optional `exchange_index` filter as of OpenAPI 3.28.0 — omit it to return +rows from every shard. ## Balance @@ -153,9 +156,15 @@ Standard `Page[Fill]` pagination — see [Pagination](../pagination.md). ```python total = client.portfolio.total_resting_order_value() -print(total.total_value) +print(total.total_resting_order_value) # integer cents +for shard in total.resting_order_value_breakdown: + # IndexedBalance.balance is DollarDecimal, not cents + print(shard.exchange_index, shard.balance) ``` +`resting_order_value_breakdown` is required as of OpenAPI 3.28.0. Direct +constructors (tests/mocks) must pass it; an empty list is valid. + !!! warning "FCM members only" Non-FCM accounts get a `403` (mapped to `KalshiAuthError`). Demo mirrors production behavior here. diff --git a/kalshi/__init__.py b/kalshi/__init__.py index 57ff780..4c9cfbc 100644 --- a/kalshi/__init__.py +++ b/kalshi/__init__.py @@ -381,4 +381,4 @@ "Withdrawal", ] -__version__ = "11.0.1" +__version__ = "12.0.0" diff --git a/kalshi/_contract_map.py b/kalshi/_contract_map.py index 91cff43..6269b34 100644 --- a/kalshi/_contract_map.py +++ b/kalshi/_contract_map.py @@ -288,7 +288,7 @@ class ContractEntry: ContractEntry( sdk_model="kalshi.models.portfolio.TotalRestingOrderValue", spec_schema="GetPortfolioRestingOrderTotalValueResponse", - notes="Single int total_resting_order_value in cents", + notes="total_resting_order_value in cents + IndexedBalance breakdown", ), ContractEntry( sdk_model="kalshi.models.order_groups.OrderGroup", @@ -792,6 +792,18 @@ class ContractEntry: sdk_model="kalshi.perps.models.fcm.CreateMarginFCMSubtraderResponse", spec_schema="CreateMarginFCMSubtraderResponse", ), + ContractEntry( + sdk_model="kalshi.perps.models.fcm.FCMSubtraderRiskControls", + spec_schema="FCMSubtraderRiskControls", + ), + ContractEntry( + sdk_model="kalshi.perps.models.fcm.GetFCMSubtraderRiskControlsResponse", + spec_schema="GetFCMSubtraderRiskControlsResponse", + ), + ContractEntry( + sdk_model="kalshi.perps.models.fcm.UpdateFCMSubtraderRiskControlsRequest", + spec_schema="UpdateFCMSubtraderRiskControlsRequest", + ), ] PERPS_SCM_CONTRACT_MAP: list[ContractEntry] = [ diff --git a/kalshi/models/portfolio.py b/kalshi/models/portfolio.py index 15a6641..3bc0b72 100644 --- a/kalshi/models/portfolio.py +++ b/kalshi/models/portfolio.py @@ -55,9 +55,14 @@ class TotalRestingOrderValue(BaseModel): Spec: "intended for use by FCM members (rare)". Non-FCM accounts see 403 on this endpoint (demo audit 2026-04-18). + + ``resting_order_value_breakdown`` (required as of OpenAPI 3.28.0) splits + the total across exchange shards. Each :class:`IndexedBalance.balance` + is a :class:`~kalshi.types.DollarDecimal`, not integer cents. """ total_resting_order_value: int + resting_order_value_breakdown: list[IndexedBalance] model_config = {"extra": "allow"} diff --git a/kalshi/perps/__init__.py b/kalshi/perps/__init__.py index 7bc8c27..5da1be2 100644 --- a/kalshi/perps/__init__.py +++ b/kalshi/perps/__init__.py @@ -77,6 +77,11 @@ GetMarginRiskParametersResponse, MarginEnabledResponse, ) +from kalshi.perps.models.fcm import ( + FCMSubtraderRiskControls, + GetFCMSubtraderRiskControlsResponse, + UpdateFCMSubtraderRiskControlsRequest, +) from kalshi.perps.models.funding import ( MarginFundingHistoryEntry, MarginFundingRate, @@ -241,10 +246,12 @@ "ExchangeInstance", "ExchangeInstanceLiteral", "ExchangeStatus", + "FCMSubtraderRiskControls", "FundingPaymentDetail", "FundingRate", "FundingResource", "GetActiveMarginObligationsResponse", + "GetFCMSubtraderRiskControlsResponse", "GetGuarantyFundBalanceResponse", "GetMarginBalanceResponse", "GetMarginFeeTiersResponse", @@ -341,6 +348,7 @@ "TickerPrice", "TimeInForceLiteral", "TransfersResource", + "UpdateFCMSubtraderRiskControlsRequest", "UpdateOrderGroupLimitRequest", "UpdateSubscriptionAction", "WithdrawSettlementBalanceRequest", diff --git a/kalshi/perps/klear/models/margin.py b/kalshi/perps/klear/models/margin.py index e47444c..8a72afe 100644 --- a/kalshi/perps/klear/models/margin.py +++ b/kalshi/perps/klear/models/margin.py @@ -15,10 +15,11 @@ integer-cents precedent in ``kalshi/models/portfolio.py`` (``Balance.balance``, ``Deposit.amount_cents``). Fixed-point **count** strings appear on :attr:`SettlementDetail.position_quantity_fp` and -:attr:`FundingPaymentDetail.position_quantity_fp`. The ONLY fixed-point -**dollar-string** fields are :attr:`WithdrawSettlementBalanceRequest.amount` and -:attr:`GetSettlementBalanceWithdrawalResponse.amount` (e.g. ``"500.00"``); those -use :data:`DollarDecimal`. +:attr:`FundingPaymentDetail.position_quantity_fp`. The fixed-point +**dollar-string** fields are :attr:`WithdrawSettlementBalanceRequest.amount`, +:attr:`GetSettlementBalanceWithdrawalResponse.amount`, and +:attr:`MarketSettlementEstimate.session_avg_price_fp` (e.g. ``"500.00"``); +those use :data:`DollarDecimal`. **Timestamps.** Every REST timestamp is RFC3339 (``format: date-time``) and uses :class:`pydantic.AwareDatetime`; the single ``format: date`` field @@ -277,6 +278,8 @@ class MarketSettlementEstimate(BaseModel): quantity_centicount: int variation_margin_centicents: int notional_value_centicents: int + # Optional fixed-point dollar string; omitted when position quantity is zero. + session_avg_price_fp: DollarDecimal | None = None model_config = {"extra": "allow"} diff --git a/kalshi/perps/models/__init__.py b/kalshi/perps/models/__init__.py index 778387c..de60f44 100644 --- a/kalshi/perps/models/__init__.py +++ b/kalshi/perps/models/__init__.py @@ -25,6 +25,11 @@ GetMarginRiskParametersResponse, MarginEnabledResponse, ) +from kalshi.perps.models.fcm import ( + FCMSubtraderRiskControls, + GetFCMSubtraderRiskControlsResponse, + UpdateFCMSubtraderRiskControlsRequest, +) from kalshi.perps.models.funding import ( MarginFundingHistoryEntry, MarginFundingRate, @@ -109,6 +114,8 @@ "ExchangeInstance", "ExchangeInstanceLiteral", "ExchangeStatus", + "FCMSubtraderRiskControls", + "GetFCMSubtraderRiskControlsResponse", "GetMarginBalanceResponse", "GetMarginFeeTiersResponse", "GetMarginFillsResponse", @@ -149,5 +156,6 @@ "SelfTradePreventionType", "SelfTradePreventionTypeLiteral", "TimeInForceLiteral", + "UpdateFCMSubtraderRiskControlsRequest", "UpdateOrderGroupLimitRequest", ] diff --git a/kalshi/perps/models/fcm.py b/kalshi/perps/models/fcm.py index 19a0bb2..1a0bc7a 100644 --- a/kalshi/perps/models/fcm.py +++ b/kalshi/perps/models/fcm.py @@ -4,6 +4,8 @@ from pydantic import BaseModel, Field +from kalshi.types import DollarDecimal, OrderPrice + class CreateMarginFCMSubtraderRequest(BaseModel): """Body for POST /margin/fcm/subtraders. @@ -24,3 +26,37 @@ class CreateMarginFCMSubtraderResponse(BaseModel): subtrader_id: str model_config = {"extra": "allow"} + + +class FCMSubtraderRiskControls(BaseModel): + """One initial-margin cap for an FCM subtrader. + + A missing ``market_ticker`` means the cap applies across all markets. + """ + + subtrader_id: str + im_cap: DollarDecimal + market_ticker: str | None = None + + model_config = {"extra": "allow"} + + +class GetFCMSubtraderRiskControlsResponse(BaseModel): + """Response from GET /margin/fcm/subtraders/risk_controls.""" + + risk_controls: list[FCMSubtraderRiskControls] + + model_config = {"extra": "allow"} + + +class UpdateFCMSubtraderRiskControlsRequest(BaseModel): + """Body for PUT /margin/fcm/subtraders/risk_controls. + + ``im_cap`` is a non-negative fixed-point dollar amount (max 4 decimals). + """ + + subtrader_id: str + im_cap: OrderPrice + market_ticker: str | None = None + + model_config = {"extra": "forbid"} diff --git a/kalshi/perps/resources/fcm.py b/kalshi/perps/resources/fcm.py index 1006827..02c57f1 100644 --- a/kalshi/perps/resources/fcm.py +++ b/kalshi/perps/resources/fcm.py @@ -1,23 +1,29 @@ -"""Perps FCM resource — create margin FCM subtraders. +"""Perps FCM resource — create margin FCM subtraders and manage IM caps. ``POST /margin/fcm/subtraders`` creates a new FCM subtrader under the -authenticated member. Auth required; POST is never retried. +authenticated member. Auth required; POST/PUT/DELETE are never retried. """ from __future__ import annotations +from decimal import Decimal from typing import overload from kalshi.perps.models.fcm import ( CreateMarginFCMSubtraderRequest, CreateMarginFCMSubtraderResponse, + GetFCMSubtraderRiskControlsResponse, + UpdateFCMSubtraderRiskControlsRequest, ) from kalshi.resources._base import ( AsyncResource, SyncResource, _check_request_exclusive, + _params, ) +_RISK_CONTROLS_PATH = "/margin/fcm/subtraders/risk_controls" + def _build_create_subtrader_body( request: CreateMarginFCMSubtraderRequest | None, @@ -34,6 +40,30 @@ def _build_create_subtrader_body( return request.model_dump(exclude_none=True, by_alias=True, mode="json") +def _build_update_risk_controls_body( + request: UpdateFCMSubtraderRiskControlsRequest | None, + *, + subtrader_id: str | None, + im_cap: Decimal | None, + market_ticker: str | None, +) -> dict[str, object]: + _check_request_exclusive( + request, subtrader_id=subtrader_id, im_cap=im_cap, market_ticker=market_ticker + ) + if request is None: + if subtrader_id is None or im_cap is None: + raise TypeError( + "update_risk_controls() requires `subtrader_id` and `im_cap` " + "(or pass `request=...`)" + ) + request = UpdateFCMSubtraderRiskControlsRequest( + subtrader_id=subtrader_id, + im_cap=im_cap, + market_ticker=market_ticker, + ) + return request.model_dump(exclude_none=True, by_alias=True, mode="json") + + class FcmResource(SyncResource): """Sync perps FCM API.""" @@ -68,6 +98,66 @@ def create_subtrader( data = self._post("/margin/fcm/subtraders", json=body, extra_headers=extra_headers) return CreateMarginFCMSubtraderResponse.model_validate(data) + def risk_controls( + self, + *, + subtrader_id: str, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> GetFCMSubtraderRiskControlsResponse: + """``GET /margin/fcm/subtraders/risk_controls`` — list IM caps.""" + self._require_auth() + params = _params(subtrader_id=subtrader_id, market_ticker=market_ticker) + data = self._get(_RISK_CONTROLS_PATH, params=params, extra_headers=extra_headers) + return GetFCMSubtraderRiskControlsResponse.model_validate(data) + + @overload + def update_risk_controls( + self, + *, + request: UpdateFCMSubtraderRiskControlsRequest, + extra_headers: dict[str, str] | None = None, + ) -> None: ... + @overload + def update_risk_controls( + self, + *, + subtrader_id: str, + im_cap: Decimal, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> None: ... + def update_risk_controls( + self, + *, + request: UpdateFCMSubtraderRiskControlsRequest | None = None, + subtrader_id: str | None = None, + im_cap: Decimal | None = None, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> None: + """``PUT /margin/fcm/subtraders/risk_controls`` — set an IM cap.""" + self._require_auth() + body = _build_update_risk_controls_body( + request, + subtrader_id=subtrader_id, + im_cap=im_cap, + market_ticker=market_ticker, + ) + self._put(_RISK_CONTROLS_PATH, json=body, extra_headers=extra_headers) + + def delete_risk_controls( + self, + *, + subtrader_id: str, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> None: + """``DELETE /margin/fcm/subtraders/risk_controls`` — remove an IM cap.""" + self._require_auth() + params = _params(subtrader_id=subtrader_id, market_ticker=market_ticker) + self._delete(_RISK_CONTROLS_PATH, params=params, extra_headers=extra_headers) + class AsyncFcmResource(AsyncResource): """Async perps FCM API.""" @@ -98,3 +188,63 @@ async def create_subtrader( body = _build_create_subtrader_body(request, subtrader_suffix=subtrader_suffix) data = await self._post("/margin/fcm/subtraders", json=body, extra_headers=extra_headers) return CreateMarginFCMSubtraderResponse.model_validate(data) + + async def risk_controls( + self, + *, + subtrader_id: str, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> GetFCMSubtraderRiskControlsResponse: + """Async :meth:`FcmResource.risk_controls`.""" + self._require_auth() + params = _params(subtrader_id=subtrader_id, market_ticker=market_ticker) + data = await self._get(_RISK_CONTROLS_PATH, params=params, extra_headers=extra_headers) + return GetFCMSubtraderRiskControlsResponse.model_validate(data) + + @overload + async def update_risk_controls( + self, + *, + request: UpdateFCMSubtraderRiskControlsRequest, + extra_headers: dict[str, str] | None = None, + ) -> None: ... + @overload + async def update_risk_controls( + self, + *, + subtrader_id: str, + im_cap: Decimal, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> None: ... + async def update_risk_controls( + self, + *, + request: UpdateFCMSubtraderRiskControlsRequest | None = None, + subtrader_id: str | None = None, + im_cap: Decimal | None = None, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> None: + """Async :meth:`FcmResource.update_risk_controls`.""" + self._require_auth() + body = _build_update_risk_controls_body( + request, + subtrader_id=subtrader_id, + im_cap=im_cap, + market_ticker=market_ticker, + ) + await self._put(_RISK_CONTROLS_PATH, json=body, extra_headers=extra_headers) + + async def delete_risk_controls( + self, + *, + subtrader_id: str, + market_ticker: str | None = None, + extra_headers: dict[str, str] | None = None, + ) -> None: + """Async :meth:`FcmResource.delete_risk_controls`.""" + self._require_auth() + params = _params(subtrader_id=subtrader_id, market_ticker=market_ticker) + await self._delete(_RISK_CONTROLS_PATH, params=params, extra_headers=extra_headers) diff --git a/kalshi/resources/_base.py b/kalshi/resources/_base.py index 2bf3ef0..d90cad2 100644 --- a/kalshi/resources/_base.py +++ b/kalshi/resources/_base.py @@ -96,6 +96,7 @@ def _fills_params( limit: int | None, cursor: str | None, subaccount: int | None, + exchange_index: int | None, ) -> dict[str, Any]: """Build query params for ``/portfolio/fills`` (shared by sync/async).""" limit = _validate_limit(limit, hi=1000) @@ -107,6 +108,7 @@ def _fills_params( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) diff --git a/kalshi/resources/orders.py b/kalshi/resources/orders.py index 9eed8d5..2753fbf 100644 --- a/kalshi/resources/orders.py +++ b/kalshi/resources/orders.py @@ -58,6 +58,7 @@ def _list_orders_params( limit: int | None, cursor: str | None, subaccount: int | None, + exchange_index: int | None, ) -> dict[str, Any]: limit = _validate_limit(limit, hi=1000) return _params( @@ -70,6 +71,7 @@ def _list_orders_params( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) @@ -120,6 +122,7 @@ def list( limit: int | None = None, cursor: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Page[Order]: self._require_auth() @@ -132,6 +135,7 @@ def list( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list( "/portfolio/orders", Order, "orders", params=params, extra_headers=extra_headers @@ -147,6 +151,7 @@ def list_all( max_ts: int | None = None, limit: int | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Iterator[Order]: @@ -161,6 +166,7 @@ def list_all( limit=limit, cursor=None, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/orders", @@ -184,6 +190,7 @@ def fills( limit: int | None = None, cursor: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Page[Fill]: """List trade fills.""" @@ -196,6 +203,7 @@ def fills( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list( "/portfolio/fills", Fill, "fills", params=params, extra_headers=extra_headers @@ -213,6 +221,7 @@ def fills_all( max_ts: int | None = None, limit: int | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Iterator[Fill]: @@ -227,6 +236,7 @@ def fills_all( limit=limit, cursor=None, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/fills", @@ -405,6 +415,7 @@ async def list( limit: int | None = None, cursor: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Page[Order]: self._require_auth() @@ -417,6 +428,7 @@ async def list( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) return await self._list( "/portfolio/orders", Order, "orders", params=params, extra_headers=extra_headers @@ -432,6 +444,7 @@ def list_all( max_ts: int | None = None, limit: int | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> AsyncIterator[Order]: @@ -447,6 +460,7 @@ def list_all( limit=limit, cursor=None, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/orders", @@ -470,6 +484,7 @@ async def fills( limit: int | None = None, cursor: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Page[Fill]: """List trade fills (async).""" @@ -482,6 +497,7 @@ async def fills( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) return await self._list( "/portfolio/fills", Fill, "fills", params=params, extra_headers=extra_headers @@ -499,6 +515,7 @@ def fills_all( max_ts: int | None = None, limit: int | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> AsyncIterator[Fill]: @@ -513,6 +530,7 @@ def fills_all( limit=limit, cursor=None, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/fills", diff --git a/kalshi/resources/portfolio.py b/kalshi/resources/portfolio.py index decc5e6..4f8d951 100644 --- a/kalshi/resources/portfolio.py +++ b/kalshi/resources/portfolio.py @@ -38,6 +38,7 @@ def _positions_params( ticker: str | None, event_ticker: str | None, subaccount: int | None, + exchange_index: int | None, ) -> dict[str, Any]: limit = _validate_limit(limit, hi=1000) return _params( @@ -47,6 +48,7 @@ def _positions_params( ticker=ticker, event_ticker=event_ticker, subaccount=subaccount, + exchange_index=exchange_index, ) @@ -97,6 +99,7 @@ def positions( ticker: str | None = None, event_ticker: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> PositionsResponse: self._require_auth() @@ -107,6 +110,7 @@ def positions( ticker=ticker, event_ticker=event_ticker, subaccount=subaccount, + exchange_index=exchange_index, ) data = self._get("/portfolio/positions", params=params, extra_headers=extra_headers) return PositionsResponse.model_validate(data) @@ -119,6 +123,7 @@ def positions_all( ticker: str | None = None, event_ticker: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Iterator[MarketPosition]: @@ -140,6 +145,7 @@ def positions_all( ticker=ticker, event_ticker=event_ticker, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/positions", @@ -222,6 +228,7 @@ def fills( limit: int | None = None, cursor: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Page[Fill]: """List trade fills (``GET /portfolio/fills``). @@ -239,6 +246,7 @@ def fills( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list( "/portfolio/fills", Fill, "fills", params=params, extra_headers=extra_headers @@ -253,6 +261,7 @@ def fills_all( max_ts: int | None = None, limit: int | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Iterator[Fill]: @@ -267,6 +276,7 @@ def fills_all( limit=limit, cursor=None, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/fills", @@ -450,6 +460,7 @@ async def positions( ticker: str | None = None, event_ticker: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> PositionsResponse: self._require_auth() @@ -460,6 +471,7 @@ async def positions( ticker=ticker, event_ticker=event_ticker, subaccount=subaccount, + exchange_index=exchange_index, ) data = await self._get("/portfolio/positions", params=params, extra_headers=extra_headers) return PositionsResponse.model_validate(data) @@ -472,6 +484,7 @@ def positions_all( ticker: str | None = None, event_ticker: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> AsyncIterator[MarketPosition]: @@ -493,6 +506,7 @@ def positions_all( ticker=ticker, event_ticker=event_ticker, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/positions", @@ -576,6 +590,7 @@ async def fills( limit: int | None = None, cursor: str | None = None, subaccount: int | None = None, + exchange_index: int | None = None, extra_headers: dict[str, str] | None = None, ) -> Page[Fill]: """List trade fills (``GET /portfolio/fills``, async). @@ -591,6 +606,7 @@ async def fills( limit=limit, cursor=cursor, subaccount=subaccount, + exchange_index=exchange_index, ) return await self._list( "/portfolio/fills", Fill, "fills", params=params, extra_headers=extra_headers @@ -605,6 +621,7 @@ def fills_all( max_ts: int | None = None, limit: int | None = None, subaccount: int | None = None, + exchange_index: int | None = None, max_pages: int | None = None, extra_headers: dict[str, str] | None = None, ) -> AsyncIterator[Fill]: @@ -622,6 +639,7 @@ def fills_all( limit=limit, cursor=None, subaccount=subaccount, + exchange_index=exchange_index, ) return self._list_all( "/portfolio/fills", diff --git a/pyproject.toml b/pyproject.toml index e40790e..db4d4b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "kalshi-sdk" -version = "11.0.1" +version = "12.0.0" description = "A professional Python SDK for the Kalshi prediction markets and Perps (margin) APIs" readme = "README.md" license = { text = "MIT" } diff --git a/specs/asyncapi.yaml b/specs/asyncapi.yaml index 3df8ef0..94268bb 100644 --- a/specs/asyncapi.yaml +++ b/specs/asyncapi.yaml @@ -2799,7 +2799,7 @@ components: price_level_structure: type: string description: Optional - This key will exist when the market is created or when the price level structure is updated. The price level structure of the market - enum: ["linear_cent", "deci_cent", "tapered_deci_cent", "center_whole_edge_half_cent", "center_whole_edge_quint_cent", "center_half_edge_half_cent", "center_half_edge_quint_cent", "center_half_edge_deci_cent", "center_quint_edge_quint_cent", "center_quint_edge_deci_cent", "center_centi_edge_centi_cent"] + enum: ["linear_cent", "deci_cent", "tapered_deci_cent", "center_whole_edge_half_cent", "center_whole_edge_quint_cent", "center_half_edge_half_cent", "center_half_edge_quint_cent", "center_half_edge_deci_cent", "center_quint_edge_quint_cent", "center_quint_edge_deci_cent", "center_centi_edge_centi_cent", "center_deci_edge_centi_cent"] price_ranges: type: array description: Optional - Emitted alongside price_level_structure (on market creation and price_level_structure_updated events). The valid price bands for the market, in fixed-point dollars. Use this to determine valid order prices rather than hardcoding a tick size. diff --git a/specs/openapi.yaml b/specs/openapi.yaml index 442a2d1..1e29dc7 100644 --- a/specs/openapi.yaml +++ b/specs/openapi.yaml @@ -1,10 +1,9 @@ openapi: 3.0.0 info: title: Kalshi Trade API Manual Endpoints - version: 3.27.0 - description: >- - Manually defined OpenAPI spec for endpoints being migrated to spec-first - approach + version: 3.28.0 + description: Manually defined OpenAPI spec for endpoints being migrated to spec-first approach + servers: - url: https://external-api.kalshi.com/trade-api/v2 description: Production Trade API server @@ -14,6 +13,7 @@ servers: description: Demo Trade API server - url: https://demo-api.kalshi.co/trade-api/v2 description: Demo shared API server, also supported + paths: /exchange/status: get: @@ -47,6 +47,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ExchangeStatus' + /series/fee_changes: get: operationId: GetSeriesFeeChanges @@ -78,6 +79,7 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /exchange/schedule: get: operationId: GetExchangeSchedule @@ -94,6 +96,7 @@ paths: $ref: '#/components/schemas/GetExchangeScheduleResponse' '500': description: Internal server error + /exchange/user_data_timestamp: get: operationId: GetUserDataTimestamp @@ -110,19 +113,14 @@ paths: $ref: '#/components/schemas/GetUserDataTimestampResponse' '500': description: Internal server error + /series/{series_ticker}/markets/{ticker}/candlesticks: get: operationId: GetMarketCandlesticks summary: Get Market Candlesticks - description: > - Time period length of each candlestick in minutes. Valid values: 1 (1 - minute), 60 (1 hour), 1440 (1 day). - - Candlesticks for markets that settled before the historical cutoff are - only available via `GET /historical/markets/{ticker}/candlesticks`. See - [Historical - Data](https://docs.kalshi.com/getting_started/historical_data) for - details. + description: | + Time period length of each candlestick in minutes. Valid values: 1 (1 minute), 60 (1 hour), 1440 (1 day). + Candlesticks for markets that settled before the historical cutoff are only available via `GET /historical/markets/{ticker}/candlesticks`. See [Historical Data](https://docs.kalshi.com/getting_started/historical_data) for details. tags: - market parameters: @@ -141,53 +139,38 @@ paths: - name: start_ts in: query required: true - description: >- - Start timestamp (Unix timestamp). Candlesticks will include those - ending on or after this time. + description: Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time. schema: type: integer format: int64 - name: end_ts in: query required: true - description: >- - End timestamp (Unix timestamp). Candlesticks will include those - ending on or before this time. + description: End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time. schema: type: integer format: int64 - name: period_interval in: query required: true - description: >- - Time period length of each candlestick in minutes. Valid values are - 1 (1 minute), 60 (1 hour), or 1440 (1 day). + description: Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day). schema: type: integer - enum: - - 1 - - 60 - - 1440 + enum: [1, 60, 1440] x-enum-varnames: - GetMarketCandlesticksParamsPeriodIntervalN1 - GetMarketCandlesticksParamsPeriodIntervalN60 - GetMarketCandlesticksParamsPeriodIntervalN1440 x-oapi-codegen-extra-tags: - validate: required,oneof=1 60 1440 + validate: "required,oneof=1 60 1440" - name: include_latest_before_start in: query required: false - description: > - If true, prepends the latest candlestick available before the - start_ts. This synthetic candlestick is created by: - + description: | + If true, prepends the latest candlestick available before the start_ts. This synthetic candlestick is created by: 1. Finding the most recent real candlestick before start_ts - - 2. Projecting it forward to the first period boundary (calculated as - the next period interval after start_ts) - - 3. Setting all OHLC prices to null, and `previous_price` to the - close price from the real candlestick + 2. Projecting it forward to the first period boundary (calculated as the next period interval after start_ts) + 3. Setting all OHLC prices to null, and `previous_price` to the close price from the real candlestick schema: type: boolean default: false @@ -204,21 +187,13 @@ paths: description: Not found '500': description: Internal server error + /markets/trades: get: operationId: GetTrades summary: Get Trades - description: > - Endpoint for getting all trades for all markets. A trade represents a - completed transaction between two users on a specific market. Each trade - includes the market ticker, price, quantity, and timestamp information. - Block trades are included in the response by default and identified by - the `is_block_trade` field; use the `is_block_trade` query parameter to - filter by block / non-block. This endpoint returns a paginated response. - Use the 'limit' parameter to control page size (1-1000, defaults to - 100). The response includes a 'cursor' field - pass this value in the - 'cursor' parameter of your next request to get the next page. An empty - cursor indicates no more pages are available. + description: | + Endpoint for getting all trades for all markets. A trade represents a completed transaction between two users on a specific market. Each trade includes the market ticker, price, quantity, and timestamp information. Block trades are included in the response by default and identified by the `is_block_trade` field; use the `is_block_trade` query parameter to filter by block / non-block. This endpoint returns a paginated response. Use the 'limit' parameter to control page size (1-1000, defaults to 100). The response includes a 'cursor' field - pass this value in the 'cursor' parameter of your next request to get the next page. An empty cursor indicates no more pages are available. tags: - market parameters: @@ -239,6 +214,7 @@ paths: description: Bad request '500': description: Internal server error + /markets/{ticker}/orderbook: get: operationId: GetMarketOrderbook @@ -254,9 +230,7 @@ paths: - $ref: '#/components/parameters/TickerPath' - name: depth in: query - description: >- - Depth of the orderbook to retrieve (0 or negative means all levels, - 1-100 for specific depth) + description: Depth of the orderbook to retrieve (0 or negative means all levels, 1-100 for specific depth) required: false schema: type: integer @@ -278,20 +252,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /markets/orderbooks: get: operationId: GetMarketOrderbooks summary: Get Multiple Market Orderbooks - description: >- - Endpoint for getting the current order books for multiple markets in a - single request. The order book shows all active bid orders for both yes - and no sides of a binary market. It returns yes bids and no bids only - (no asks are returned). This is because in binary markets, a bid for yes - at price X is equivalent to an ask for no at price (100-X). For example, - a yes bid at 7¢ is the same as a no ask at 93¢, with identical contract - sizes. Each side shows price levels with their corresponding quantities - and order counts, organized from best to worst prices. Returns one - orderbook per requested market ticker. + description: 'Endpoint for getting the current order books for multiple markets in a single request. The order book shows all active bid orders for both yes and no sides of a binary market. It returns yes bids and no bids only (no asks are returned). This is because in binary markets, a bid for yes at price X is equivalent to an ask for no at price (100-X). For example, a yes bid at 7¢ is the same as a no ask at 93¢, with identical contract sizes. Each side shows price levels with their corresponding quantities and order counts, organized from best to worst prices. Returns one orderbook per requested market ticker.' tags: - market security: @@ -327,6 +293,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /series/{series_ticker}: get: operationId: GetSeries @@ -348,9 +315,7 @@ paths: type: boolean default: false x-go-type-skip-optional-pointer: true - description: >- - If true, includes the total volume traded across all events in this - series. + description: If true, includes the total volume traded across all events in this series. responses: '200': description: Series retrieved successfully @@ -362,6 +327,7 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /series: get: operationId: GetSeriesList @@ -396,15 +362,11 @@ paths: type: boolean default: false x-go-type-skip-optional-pointer: true - description: >- - If true, includes the total volume traded across all events in each - series. + description: If true, includes the total volume traded across all events in each series. - name: min_updated_ts in: query required: false - description: >- - Filter series with metadata updated after this Unix timestamp (in - seconds). Use this to efficiently poll for changes. + description: Filter series with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes. schema: type: integer format: int64 @@ -419,24 +381,25 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /markets: get: operationId: GetMarkets summary: Get Markets - description: > - Filter by market status. Possible values: `unopened`, `open`, `closed`, - `settled`. Leave empty to return markets with any status. - - Only one `status` filter may be supplied at a time. - - Timestamp filters will be mutually exclusive from other timestamp filters and certain status filters. - - | Compatible Timestamp Filters | Additional Status Filters| Extra Notes | - |------------------------------|--------------------------|-------------| - | min_created_ts, max_created_ts | `unopened`, `open`, *empty* | | - | min_close_ts, max_close_ts | `closed`, *empty* | | - | min_settled_ts, max_settled_ts | `settled`, *empty* | | - | min_updated_ts | *empty* | Incompatible with all filters besides `mve_filter=exclude`. May be combined with `series_ticker`, which requires `mve_filter=exclude` | - - Markets that settled before the historical cutoff are only available via `GET /historical/markets`. See [Historical Data](https://docs.kalshi.com/getting_started/historical_data) for details. + description: | + Filter by market status. Possible values: `unopened`, `open`, `closed`, `settled`. Leave empty to return markets with any status. + - Only one `status` filter may be supplied at a time. + - Timestamp filters will be mutually exclusive from other timestamp filters and certain status filters. + + | Compatible Timestamp Filters | Additional Status Filters| Extra Notes | + |------------------------------|--------------------------|-------------| + | min_created_ts, max_created_ts | `unopened`, `open`, *empty* | | + | min_close_ts, max_close_ts | `closed`, *empty* | | + | min_settled_ts, max_settled_ts | `settled`, *empty* | | + | min_updated_ts | *empty* | Incompatible with all filters besides `mve_filter=exclude`. May be combined with `series_ticker`, which requires `mve_filter=exclude` | + + Markets that settled before the historical cutoff are only available via `GET /historical/markets`. See [Historical Data](https://docs.kalshi.com/getting_started/historical_data) for details. + tags: - market parameters: @@ -467,6 +430,7 @@ paths: description: Unauthorized '500': description: Internal server error + /markets/{ticker}: get: operationId: GetMarket @@ -489,22 +453,18 @@ paths: description: Not found '500': description: Internal server error + /markets/candlesticks: get: operationId: BatchGetMarketCandlesticks summary: Batch Get Market Candlesticks - description: > + description: | Endpoint for retrieving candlestick data for multiple markets. - - Accepts up to 100 market tickers per request - - Returns up to 10,000 candlesticks total across all markets - - Returns candlesticks grouped by market_id - - - Optionally includes a synthetic initial candlestick for price - continuity (see `include_latest_before_start` parameter) + - Optionally includes a synthetic initial candlestick for price continuity (see `include_latest_before_start` parameter) tags: - market parameters: @@ -539,17 +499,11 @@ paths: - name: include_latest_before_start in: query required: false - description: > - If true, prepends the latest candlestick available before the - start_ts. This synthetic candlestick is created by: - + description: | + If true, prepends the latest candlestick available before the start_ts. This synthetic candlestick is created by: 1. Finding the most recent real candlestick before start_ts - - 2. Projecting it forward to the first period boundary (calculated as - the next period interval after start_ts) - - 3. Setting all OHLC prices to null, and `previous_price` to the - close price from the real candlestick + 2. Projecting it forward to the first period boundary (calculated as the next period interval after start_ts) + 3. Setting all OHLC prices to null, and `previous_price` to the close price from the real candlestick schema: type: boolean default: false @@ -566,6 +520,7 @@ paths: description: Unauthorized '500': description: Internal server error + /series/{series_ticker}/events/{ticker}/candlesticks: get: operationId: GetMarketCandlesticksByEvent @@ -594,7 +549,7 @@ paths: type: integer format: int64 x-oapi-codegen-extra-tags: - validate: required + validate: "required" - name: end_ts in: query required: true @@ -603,22 +558,17 @@ paths: type: integer format: int64 x-oapi-codegen-extra-tags: - validate: required + validate: "required" - name: period_interval in: query required: true - description: >- - Specifies the length of each candlestick period, in minutes. Must be - one minute, one hour, or one day. + description: Specifies the length of each candlestick period, in minutes. Must be one minute, one hour, or one day. schema: type: integer format: int32 - enum: - - 1 - - 60 - - 1440 + enum: [1, 60, 1440] x-oapi-codegen-extra-tags: - validate: required,oneof=1 60 1440 + validate: "required,oneof=1 60 1440" responses: '200': description: Event candlesticks retrieved successfully @@ -632,27 +582,22 @@ paths: description: Unauthorized '500': description: Internal server error + /events: get: operationId: GetEvents summary: Get Events - description: > + description: | Get all events. This endpoint excludes multivariate events. - - To retrieve multivariate events, use the GET /events/multivariate - endpoint. - - All events are accessible through this endpoint, even if their - associated markets are older than the historical cutoff. + To retrieve multivariate events, use the GET /events/multivariate endpoint. + All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. tags: - events parameters: - name: limit in: query required: false - description: >- - Parameter to specify the number of results per page. Defaults to - 200. Maximum value is 200. + description: Parameter to specify the number of results per page. Defaults to 200. Maximum value is 200. schema: type: integer minimum: 1 @@ -661,21 +606,13 @@ paths: - name: cursor in: query required: false - description: >- - Parameter to specify the pagination cursor. Use the cursor value - returned from the previous response to get the next page of results. - Leave empty for the first page. + description: Parameter to specify the pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. schema: type: string - name: with_nested_markets in: query required: false - description: >- - Parameter to specify if nested markets should be included in the - response. When true, each event will include a 'markets' field - containing a list of Market objects associated with that event. - Historical markets settled before the historical cutoff will not be - included. + description: Parameter to specify if nested markets should be included in the response. When true, each event will include a 'markets' field containing a list of Market objects associated with that event. Historical markets settled before the historical cutoff will not be included. schema: type: boolean default: false @@ -691,33 +628,23 @@ paths: - name: status in: query required: false - description: >- - Filter by event status. Possible values are 'unopened', 'open', - 'closed', 'settled'. Leave empty to return events with any status. + description: Filter by event status. Possible values are 'unopened', 'open', 'closed', 'settled'. Leave empty to return events with any status. schema: type: string - enum: - - unopened - - open - - closed - - settled + enum: ['unopened', 'open', 'closed', 'settled'] - $ref: '#/components/parameters/SeriesTickerQuery' - $ref: '#/components/parameters/EventTickersQuery' - name: min_close_ts in: query required: false - description: >- - Filter events with at least one market with close timestamp greater - than this Unix timestamp (in seconds). + description: Filter events with at least one market with close timestamp greater than this Unix timestamp (in seconds). schema: type: integer format: int64 - name: min_updated_ts in: query required: false - description: >- - Filter events with metadata updated after this Unix timestamp (in - seconds). Use this to efficiently poll for changes. + description: Filter events with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes. schema: type: integer format: int64 @@ -734,14 +661,12 @@ paths: description: Unauthorized '500': description: Internal server error + /events/multivariate: get: operationId: GetMultivariateEvents summary: Get Multivariate Events - description: >- - Retrieve multivariate (combo) events. These are dynamically created - events from multivariate event collections. Supports filtering by series - and collection ticker. + description: 'Retrieve multivariate (combo) events. These are dynamically created events from multivariate event collections. Supports filtering by series and collection ticker.' tags: - events parameters: @@ -757,28 +682,20 @@ paths: - name: cursor in: query required: false - description: >- - Pagination cursor. Use the cursor value returned from the previous - response to get the next page of results. + description: Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. schema: type: string - $ref: '#/components/parameters/SeriesTickerQuery' - name: collection_ticker in: query required: false - description: >- - Filter events by collection ticker. Returns only multivariate events - belonging to the specified collection. Cannot be used together with - series_ticker. + description: Filter events by collection ticker. Returns only multivariate events belonging to the specified collection. Cannot be used together with series_ticker. schema: type: string - name: with_nested_markets in: query required: false - description: >- - Parameter to specify if nested markets should be included in the - response. When true, each event will include a 'markets' field - containing a list of Market objects associated with that event. + description: Parameter to specify if nested markets should be included in the response. When true, each event will include a 'markets' field containing a list of Market objects associated with that event. schema: type: boolean default: false @@ -795,14 +712,13 @@ paths: description: Unauthorized '500': description: Internal server error + /events/fee_changes: get: operationId: GetEventFeeChanges summary: Get Event Fee Changes - description: > - Event fees are an override layered on top of the parent series' fee - structure. If `fee_type_override` and `fee_multiplier_override` are - null, that indicates the override is cleared. + description: | + Event fees are an override layered on top of the parent series' fee structure. If `fee_type_override` and `fee_multiplier_override` are null, that indicates the override is cleared. tags: - events parameters: @@ -825,20 +741,15 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /events/{event_ticker}: get: operationId: GetEvent summary: Get Event - description: > - Endpoint for getting data about an event by its ticker. An event - represents a real-world occurrence that can be traded on, such as an - election, sports game, or economic indicator release. - - Events contain one or more markets where users can place trades on - different outcomes. - - All events are accessible through this endpoint, even if their - associated markets are older than the historical cutoff. + description: | + Endpoint for getting data about an event by its ticker. An event represents a real-world occurrence that can be traded on, such as an election, sports game, or economic indicator release. + Events contain one or more markets where users can place trades on different outcomes. + All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. tags: - events parameters: @@ -851,11 +762,7 @@ paths: - name: with_nested_markets in: query required: false - description: >- - If true, markets are included within the event object. If false - (default), markets are returned as a separate top-level field in the - response. Historical markets settled before the historical cutoff - will not be included. + description: If true, markets are included within the event object. If false (default), markets are returned as a separate top-level field in the response. Historical markets settled before the historical cutoff will not be included. schema: type: boolean default: false @@ -869,12 +776,13 @@ paths: $ref: '#/components/schemas/GetEventResponse' '400': description: Bad request - '401': - description: Unauthorized '404': description: Event not found + '401': + description: Unauthorized '500': description: Internal server error + /events/{event_ticker}/metadata: get: operationId: GetEventMetadata @@ -898,19 +806,18 @@ paths: $ref: '#/components/schemas/GetEventMetadataResponse' '400': description: Bad request - '401': - description: Unauthorized '404': description: Event not found + '401': + description: Unauthorized '500': description: Internal server error + /series/{series_ticker}/events/{ticker}/forecast_percentile_history: get: operationId: GetEventForecastPercentilesHistory summary: Get Event Forecast Percentile History - description: >- - Endpoint for getting the historical raw and formatted forecast numbers - for an event at specific percentiles. + description: Endpoint for getting the historical raw and formatted forecast numbers for an event at specific percentiles. tags: - events security: @@ -961,44 +868,32 @@ paths: - name: period_interval in: query required: true - description: >- - Specifies the length of each forecast period, in minutes. 0 for - 5-second intervals, or 1, 60, or 1440 for minute-based intervals. + description: Specifies the length of each forecast period, in minutes. 0 for 5-second intervals, or 1, 60, or 1440 for minute-based intervals. schema: type: integer format: int32 - enum: - - 0 - - 1 - - 60 - - 1440 + enum: [0, 1, 60, 1440] responses: '200': description: Event forecast percentile history retrieved successfully content: application/json: schema: - $ref: >- - #/components/schemas/GetEventForecastPercentilesHistoryResponse + $ref: '#/components/schemas/GetEventForecastPercentilesHistoryResponse' '400': description: Bad request '401': description: Unauthorized '500': description: Internal server error + /portfolio/orders: get: operationId: GetOrders summary: Get Orders - description: > - Restricts the response to orders that have a certain status: resting, - canceled, or executed. - - Orders that have been canceled or fully executed before the historical - cutoff are only available via `GET /historical/orders`. Resting orders - will always be available through this endpoint. See [Historical - Data](https://docs.kalshi.com/getting_started/historical_data) for - details. + description: | + Restricts the response to orders that have a certain status: resting, canceled, or executed. + Orders that have been canceled or fully executed before the historical cutoff are only available via `GET /historical/orders`. Resting orders will always be available through this endpoint. See [Historical Data](https://docs.kalshi.com/getting_started/historical_data) for details. tags: - orders security: @@ -1014,6 +909,7 @@ paths: - $ref: '#/components/parameters/LimitQuery' - $ref: '#/components/parameters/CursorQuery' - $ref: '#/components/parameters/SubaccountQuery' + - $ref: '#/components/parameters/ExchangeIndexFilterQuery' responses: '200': description: Orders retrieved successfully @@ -1027,19 +923,16 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/orders/{order_id}: get: operationId: GetOrder summary: Get Order description: ' Endpoint for getting a single order.' x-mint: - content: > + content: | - - **Rate limit:** 2 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - orders @@ -1062,6 +955,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/orders/queue_positions: get: operationId: GetOrderQueuePositions @@ -1098,6 +992,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/orders/{order_id}/queue_position: get: operationId: GetOrderQueuePosition @@ -1124,16 +1019,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/events/orders: post: operationId: CreateOrderV2 summary: Create Order (V2) - description: >- - Endpoint for submitting event-market orders using the V2 - request/response shape (single-book `bid`/`ask` side and fixed-point - dollar prices). The legacy `/portfolio/orders` endpoint will be - deprecated no earlier than May 6, 2026 — clients should migrate to this - path. + description: 'Endpoint for submitting event-market orders using the V2 request/response shape (single-book `bid`/`ask` side and fixed-point dollar prices). The legacy `/portfolio/orders` endpoint will be deprecated no earlier than May 6, 2026 — clients should migrate to this path.' tags: - orders security: @@ -1163,24 +1054,16 @@ paths: $ref: '#/components/responses/RateLimitError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/events/orders/batched: post: operationId: BatchCreateOrdersV2 summary: Batch Create Orders (V2) - description: >- - Endpoint for submitting a batch of event-market orders using the V2 - request/response shape. The maximum batch size scales with your tier's - write budget — see [Rate Limits and - Tiers](/getting_started/rate_limits). + description: 'Endpoint for submitting a batch of event-market orders using the V2 request/response shape. The maximum batch size scales with your tier''s write budget — see [Rate Limits and Tiers](/getting_started/rate_limits).' x-mint: - content: > + content: | - - **Rate limit:** 10 tokens per order in the batch — billed per item, so - total cost for a batch of N orders is N × 10. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 10 tokens per order in the batch — billed per item, so total cost for a batch of N orders is N × 10. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - orders @@ -1209,22 +1092,15 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + delete: operationId: BatchCancelOrdersV2 summary: Batch Cancel Orders (V2) - description: >- - Endpoint for cancelling a batch of event-market orders using the V2 - response shape. The maximum batch size scales with your tier's write - budget — see [Rate Limits and Tiers](/getting_started/rate_limits). + description: 'Endpoint for cancelling a batch of event-market orders using the V2 response shape. The maximum batch size scales with your tier''s write budget — see [Rate Limits and Tiers](/getting_started/rate_limits).' x-mint: - content: > + content: | - - **Rate limit:** 2 tokens per order in the batch — billed per item, so - total cost for a batch of N cancels is N × 2. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per order in the batch — billed per item, so total cost for a batch of N cancels is N × 2. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - orders @@ -1253,22 +1129,16 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/events/orders/{order_id}: delete: operationId: CancelOrderV2 summary: Cancel Order (V2) - description: >- - Endpoint for cancelling event-market orders using the V2 response shape. - Returns `{order_id, client_order_id, reduced_by}` rather than a full - order object. + description: 'Endpoint for cancelling event-market orders using the V2 response shape. Returns `{order_id, client_order_id, reduced_by}` rather than a full order object.' x-mint: - content: > + content: | - - **Rate limit:** 2 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - orders @@ -1299,25 +1169,16 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/events/orders/{order_id}/amend: post: operationId: AmendOrderV2 summary: Amend Order (V2) - description: >- - Endpoint for amending the price and/or max fillable count of an existing - event-market order using the V2 request/response shape. The request - `count` is the updated total/max fillable count, equal to already filled - count plus desired resting remaining count. This behavior matches the v1 - amend endpoints; only the request/response shape differs. + description: 'Endpoint for amending the price and/or max fillable count of an existing event-market order using the V2 request/response shape. The request `count` is the updated total/max fillable count, equal to already filled count plus desired resting remaining count. This behavior matches the v1 amend endpoints; only the request/response shape differs.' x-mint: - content: > + content: | - - Amending a resting order preserves queue position only when the - amendment decreases size. All other amendments — like increasing size - or changing price forfeit queue position and place the order at the - back of the queue. - + Amending a resting order preserves queue position only when the amendment decreases size. All other amendments — like increasing size or changing price forfeit queue position and place the order at the back of the queue. tags: - orders @@ -1349,14 +1210,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/events/orders/{order_id}/decrease: post: operationId: DecreaseOrderV2 summary: Decrease Order (V2) - description: >- - Endpoint for decreasing the remaining count of an existing event-market - order using the V2 request/response shape. Exactly one of `reduce_by` or - `reduce_to` must be provided. + description: 'Endpoint for decreasing the remaining count of an existing event-market order using the V2 request/response shape. Exactly one of `reduce_by` or `reduce_to` must be provided.' tags: - orders security: @@ -1387,6 +1246,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/order_groups: get: operationId: GetOrderGroups @@ -1413,6 +1273,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/order_groups/create: post: operationId: CreateOrderGroup @@ -1443,6 +1304,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/order_groups/{order_group_id}: get: operationId: GetOrderGroup @@ -1497,6 +1359,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/order_groups/{order_group_id}/reset: put: operationId: ResetOrderGroup @@ -1531,6 +1394,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/order_groups/{order_group_id}/trigger: put: operationId: TriggerOrderGroup @@ -1565,6 +1429,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/order_groups/{order_group_id}/limit: put: operationId: UpdateOrderGroupLimit @@ -1601,17 +1466,13 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + + # Portfolio endpoints /portfolio/balance: get: operationId: GetBalance summary: Get Balance - description: >- - Endpoint for getting the balance and portfolio value of a member. By - default the returned balance is the primary account's available balance. - Pass a non-zero `subaccount` to fetch that subaccount's balance on a - specific exchange index instead (`exchange_index`, defaulting to 0). - When `subaccount` is omitted or 0, `exchange_index` has no effect. This - endpoint also accepts API keys with the 'read::portfolio_balance' scope. + description: "Endpoint for getting the balance and portfolio value of a member. `portfolio_value` is always scoped to the requested `exchange_index` (defaulting to 0). When `subaccount` is omitted, `balance` is the primary account's aggregate available balance; pass `subaccount` explicitly (0 for primary, 1-63 for subaccounts) to read that subaccount's balance on the requested exchange index instead. This endpoint also accepts API keys with the 'read::portfolio_balance' scope." tags: - portfolio security: @@ -1625,10 +1486,7 @@ paths: schema: $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true - description: >- - Exchange index to read the subaccount balance from, paired with a - non-zero `subaccount`. Defaults to 0. Ignored when `subaccount` is - omitted or 0. + description: 'Exchange index to scope the returned portfolio value to, and the balance when `subaccount` is provided. Defaults to 0.' responses: '200': description: Balance retrieved successfully @@ -1640,11 +1498,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/intra_exchange_instance_transfer: post: operationId: IntraExchangeInstanceTransfer summary: Intra Account Transfer - description: Endpoint for transferring funds within the same account. + description: 'Endpoint for transferring funds within the same account.' tags: - portfolio security: @@ -1672,11 +1531,12 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/intra_exchange_instance_transfers: get: operationId: GetIntraExchangeInstanceTransfers summary: Get Intra Account Transfers - description: Endpoint for fetching intra-exchange account transfer history. + description: 'Endpoint for fetching intra-exchange account transfer history.' tags: - portfolio security: @@ -1699,11 +1559,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/intra_exchange_instance_transfers/{transfer_id}: get: operationId: GetIntraExchangeInstanceTransfer summary: Get Intra Account Transfer - description: Endpoint for getting a single intra-account transfer by id. + description: 'Endpoint for getting a single intra-account transfer by id.' tags: - portfolio security: @@ -1730,15 +1591,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/subaccounts: post: operationId: CreateSubaccount summary: Create Subaccount - description: >- - Creates a new subaccount for the authenticated user. This endpoint is - available to all users on the Advanced API tier and above. Subaccounts - are numbered sequentially starting from 1. Maximum 63 numbered - subaccounts per user (64 including the primary account). + description: 'Creates a new subaccount for the authenticated user. This endpoint is available to all users on the Advanced API tier and above. Subaccounts are numbered sequentially starting from 1. Maximum 63 numbered subaccounts per user (64 including the primary account).' tags: - portfolio security: @@ -1764,15 +1622,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/subaccounts/transfer: post: operationId: ApplySubaccountTransfer summary: Transfer Between Subaccounts - description: >- - Transfers funds between the authenticated user's subaccounts. Use 0 for - the primary account, or 1-63 for numbered subaccounts. Set - exchange_index to apply the transfer on a specific exchange shard - (defaults to 0). + description: 'Transfers funds between the authenticated user''s subaccounts. Use 0 for the primary account, or 1-63 for numbered subaccounts. Set exchange_index to apply the transfer on a specific exchange shard (defaults to 0).' tags: - portfolio security: @@ -1798,11 +1653,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/subaccounts/balances: get: operationId: GetSubaccountBalances summary: Get All Subaccount Balances - description: Gets balances for all subaccounts including the primary account. + description: 'Gets balances for all subaccounts including the primary account.' tags: - portfolio security: @@ -1820,13 +1676,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/subaccounts/transfers: get: operationId: GetSubaccountTransfers summary: Get Subaccount Transfers - description: >- - Gets a paginated list of all transfers between subaccounts for the - authenticated user. + description: 'Gets a paginated list of all transfers between subaccounts for the authenticated user.' tags: - portfolio security: @@ -1847,13 +1702,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/subaccounts/netting: put: operationId: UpdateSubaccountNetting summary: Update Subaccount Netting - description: >- - Updates the netting enabled setting for a specific subaccount. Use 0 for - the primary account, or 1-63 for numbered subaccounts. + description: 'Updates the netting enabled setting for a specific subaccount. Use 0 for the primary account, or 1-63 for numbered subaccounts.' tags: - portfolio security: @@ -1878,7 +1732,7 @@ paths: get: operationId: GetSubaccountNetting summary: Get Subaccount Netting - description: Gets the netting enabled settings for all subaccounts. + description: 'Gets the netting enabled settings for all subaccounts.' tags: - portfolio security: @@ -1896,14 +1750,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/positions: get: operationId: GetPositions summary: Get Positions - description: >- - Restricts the positions to those with any of following fields with - non-zero values, as a comma separated list. The following values are - accepted: position, total_traded + description: 'Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded' tags: - portfolio security: @@ -1917,6 +1769,7 @@ paths: - $ref: '#/components/parameters/TickerQuery' - $ref: '#/components/parameters/SingleEventTickerQuery' - $ref: '#/components/parameters/SubaccountQueryDefaultPrimary' + - $ref: '#/components/parameters/ExchangeIndexFilterQuery' responses: '200': description: Positions retrieved successfully @@ -1930,6 +1783,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/settlements: get: operationId: GetSettlements @@ -1962,11 +1816,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/deposits: get: operationId: GetDeposits summary: Get Deposits - description: Endpoint for getting the member's deposit history. + description: 'Endpoint for getting the member''s deposit history.' tags: - portfolio security: @@ -1989,11 +1844,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/withdrawals: get: operationId: GetWithdrawals summary: Get Withdrawals - description: Endpoint for getting the member's withdrawal history. + description: 'Endpoint for getting the member''s withdrawal history.' tags: - portfolio security: @@ -2016,6 +1872,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/summary/total_resting_order_value: get: operationId: GetPortfolioRestingOrderTotalValue @@ -2033,24 +1890,19 @@ paths: content: application/json: schema: - $ref: >- - #/components/schemas/GetPortfolioRestingOrderTotalValueResponse + $ref: '#/components/schemas/GetPortfolioRestingOrderTotalValueResponse' '401': $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/fills: get: operationId: GetFills summary: Get Fills - description: > - Endpoint for getting all fills for the member. A fill is when a trade - you have is matched. - - Fills that occurred before the historical cutoff are only available via - `GET /historical/fills`. See [Historical - Data](https://docs.kalshi.com/getting_started/historical_data) for - details. + description: | + Endpoint for getting all fills for the member. A fill is when a trade you have is matched. + Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://docs.kalshi.com/getting_started/historical_data) for details. tags: - portfolio security: @@ -2065,6 +1917,7 @@ paths: - $ref: '#/components/parameters/LimitQuery' - $ref: '#/components/parameters/CursorQuery' - $ref: '#/components/parameters/SubaccountQuery' + - $ref: '#/components/parameters/ExchangeIndexFilterQuery' responses: '200': description: Fills retrieved successfully @@ -2078,6 +1931,7 @@ paths: description: Unauthorized '500': description: Internal server error + /communications/id: get: operationId: GetCommunicationsID @@ -2100,6 +1954,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /communications/block-trade-proposals: get: operationId: GetBlockTradeProposals @@ -2116,9 +1971,7 @@ paths: - $ref: '#/components/parameters/MarketTickerQuery' - name: limit in: query - description: >- - Parameter to specify the number of results per page. Defaults to - 100. + description: Parameter to specify the number of results per page. Defaults to 100. schema: type: integer format: int32 @@ -2143,6 +1996,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + post: operationId: ProposeBlockTrade summary: Propose Block Trade @@ -2174,6 +2028,7 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + /communications/block-trade-proposals/{block_trade_proposal_id}/accept: post: operationId: AcceptBlockTradeProposal @@ -2209,6 +2064,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /communications/rfqs: get: operationId: GetRFQs @@ -2227,9 +2083,7 @@ paths: - $ref: '#/components/parameters/SubaccountQuery' - name: limit in: query - description: >- - Parameter to specify the number of results per page. Defaults to - 100. + description: Parameter to specify the number of results per page. Defaults to 100. schema: type: integer format: int32 @@ -2254,7 +2108,7 @@ paths: $ref: '#/components/schemas/UserFilter' x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: - validate: omitempty,oneof=self + validate: "omitempty,oneof=self" responses: '200': description: RFQs retrieved successfully @@ -2266,6 +2120,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + post: operationId: CreateRFQ summary: Create RFQ @@ -2297,6 +2152,7 @@ paths: $ref: '#/components/responses/ConflictError' '500': $ref: '#/components/responses/InternalServerError' + /communications/rfqs/{rfq_id}: get: operationId: GetRFQ @@ -2323,6 +2179,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + delete: operationId: DeleteRFQ summary: Delete RFQ @@ -2344,19 +2201,16 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /communications/rfqs/{rfq_id}/quotes/{quote_id}: get: operationId: GetRFQQuote summary: Get RFQ Quote description: ' Endpoint for getting a particular quote scoped to its RFQ.' x-mint: - content: > + content: | - - **Rate limit:** 2 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - communications @@ -2380,18 +2234,15 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + delete: operationId: DeleteRFQQuote summary: Delete RFQ Quote description: ' Endpoint for deleting a quote scoped to its RFQ, which means it can no longer be accepted.' x-mint: - content: > + content: | - - **Rate limit:** 2 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - communications @@ -2411,6 +2262,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /communications/rfqs/{rfq_id}/quotes/{quote_id}/accept: put: operationId: AcceptRFQQuote @@ -2442,6 +2294,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /communications/rfqs/{rfq_id}/quotes/{quote_id}/confirm: put: operationId: ConfirmRFQQuote @@ -2471,6 +2324,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /communications/quotes: get: operationId: GetQuotes @@ -2486,25 +2340,19 @@ paths: - $ref: '#/components/parameters/CursorQuery' - name: min_ts in: query - description: >- - Restricts the response to quotes last updated after a timestamp, - formatted as a Unix Timestamp + description: Restricts the response to quotes last updated after a timestamp, formatted as a Unix Timestamp schema: type: integer format: int64 - name: max_ts in: query - description: >- - Restricts the response to quotes last updated before a timestamp, - formatted as a Unix Timestamp + description: Restricts the response to quotes last updated before a timestamp, formatted as a Unix Timestamp schema: type: integer format: int64 - name: limit in: query - description: >- - Parameter to specify the number of results per page. Defaults to - 500. + description: Parameter to specify the number of results per page. Defaults to 500. schema: type: integer format: int32 @@ -2532,18 +2380,16 @@ paths: $ref: '#/components/schemas/UserFilter' x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: - validate: omitempty,oneof=self + validate: "omitempty,oneof=self" - name: rfq_user_filter in: query required: false - description: >- - Filter for quotes responding to RFQs created by the authenticated - user. + description: Filter for quotes responding to RFQs created by the authenticated user. schema: $ref: '#/components/schemas/UserFilter' x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: - validate: omitempty,oneof=self + validate: "omitempty,oneof=self" - name: rfq_creator_user_id in: query description: Filter quotes by RFQ creator user ID @@ -2574,18 +2420,15 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + post: operationId: CreateQuote summary: Create Quote description: ' Endpoint for creating a quote in response to an RFQ' x-mint: - content: > + content: | - - **Rate limit:** 2 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - communications @@ -2612,30 +2455,21 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /communications/quotes/{quote_id}: get: operationId: GetQuote summary: Get Quote deprecated: true - description: >- - DEPRECATED: Use GET /communications/rfqs/{rfq_id}/quotes/{quote_id} - instead. Endpoint for getting a particular quote. + description: 'DEPRECATED: Use GET /communications/rfqs/{rfq_id}/quotes/{quote_id} instead. Endpoint for getting a particular quote.' x-mint: - content: > + content: | - - This endpoint is deprecated. Use `GET - /communications/rfqs/{rfq_id}/quotes/{quote_id}` instead. - + This endpoint is deprecated. Use `GET /communications/rfqs/{rfq_id}/quotes/{quote_id}` instead. - - - **Rate limit:** 2 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - communications @@ -2658,30 +2492,20 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + delete: operationId: DeleteQuote summary: Delete Quote deprecated: true - description: >- - DEPRECATED: Use DELETE /communications/rfqs/{rfq_id}/quotes/{quote_id} - instead. Endpoint for deleting a quote, which means it can no longer be - accepted. + description: 'DEPRECATED: Use DELETE /communications/rfqs/{rfq_id}/quotes/{quote_id} instead. Endpoint for deleting a quote, which means it can no longer be accepted.' x-mint: - content: > + content: | - - This endpoint is deprecated. Use `DELETE - /communications/rfqs/{rfq_id}/quotes/{quote_id}` instead. - + This endpoint is deprecated. Use `DELETE /communications/rfqs/{rfq_id}/quotes/{quote_id}` instead. - - - **Rate limit:** 2 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 2 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - communications @@ -2700,22 +2524,17 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /communications/quotes/{quote_id}/accept: put: operationId: AcceptQuote summary: Accept Quote deprecated: true - description: >- - DEPRECATED: Use PUT - /communications/rfqs/{rfq_id}/quotes/{quote_id}/accept instead. Endpoint - for accepting a quote. This will require the quoter to confirm. + description: 'DEPRECATED: Use PUT /communications/rfqs/{rfq_id}/quotes/{quote_id}/accept instead. Endpoint for accepting a quote. This will require the quoter to confirm.' x-mint: - content: > + content: | - - This endpoint is deprecated. Use `PUT - /communications/rfqs/{rfq_id}/quotes/{quote_id}/accept` instead. - + This endpoint is deprecated. Use `PUT /communications/rfqs/{rfq_id}/quotes/{quote_id}/accept` instead. tags: - communications @@ -2742,23 +2561,17 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /communications/quotes/{quote_id}/confirm: put: operationId: ConfirmQuote summary: Confirm Quote deprecated: true - description: >- - DEPRECATED: Use PUT - /communications/rfqs/{rfq_id}/quotes/{quote_id}/confirm instead. - Endpoint for confirming a quote. This will start a timer for order - execution. + description: 'DEPRECATED: Use PUT /communications/rfqs/{rfq_id}/quotes/{quote_id}/confirm instead. Endpoint for confirming a quote. This will start a timer for order execution.' x-mint: - content: > + content: | - - This endpoint is deprecated. Use `PUT - /communications/rfqs/{rfq_id}/quotes/{quote_id}/confirm` instead. - + This endpoint is deprecated. Use `PUT /communications/rfqs/{rfq_id}/quotes/{quote_id}/confirm` instead. tags: - communications @@ -2783,6 +2596,8 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + + # Multivariate Event Collections endpoints /api_keys: get: operationId: GetApiKeys @@ -2805,6 +2620,7 @@ paths: description: Unauthorized '500': description: Internal server error + post: operationId: CreateApiKey summary: Create API Key @@ -2836,6 +2652,7 @@ paths: description: Forbidden - insufficient API usage level '500': description: Internal server error + /api_keys/generate: post: operationId: GenerateApiKey @@ -2866,6 +2683,7 @@ paths: description: Unauthorized '500': description: Internal server error + /api_keys/{api_key}: delete: operationId: DeleteApiKey @@ -2895,14 +2713,12 @@ paths: description: API key not found '500': description: Internal server error + /account/limits: get: operationId: GetAccountApiLimits - summary: Get Account API Limits - description: >- - Endpoint to retrieve the authenticated user's Predictions API usage tier - and token-bucket limits. Public Predictions tiers include Basic, - Advanced, Expert, Premier, Paragon, Prime, and Prestige. + summary: Get Account API Limits + description: 'Endpoint to retrieve the authenticated user''s Predictions API usage tier and token-bucket limits. Public Predictions tiers include Basic, Advanced, Expert, Premier, Paragon, Prime, and Prestige.' tags: - account security: @@ -2920,23 +2736,16 @@ paths: description: Unauthorized '500': description: Internal server error + /account/api_usage_level/upgrade: post: operationId: UpgradeAccountApiUsageLevel summary: Upgrade Account API Usage Level - description: >- - Grants a permanent Advanced API usage-level grant. Currently only the - Predictions exchange instance is supported. Criteria: at least 1 of the - user's last 100 Predictions orders was created via API. Use Get Account - API Limits to inspect the resulting usage tier and grants. + description: 'Grants a permanent Advanced API usage-level grant. Currently only the Predictions exchange instance is supported. Criteria: at least 1 of the user''s last 100 Predictions orders was created via API. Use Get Account API Limits to inspect the resulting usage tier and grants.' x-mint: - content: > + content: | - - **Rate limit:** 30 tokens per request. See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 30 tokens per request. See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - account @@ -2950,24 +2759,17 @@ paths: '401': description: Unauthorized '403': - description: >- - No API-created order was found in the user's latest 100 Predictions - orders + description: No API-created order was found in the user's latest 100 Predictions orders '429': - description: >- - Rate limit exceeded. This endpoint costs 30 tokens and uses the - Predictions Write bucket. + description: Rate limit exceeded. This endpoint costs 30 tokens and uses the Predictions Write bucket. '500': description: Internal server error + /account/api_usage_level/volume_progress: get: operationId: GetAccountApiUsageLevelVolumeProgress summary: Get Account API Usage Level Volume Progress - description: >- - Returns the authenticated user's latest cron-computed trading volume - progress toward volume-based API usage tiers for the predictions - (event_contract) lane. Volume figures are reported as fixed-point - contract counts. + description: 'Returns the authenticated user''s latest cron-computed trading volume progress toward volume-based API usage tiers for the predictions (event_contract) lane. Volume figures are reported as fixed-point contract counts.' tags: - account security: @@ -2980,19 +2782,17 @@ paths: content: application/json: schema: - $ref: >- - #/components/schemas/GetAccountApiUsageLevelVolumeProgressResponse + $ref: '#/components/schemas/GetAccountApiUsageLevelVolumeProgressResponse' '401': description: Unauthorized '500': description: Internal server error + /account/endpoint_costs: get: operationId: GetAccountEndpointCosts summary: List Non-Default Endpoint Costs - description: >- - Lists API v2 endpoints whose configured token cost differs from the - default cost. Endpoints that use the default cost are omitted. + description: 'Lists API v2 endpoints whose configured token cost differs from the default cost. Endpoints that use the default cost are omitted.' tags: - account responses: @@ -3004,16 +2804,15 @@ paths: $ref: '#/components/schemas/GetAccountEndpointCostsResponse' '500': description: Internal server error + /search/tags_by_categories: get: operationId: GetTagsForSeriesCategories summary: Get Tags for Series Categories - description: > + description: | Retrieve tags organized by series categories. - - This endpoint returns a mapping of series categories to their associated - tags, which can be used for filtering and search functionality. + This endpoint returns a mapping of series categories to their associated tags, which can be used for filtering and search functionality. tags: - search responses: @@ -3027,17 +2826,15 @@ paths: description: Unauthorized '500': description: Internal server error + /search/filters_by_sport: get: operationId: GetFiltersForSports summary: Get Filters for Sports - description: > + description: | Retrieve available filters organized by sport. - - This endpoint returns filtering options available for each sport, - including scopes and competitions. It also provides an ordered list of - sports for display purposes. + This endpoint returns filtering options available for each sport, including scopes and competitions. It also provides an ordered list of sports for display purposes. tags: - search responses: @@ -3051,6 +2848,7 @@ paths: description: Unauthorized '500': description: Internal server error + /live_data/milestone/{milestone_id}: get: operationId: GetLiveDataByMilestone @@ -3069,11 +2867,9 @@ paths: in: query required: false description: >- - When true, includes player-level statistics in the live data - response. Supported for Pro Football, Pro Basketball, and College - Men's Basketball milestones that have player ID mappings configured. - Has no effect for other sports or milestones without player - mappings. + When true, includes player-level statistics in the live data response. + Supported for Pro Football, Pro Basketball, and College Men's Basketball milestones that have player ID mappings configured. + Has no effect for other sports or milestones without player mappings. schema: type: boolean default: false @@ -3088,14 +2884,12 @@ paths: description: Live data not found '500': description: Internal server error + /live_data/{type}/milestone/{milestone_id}: get: operationId: GetLiveData summary: Get Live Data (with type) - description: >- - Get live data for a specific milestone. This is the legacy endpoint that - requires a type path parameter. Prefer using - `/live_data/milestone/{milestone_id}` instead. + description: Get live data for a specific milestone. This is the legacy endpoint that requires a type path parameter. Prefer using `/live_data/milestone/{milestone_id}` instead. tags: - live-data parameters: @@ -3115,11 +2909,9 @@ paths: in: query required: false description: >- - When true, includes player-level statistics in the live data - response. Supported for Pro Football, Pro Basketball, and College - Men's Basketball milestones that have player ID mappings configured. - Has no effect for other sports or milestones without player - mappings. + When true, includes player-level statistics in the live data response. + Supported for Pro Football, Pro Basketball, and College Men's Basketball milestones that have player ID mappings configured. + Has no effect for other sports or milestones without player mappings. schema: type: boolean default: false @@ -3134,6 +2926,7 @@ paths: description: Live data not found '500': description: Internal server error + /live_data/batch: get: operationId: GetLiveDatas @@ -3157,11 +2950,9 @@ paths: in: query required: false description: >- - When true, includes player-level statistics in the live data - response. Supported for Pro Football, Pro Basketball, and College - Men's Basketball milestones that have player ID mappings configured. - Has no effect for other sports or milestones without player - mappings. + When true, includes player-level statistics in the live data response. + Supported for Pro Football, Pro Basketball, and College Men's Basketball milestones that have player ID mappings configured. + Has no effect for other sports or milestones without player mappings. schema: type: boolean default: false @@ -3174,16 +2965,15 @@ paths: $ref: '#/components/schemas/GetLiveDatasResponse' '500': description: Internal server error + /live_data/milestone/{milestone_id}/game_stats: get: operationId: GetGameStats summary: Get Game Stats description: >- - Get play-by-play game statistics for a specific milestone. Supported - sports: Pro Football, College Football, Pro Basketball, College Men's - Basketball, College Women's Basketball, WNBA, Soccer, Pro Hockey, and - Pro Baseball. Returns null for unsupported milestone types or milestones - without a Sportradar ID. + Get play-by-play game statistics for a specific milestone. + Supported sports: Pro Football, College Football, Pro Basketball, College Men's Basketball, College Women's Basketball, WNBA, Soccer, Pro Hockey, and Pro Baseball. + Returns null for unsupported milestone types or milestones without a Sportradar ID. tags: - live-data parameters: @@ -3204,6 +2994,7 @@ paths: description: Game stats not found '500': description: Internal server error + /live_data/events/{event_ticker}: get: operationId: GetEventLiveData @@ -3242,6 +3033,8 @@ paths: description: Live data not found '500': description: Internal server error + + /structured_targets: get: operationId: GetStructuredTargets @@ -3252,9 +3045,7 @@ paths: parameters: - name: ids in: query - description: >- - Filter by specific structured target IDs. Pass multiple IDs by - repeating the parameter (e.g. `?ids=uuid1&ids=uuid2`). + description: Filter by specific structured target IDs. Pass multiple IDs by repeating the parameter (e.g. `?ids=uuid1&ids=uuid2`). required: false schema: type: array @@ -3272,9 +3063,7 @@ paths: example: basketball_player - name: competition in: query - description: >- - Filter by competition. Matches against the league, conference, - division, or tour in the structured target details. + description: 'Filter by competition. Matches against the league, conference, division, or tour in the structured target details.' required: false schema: type: string @@ -3306,6 +3095,7 @@ paths: description: Unauthorized '500': description: Internal server error + /structured_targets/{structured_target_id}: get: operationId: GetStructuredTarget @@ -3333,6 +3123,7 @@ paths: description: Not found '500': description: Internal server error + /milestones/{milestone_id}: get: operationId: GetMilestone @@ -3362,6 +3153,7 @@ paths: description: Not Found '500': description: Internal Server Error + /milestones: get: operationId: GetMilestones @@ -3387,18 +3179,14 @@ paths: format: date-time - name: category in: query - description: >- - Filter by milestone category. E.g. Sports, Elections, Esports, - Crypto. + description: 'Filter by milestone category. E.g. Sports, Elections, Esports, Crypto.' required: false schema: type: string example: Sports - name: competition in: query - description: >- - Filter by competition. E.g. Pro Football, Pro Basketball (M), Pro - Baseball, Pro Hockey, College Football. + description: 'Filter by competition. E.g. Pro Football, Pro Basketball (M), Pro Baseball, Pro Hockey, College Football.' required: false schema: type: string @@ -3411,10 +3199,7 @@ paths: type: string - name: type in: query - description: >- - Filter by milestone type. E.g. football_game, basketball_game, - soccer_tournament_multi_leg, baseball_game, hockey_match, - political_race. + description: 'Filter by milestone type. E.g. football_game, basketball_game, soccer_tournament_multi_leg, baseball_game, hockey_match, political_race.' required: false schema: type: string @@ -3427,18 +3212,14 @@ paths: type: string - name: cursor in: query - description: >- - Pagination cursor. Use the cursor value returned from the previous - response to get the next page of results + description: Pagination cursor. Use the cursor value returned from the previous response to get the next page of results required: false schema: type: string - name: min_updated_ts in: query required: false - description: >- - Filter milestones with metadata updated after this Unix timestamp - (in seconds). Use this to efficiently poll for changes. + description: Filter milestones with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes. schema: type: integer format: int64 @@ -3455,6 +3236,8 @@ paths: description: Unauthorized '500': description: Internal Server Error + + # Communications endpoints /multivariate_event_collections/{collection_ticker}: get: operationId: GetMultivariateEventCollection @@ -3485,10 +3268,7 @@ paths: post: operationId: CreateMarketInMultivariateEventCollection summary: Create Market In Multivariate Event Collection - description: >- - Endpoint for creating an individual market in a multivariate event - collection. This endpoint must be hit at least once before trading or - looking up a market. Users are limited to 5000 creations per week. + description: 'Endpoint for creating an individual market in a multivariate event collection. This endpoint must be hit at least once before trading or looking up a market. Users are limited to 5000 creations per week.' tags: - multivariate security: @@ -3507,16 +3287,14 @@ paths: content: application/json: schema: - $ref: >- - #/components/schemas/CreateMarketInMultivariateEventCollectionRequest + $ref: '#/components/schemas/CreateMarketInMultivariateEventCollectionRequest' responses: '200': description: Market created successfully content: application/json: schema: - $ref: >- - #/components/schemas/CreateMarketInMultivariateEventCollectionResponse + $ref: '#/components/schemas/CreateMarketInMultivariateEventCollectionResponse' '400': $ref: '#/components/responses/BadRequestError' '401': @@ -3525,6 +3303,7 @@ paths: $ref: '#/components/responses/RateLimitError' '500': $ref: '#/components/responses/InternalServerError' + /multivariate_event_collections: get: operationId: GetMultivariateEventCollections @@ -3535,15 +3314,10 @@ paths: parameters: - name: status in: query - description: >- - Only return collections of a certain status. Can be unopened, open, - or closed. + description: Only return collections of a certain status. Can be unopened, open, or closed. schema: type: string - enum: - - unopened - - open - - closed + enum: [unopened, open, closed] - name: associated_event_ticker in: query description: Only return collections associated with a particular event ticker. @@ -3564,11 +3338,7 @@ paths: maximum: 200 - name: cursor in: query - description: >- - The Cursor represents a pointer to the next page of records in the - pagination. This optional parameter, when filled, should be filled - with the cursor string returned in a previous request to this - end-point. + description: The Cursor represents a pointer to the next page of records in the pagination. This optional parameter, when filled, should be filled with the cursor string returned in a previous request to this end-point. schema: type: string responses: @@ -3582,6 +3352,7 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /incentive_programs: get: operationId: GetIncentivePrograms @@ -3593,29 +3364,17 @@ paths: - name: status in: query required: false - description: >- - Status filter. Can be "all", "active", "upcoming", "closed", or - "paid_out". Default is "all". + description: 'Status filter. Can be "all", "active", "upcoming", "closed", or "paid_out". Default is "all".' schema: type: string - enum: - - all - - active - - upcoming - - closed - - paid_out + enum: [all, active, upcoming, closed, paid_out] - name: type in: query required: false - description: >- - Type filter. Can be "all", "liquidity", or "volume". Default is - "all". + description: 'Type filter. Can be "all", "liquidity", or "volume". Default is "all".' schema: type: string - enum: - - all - - liquidity - - volume + enum: [all, liquidity, volume] - name: incentive_description in: query required: false @@ -3655,15 +3414,14 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + /fcm/orders: get: operationId: GetFCMOrders summary: Get FCM Orders - description: > + description: | Endpoint for FCM members to get orders filtered by subtrader ID. - - This endpoint requires FCM member access level and allows filtering - orders by subtrader ID. + This endpoint requires FCM member access level and allows filtering orders by subtrader ID. tags: - fcm security: @@ -3674,9 +3432,7 @@ paths: - name: subtrader_id in: query required: true - description: >- - Restricts the response to orders for a specific subtrader (FCM - members only) + description: Restricts the response to orders for a specific subtrader (FCM members only) schema: type: string - $ref: '#/components/parameters/CursorQuery' @@ -3684,17 +3440,13 @@ paths: - $ref: '#/components/parameters/TickerQuery' - name: min_ts in: query - description: >- - Restricts the response to orders after a timestamp, formatted as a - Unix Timestamp + description: Restricts the response to orders after a timestamp, formatted as a Unix Timestamp schema: type: integer format: int64 - name: max_ts in: query - description: >- - Restricts the response to orders before a timestamp, formatted as a - Unix Timestamp + description: Restricts the response to orders before a timestamp, formatted as a Unix Timestamp schema: type: integer format: int64 @@ -3703,10 +3455,7 @@ paths: description: Restricts the response to orders that have a certain status schema: type: string - enum: - - resting - - canceled - - executed + enum: [resting, canceled, executed] - name: limit in: query description: Parameter to specify the number of results per page. Defaults to 100 @@ -3729,16 +3478,14 @@ paths: description: Not found '500': description: Internal server error + /fcm/positions: get: operationId: GetFCMPositions summary: Get FCM Positions - description: > - Endpoint for FCM members to get market positions filtered by subtrader - ID. - - This endpoint requires FCM member access level and allows filtering - positions by subtrader ID. + description: | + Endpoint for FCM members to get market positions filtered by subtrader ID. + This endpoint requires FCM member access level and allows filtering positions by subtrader ID. tags: - fcm security: @@ -3749,9 +3496,7 @@ paths: - name: subtrader_id in: query required: true - description: >- - Restricts the response to positions for a specific subtrader (FCM - members only) + description: Restricts the response to positions for a specific subtrader (FCM members only) schema: type: string - name: ticker @@ -3768,9 +3513,7 @@ paths: x-go-type-skip-optional-pointer: true - name: count_filter in: query - description: >- - Restricts the positions to those with any of following fields with - non-zero values, as a comma separated list + description: Restricts the positions to those with any of following fields with non-zero values, as a comma separated list schema: type: string - name: settlement_status @@ -3778,10 +3521,7 @@ paths: description: Settlement status of the markets to return. Defaults to unsettled schema: type: string - enum: - - all - - unsettled - - settled + enum: [all, unsettled, settled] - name: limit in: query description: Parameter to specify the number of results per page. Defaults to 100 @@ -3791,9 +3531,7 @@ paths: maximum: 1000 - name: cursor in: query - description: >- - The Cursor represents a pointer to the next page of records in the - pagination + description: The Cursor represents a pointer to the next page of records in the pagination schema: type: string responses: @@ -3811,32 +3549,19 @@ paths: description: Not found '500': description: Internal server error + /historical/cutoff: get: operationId: GetHistoricalCutoff summary: Get Historical Cutoff Timestamps - description: > - Returns the cutoff timestamps that define the boundary between **live** - and **historical** data. - + description: | + Returns the cutoff timestamps that define the boundary between **live** and **historical** data. ## Cutoff fields - - - `market_settled_ts` : Markets that **settled** before this timestamp, - and their candlesticks, must be accessed via `GET /historical/markets` - and `GET /historical/markets/{ticker}/candlesticks`. - - - `trades_created_ts` : Trades that were **filled** before this - timestamp must be accessed via `GET /historical/fills`. - - - `orders_updated_ts` : Orders that were **canceled or fully executed** - before this timestamp must be accessed via `GET /historical/orders`. - Resting (active) orders are always available in `GET /portfolio/orders`. - - - `market_positions_last_updated_ts` : Settled positions **archived from - the live data set** before this timestamp must be accessed via `GET - /historical/positions`. Unsettled positions are always available in `GET - /portfolio/positions`. + - `market_settled_ts` : Markets that **settled** before this timestamp, and their candlesticks, must be accessed via `GET /historical/markets` and `GET /historical/markets/{ticker}/candlesticks`. + - `trades_created_ts` : Trades that were **filled** before this timestamp must be accessed via `GET /historical/fills`. + - `orders_updated_ts` : Orders that were **canceled or fully executed** before this timestamp must be accessed via `GET /historical/orders`. Resting (active) orders are always available in `GET /portfolio/orders`. + - `market_positions_last_updated_ts` : Settled positions **archived from the live data set** before this timestamp must be accessed via `GET /historical/positions`. Unsettled positions are always available in `GET /portfolio/positions`. tags: - historical responses: @@ -3848,6 +3573,7 @@ paths: $ref: '#/components/schemas/GetHistoricalCutoffResponse' '500': description: Internal server error + /historical/markets/{ticker}/candlesticks: get: operationId: GetMarketCandlesticksHistorical @@ -3865,35 +3591,26 @@ paths: - name: start_ts in: query required: true - description: >- - Start timestamp (Unix timestamp). Candlesticks will include those - ending on or after this time. + description: Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time. schema: type: integer format: int64 - name: end_ts in: query required: true - description: >- - End timestamp (Unix timestamp). Candlesticks will include those - ending on or before this time. + description: End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time. schema: type: integer format: int64 - name: period_interval in: query required: true - description: >- - Time period length of each candlestick in minutes. Valid values are - 1 (1 minute), 60 (1 hour), or 1440 (1 day). + description: Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day). schema: type: integer - enum: - - 1 - - 60 - - 1440 + enum: [1, 60, 1440] x-oapi-codegen-extra-tags: - validate: required,oneof=1 60 1440 + validate: "required,oneof=1 60 1440" responses: '200': description: Candlesticks retrieved successfully @@ -3907,6 +3624,7 @@ paths: description: Not found '500': description: Internal server error + /historical/fills: get: operationId: GetFillsHistorical @@ -3938,11 +3656,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': description: Internal server error + /historical/orders: get: operationId: GetHistoricalOrders summary: Get Historical Orders - description: ' Endpoint for getting orders that have been archived to the historical database.' + description: ' Endpoint for getting orders that have been archived to the historical database.' tags: - historical security: @@ -3967,6 +3686,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /historical/positions: get: operationId: GetHistoricalPositions @@ -3996,6 +3716,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /historical/trades: get: operationId: GetTradesHistorical @@ -4023,13 +3744,13 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /historical/markets: get: operationId: GetHistoricalMarkets summary: Get Historical Markets - description: > - Endpoint for getting markets that have been archived to the historical - database. Filters are mutually exclusive. + description: | + Endpoint for getting markets that have been archived to the historical database. Filters are mutually exclusive. tags: - historical parameters: @@ -4050,6 +3771,7 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /historical/markets/{ticker}: get: operationId: GetHistoricalMarket @@ -4070,6 +3792,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + components: securitySchemes: kalshiAccessKey: @@ -4087,6 +3810,7 @@ components: in: header name: KALSHI-ACCESS-TIMESTAMP description: Request timestamp in milliseconds + responses: BadRequestError: description: Bad request - invalid input @@ -4125,13 +3849,12 @@ components: schema: $ref: '#/components/schemas/ErrorResponse' RateLimitError: - description: >- - Rate limit exceeded. The default cost is 10 tokens per request. Use GET - /trade-api/v2/account/endpoint_costs to list non-default endpoint costs. + description: 'Rate limit exceeded. The default cost is 10 tokens per request. Use GET /trade-api/v2/account/endpoint_costs to list non-default endpoint costs.' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + parameters: LimitQuery: name: limit @@ -4144,7 +3867,8 @@ components: maximum: 1000 default: 100 x-oapi-codegen-extra-tags: - validate: omitempty,min=1,max=1000 + validate: "omitempty,min=1,max=1000" + WithdrawalLimitQuery: name: limit in: query @@ -4156,7 +3880,8 @@ components: maximum: 500 default: 100 x-oapi-codegen-extra-tags: - validate: omitempty,min=1,max=500 + validate: "omitempty,min=1,max=500" + TransfersLimitQuery: name: limit in: query @@ -4169,7 +3894,8 @@ components: default: 100 x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: - validate: omitempty,min=1,max=500 + validate: "omitempty,min=1,max=500" + MarketLimitQuery: name: limit in: query @@ -4182,22 +3908,22 @@ components: default: 100 x-oapi-codegen-extra-tags: validate: omitempty,gte=0,lte=1000 + CursorQuery: name: cursor in: query - description: >- - Pagination cursor. Use the cursor value returned from the previous - response to get the next page of results. Leave empty for the first - page. + description: Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. schema: type: string x-go-type-skip-optional-pointer: true + StatusQuery: name: status in: query description: Filter by status. Possible values depend on the endpoint. schema: type: string + OrderGroupIdPath: name: order_group_id in: path @@ -4205,6 +3931,7 @@ components: description: Order group ID schema: type: string + RfqIdPath: name: rfq_id in: path @@ -4212,6 +3939,7 @@ components: description: RFQ ID schema: type: string + QuoteIdPath: name: quote_id in: path @@ -4219,6 +3947,7 @@ components: description: Quote ID schema: type: string + MarketTickerQuery: name: market_ticker in: query @@ -4226,6 +3955,7 @@ components: schema: type: string x-go-type-skip-optional-pointer: true + TickerQuery: name: ticker in: query @@ -4233,15 +3963,15 @@ components: schema: type: string x-go-type-skip-optional-pointer: true + IsBlockTradeQuery: name: is_block_trade in: query - description: > - Filter trades by whether they are block trades. Omit to return all - trades. Set to `true` to return only block trades. Set to `false` to - return only non-block trades. + description: | + Filter trades by whether they are block trades. Omit to return all trades. Set to `true` to return only block trades. Set to `false` to return only non-block trades. schema: type: boolean + SingleEventTickerQuery: name: event_ticker in: query @@ -4249,6 +3979,7 @@ components: schema: type: string x-go-type-skip-optional-pointer: true + MultipleEventTickerQuery: name: event_ticker in: query @@ -4256,15 +3987,14 @@ components: schema: type: string x-go-type-skip-optional-pointer: true + PositionsCursorQuery: name: cursor in: query - description: >- - The Cursor represents a pointer to the next page of records in the - pagination. Use the value returned from the previous response to get the - next page. + description: The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page. schema: type: string + PositionsLimitQuery: name: limit in: query @@ -4275,15 +4005,14 @@ components: minimum: 1 maximum: 1000 default: 100 + CountFilterQuery: name: count_filter in: query - description: >- - Restricts the positions to those with any of following fields with - non-zero values, as a comma separated list. The following values are - accepted - position, total_traded + description: Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted - position, total_traded schema: type: string + OrderIdQuery: name: order_id in: query @@ -4291,6 +4020,7 @@ components: schema: type: string x-go-type-skip-optional-pointer: true + MinTsQuery: name: min_ts in: query @@ -4298,6 +4028,7 @@ components: schema: type: integer format: int64 + MaxTsQuery: name: max_ts in: query @@ -4305,26 +4036,39 @@ components: schema: type: integer format: int64 + SubaccountQuery: name: subaccount in: query - description: >- - Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, - defaults to all subaccounts. + description: Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. schema: type: integer + SubaccountQueryDefaultPrimary: name: subaccount in: query description: Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. schema: type: integer + ExchangeIndexQuery: name: exchange_index in: query schema: $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true + + ExchangeIndexFilterQuery: + name: exchange_index + in: query + description: Filter results by exchange shard. Omit to return results from all exchange shards. + schema: + type: integer + format: int32 + minimum: 0 + x-oapi-codegen-extra-tags: + validate: "omitempty,gte=0" + OrderIdPath: name: order_id in: path @@ -4332,6 +4076,7 @@ components: description: Order ID schema: type: string + TickerPath: name: ticker in: path @@ -4339,6 +4084,7 @@ components: description: Market ticker schema: type: string + SeriesTickerQuery: name: series_ticker in: query @@ -4346,6 +4092,7 @@ components: schema: type: string x-go-type-skip-optional-pointer: true + MinCreatedTsQuery: name: min_created_ts in: query @@ -4353,6 +4100,7 @@ components: schema: type: integer format: int64 + MaxCreatedTsQuery: name: max_created_ts in: query @@ -4360,17 +4108,15 @@ components: schema: type: integer format: int64 + MinUpdatedTsQuery: name: min_updated_ts in: query - description: >- - Return markets with metadata updated later than this Unix timestamp. - Tracks non-trading changes only. Incompatible with any other filters - except mve_filter=exclude. May be combined with series_ticker, which - requires mve_filter=exclude. + description: Return markets with metadata updated later than this Unix timestamp. Tracks non-trading changes only. Incompatible with any other filters except mve_filter=exclude. May be combined with series_ticker, which requires mve_filter=exclude. schema: type: integer format: int64 + MaxCloseTsQuery: name: max_close_ts in: query @@ -4378,6 +4124,7 @@ components: schema: type: integer format: int64 + MinCloseTsQuery: name: min_close_ts in: query @@ -4385,6 +4132,7 @@ components: schema: type: integer format: int64 + MinSettledTsQuery: name: min_settled_ts in: query @@ -4392,6 +4140,7 @@ components: schema: type: integer format: int64 + MaxSettledTsQuery: name: max_settled_ts in: query @@ -4399,90 +4148,73 @@ components: schema: type: integer format: int64 + MarketStatusQuery: name: status in: query description: Filter by market status. Leave empty to return markets with any status. schema: type: string - enum: - - unopened - - open - - paused - - closed - - settled + enum: [unopened, open, paused, closed, settled] + TickersQuery: name: tickers in: query - description: >- - Filter by specific market tickers. Comma-separated list of market - tickers to retrieve. + description: Filter by specific market tickers. Comma-separated list of market tickers to retrieve. schema: type: string + EventTickersQuery: name: tickers in: query - description: >- - Filter by specific event tickers. Comma-separated list of event tickers - to retrieve. + description: Filter by specific event tickers. Comma-separated list of event tickers to retrieve. schema: type: string + MveFilterQuery: name: mve_filter in: query - description: >- - Filter by multivariate events (combos). 'only' returns only multivariate - events, 'exclude' excludes multivariate events. + description: Filter by multivariate events (combos). 'only' returns only multivariate events, 'exclude' excludes multivariate events. schema: type: string - enum: - - only - - exclude + enum: ['only', 'exclude'] + MveHistoricalFilterQuery: name: mve_filter in: query - description: >- - Filter by multivariate events (combos). By default, MVE markets are - included. + description: Filter by multivariate events (combos). By default, MVE markets are included. schema: type: string - enum: - - exclude + enum: ['exclude'] nullable: true default: null + schemas: + # Common schemas FixedPointDollars: type: string - description: >- - US dollar amount as a fixed-point decimal string with up to 6 decimal - places of precision. This is the maximum supported precision; valid - quote intervals for a given market are constrained by that market's - price level structure. - example: '0.5600' + description: Fixed-point US dollar string. Most request fields accept 2-4 decimal places (e.g., "0.56", "0.5600"); responses emit up to 6. Valid quote intervals for a given market are constrained by that market's price level structure. + example: "0.5600" + FixedPointCount: type: string - description: >- - Fixed-point contract count string (2 decimals, e.g., "10.00"; referred - to as "fp" in field names). Requests accept 0-2 decimal places (e.g., - "10", "10.0", "10.00"); responses always emit 2 decimals. Fractional - contract values (e.g., "2.50") are supported; the minimum granularity is - 0.01 contracts. - example: '10.00' + description: Fixed-point contract count string (2 decimals, e.g., "10.00"; referred to as "fp" in field names). Requests accept 0-2 decimal places (e.g., "10", "10.0", "10.00"); responses always emit 2 decimals. Fractional contract values (e.g., "2.50") are supported; the minimum granularity is 0.01 contracts. + example: "10.00" + ExchangeIndex: type: integer - description: Identifier for an exchange shard. Defaults to 0 if unspecified. + description: "Identifier for an exchange shard. Defaults to 0 if unspecified." example: 0 + FeeType: type: string - enum: - - quadratic - - quadratic_with_maker_fees - - flat + enum: [quadratic, quadratic_with_maker_fees, flat] x-enum-varnames: - FeeTypeQuadratic - FeeTypeQuadraticWithMakerFees - FeeTypeFlat description: Fee type for a series or scheduled fee override. + GetMarketCandlesticksHistoricalResponse: type: object required: @@ -4497,6 +4229,7 @@ components: description: Array of candlestick data points for the specified time range. items: $ref: '#/components/schemas/MarketCandlestickHistorical' + MarketCandlestickHistorical: type: object required: @@ -4513,29 +4246,20 @@ components: description: Unix timestamp for the inclusive end of the candlestick period. yes_bid: $ref: '#/components/schemas/BidAskDistributionHistorical' - description: >- - Open, high, low, close (OHLC) data for YES buy offers on the market - during the candlestick period. + description: Open, high, low, close (OHLC) data for YES buy offers on the market during the candlestick period. yes_ask: $ref: '#/components/schemas/BidAskDistributionHistorical' - description: >- - Open, high, low, close (OHLC) data for YES sell offers on the market - during the candlestick period. + description: Open, high, low, close (OHLC) data for YES sell offers on the market during the candlestick period. price: $ref: '#/components/schemas/PriceDistributionHistorical' - description: >- - Open, high, low, close (OHLC) and more data for trade YES contract - prices on the market during the candlestick period. + description: Open, high, low, close (OHLC) and more data for trade YES contract prices on the market during the candlestick period. volume: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought on the - market during the candlestick period. + description: String representation of the number of contracts bought on the market during the candlestick period. open_interest: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought on the - market by end of the candlestick period (end_period_ts). + description: String representation of the number of contracts bought on the market by end of the candlestick period (end_period_ts). + BidAskDistributionHistorical: type: object required: @@ -4546,24 +4270,17 @@ components: properties: open: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Offer price on the market at the start of the candlestick period (in - dollars). + description: Offer price on the market at the start of the candlestick period (in dollars). low: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Lowest offer price on the market during the candlestick period (in - dollars). + description: Lowest offer price on the market during the candlestick period (in dollars). high: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Highest offer price on the market during the candlestick period (in - dollars). + description: Highest offer price on the market during the candlestick period (in dollars). close: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Offer price on the market at the end of the candlestick period (in - dollars). + description: Offer price on the market at the end of the candlestick period (in dollars). + PriceDistributionHistorical: type: object required: @@ -4578,44 +4295,33 @@ components: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Price of the first trade during the candlestick period (in dollars). - Null if no trades occurred. + description: Price of the first trade during the candlestick period (in dollars). Null if no trades occurred. low: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Lowest trade price during the candlestick period (in dollars). Null - if no trades occurred. + description: Lowest trade price during the candlestick period (in dollars). Null if no trades occurred. high: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Highest trade price during the candlestick period (in dollars). Null - if no trades occurred. + description: Highest trade price during the candlestick period (in dollars). Null if no trades occurred. close: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Price of the last trade during the candlestick period (in dollars). - Null if no trades occurred. + description: Price of the last trade during the candlestick period (in dollars). Null if no trades occurred. mean: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Volume-weighted average price during the candlestick period (in - dollars). Null if no trades occurred. + description: Volume-weighted average price during the candlestick period (in dollars). Null if no trades occurred. previous: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Close price from the previous candlestick period (in dollars). Null - if this is the first candlestick or no prior trade exists. + description: Close price from the previous candlestick period (in dollars). Null if this is the first candlestick or no prior trade exists. + ErrorResponse: type: object properties: @@ -4628,74 +4334,40 @@ components: details: type: string description: Additional details about the error, if available + SelfTradePreventionType: type: string - enum: - - taker_at_cross - - maker - description: > - The self-trade prevention type for orders. `taker_at_cross` cancels the - taker order when it would trade against another order from the same - user; execution stops and any partial fills already matched are - executed. `maker` cancels the resting maker order and continues - matching. + enum: ['taker_at_cross', 'maker'] + description: | + The self-trade prevention type for orders. `taker_at_cross` cancels the taker order when it would trade against another order from the same user; execution stops and any partial fills already matched are executed. `maker` cancels the resting maker order and continues matching. + BookSide: type: string - enum: - - bid - - ask - description: >- - Side of the book for an order or trade. For event markets, this refers - to the YES leg only: `bid` means buy YES, `ask` means sell YES. (Selling - YES is economically equivalent to buying NO at `1 - price`, but this - endpoint quotes everything from the YES side.) + enum: ['bid', 'ask'] + description: 'Side of the book for an order or trade. For event markets, this refers to the YES leg only: `bid` means buy YES, `ask` means sell YES. (Selling YES is economically equivalent to buying NO at `1 - price`, but this endpoint quotes everything from the YES side.)' + OrderStatus: type: string - enum: - - resting - - canceled - - executed + enum: ['resting', 'canceled', 'executed'] description: The status of an order + ExchangeInstance: type: string - enum: - - event_contract - - margined + enum: ['event_contract', 'margined'] description: The exchange instance type + UserFilter: type: string - enum: - - self - x-enum-varnames: - - UserFilterSelf - description: >- - Omit or leave empty to return all results. Use `self` to filter by the - authenticated user. + enum: ['self'] + x-enum-varnames: ['UserFilterSelf'] + description: Omit or leave empty to return all results. Use `self` to filter by the authenticated user. + ApiKeyScope: type: string - enum: - - read - - write - - read::block_trade_accept - - read::portfolio_balance - - write::trade - - write::transfer - - write::block_trade_accept - x-enum-varnames: - - ApiKeyScopeRead - - ApiKeyScopeWrite - - ApiKeyScopeReadBlockTradeAccept - - ApiKeyScopeReadPortfolioBalance - - ApiKeyScopeWriteTrade - - ApiKeyScopeWriteTransfer - - ApiKeyScopeWriteBlockTradeAccept - description: >- - Scope granted to an API key. Parent scopes grant broad access; for - example, `read` grants all read endpoints and `write` grants all write - endpoints. Child scopes such as `read::block_trade_accept`, - `read::portfolio_balance`, `write::trade`, `write::transfer`, and - `write::block_trade_accept` grant only their specific endpoint group and - can be granted without the parent scope. + enum: ['read', 'write', 'read::block_trade_accept', 'read::portfolio_balance', 'write::trade', 'write::transfer', 'write::block_trade_accept'] + x-enum-varnames: ['ApiKeyScopeRead', 'ApiKeyScopeWrite', 'ApiKeyScopeReadBlockTradeAccept', 'ApiKeyScopeReadPortfolioBalance', 'ApiKeyScopeWriteTrade', 'ApiKeyScopeWriteTransfer', 'ApiKeyScopeWriteBlockTradeAccept'] + description: Scope granted to an API key. Parent scopes grant broad access; for example, `read` grants all read endpoints and `write` grants all write endpoints. Child scopes such as `read::block_trade_accept`, `read::portfolio_balance`, `write::trade`, `write::transfer`, and `write::block_trade_accept` grant only their specific endpoint group and can be granted without the parent scope. + ApiKey: type: object required: @@ -4719,10 +4391,8 @@ components: nullable: true minimum: 0 maximum: 63 - description: >- - If set, the API key is restricted to this single sub-account and may - only read and trade on it. Absent/null means the key is - unrestricted. + description: If set, the API key is restricted to this single sub-account and may only read and trade on it. Absent/null means the key is unrestricted. + GetApiKeysResponse: type: object required: @@ -4733,6 +4403,7 @@ components: description: List of all API keys associated with the user items: $ref: '#/components/schemas/ApiKey' + CreateApiKeyRequest: type: object required: @@ -4744,28 +4415,18 @@ components: description: Name for the API key. This helps identify the key's purpose public_key: type: string - description: >- - RSA public key in PEM format. This will be used to verify signatures - on API requests + description: RSA public key in PEM format. This will be used to verify signatures on API requests scopes: type: array - description: >- - List of scopes to grant to the API key. If the broad `write` parent - scope is included, `read` must also be included. Child scopes may be - granted without the broad parent scope. Defaults to full access - (`read`, `write`) if not provided. + description: List of scopes to grant to the API key. If the broad `write` parent scope is included, `read` must also be included. Child scopes may be granted without the broad parent scope. Defaults to full access (`read`, `write`) if not provided. items: $ref: '#/components/schemas/ApiKeyScope' subaccount: type: integer minimum: 0 maximum: 63 - description: >- - If set, restricts the API key to a single sub-account (0-63) that - you own. A restricted key may only read and trade on that - sub-account; it cannot act on other sub-accounts, transfer funds - between sub-accounts, or create sub-accounts. Omit to leave the key - unrestricted. + description: If set, restricts the API key to a single sub-account (0-63) that you own. A restricted key may only read and trade on that sub-account; it cannot act on other sub-accounts, transfer funds between sub-accounts, or create sub-accounts. Omit to leave the key unrestricted. + CreateApiKeyResponse: type: object required: @@ -4774,6 +4435,7 @@ components: api_key_id: type: string description: Unique identifier for the newly created API key + GenerateApiKeyRequest: type: object required: @@ -4784,23 +4446,15 @@ components: description: Name for the API key. This helps identify the key's purpose scopes: type: array - description: >- - List of scopes to grant to the API key. If the broad `write` parent - scope is included, `read` must also be included. Child scopes may be - granted without the broad parent scope. Defaults to full access - (`read`, `write`) if not provided. + description: List of scopes to grant to the API key. If the broad `write` parent scope is included, `read` must also be included. Child scopes may be granted without the broad parent scope. Defaults to full access (`read`, `write`) if not provided. items: $ref: '#/components/schemas/ApiKeyScope' subaccount: type: integer minimum: 0 maximum: 63 - description: >- - If set, restricts the API key to a single sub-account (0-63) that - you own. A restricted key may only read and trade on that - sub-account; it cannot act on other sub-accounts, transfer funds - between sub-accounts, or create sub-accounts. Omit to leave the key - unrestricted. + description: If set, restricts the API key to a single sub-account (0-63) that you own. A restricted key may only read and trade on that sub-account; it cannot act on other sub-accounts, transfer funds between sub-accounts, or create sub-accounts. Omit to leave the key unrestricted. + GenerateApiKeyResponse: type: object required: @@ -4812,9 +4466,8 @@ components: description: Unique identifier for the newly generated API key private_key: type: string - description: >- - RSA private key in PEM format. This must be stored securely and - cannot be retrieved again after this response + description: RSA private key in PEM format. This must be stored securely and cannot be retrieved again after this response + GetTagsForSeriesCategoriesResponse: type: object required: @@ -4827,6 +4480,7 @@ components: type: array items: type: string + ScopeList: type: object required: @@ -4837,6 +4491,7 @@ components: description: List of scopes items: type: string + SportFilterDetails: type: object required: @@ -4853,6 +4508,7 @@ components: description: Mapping of competitions to their scope lists additionalProperties: $ref: '#/components/schemas/ScopeList' + GetFiltersBySportsResponse: type: object required: @@ -4869,6 +4525,7 @@ components: description: Ordered list of sports for display items: type: string + BucketLimit: type: object description: | @@ -4892,6 +4549,7 @@ components: headroom that idle clients accumulate and can spend in a single pulse (e.g. write buckets at non-Basic tiers hold two seconds of budget). + GetAccountApiLimitsResponse: type: object required: @@ -4902,10 +4560,7 @@ components: properties: usage_tier: type: string - description: >- - User's effective Predictions API usage tier for these limits (for - example, basic, advanced, expert, premier, paragon, prime, or - prestige). + description: User's effective Predictions API usage tier for these limits (for example, basic, advanced, expert, premier, paragon, prime, or prestige). example: expert read: $ref: '#/components/schemas/BucketLimit' @@ -4913,12 +4568,10 @@ components: $ref: '#/components/schemas/BucketLimit' grants: type: array - description: >- - The caller's active API usage level grants across exchange lanes, - where each grant applies to its exchange_instance and usage_tier - reflects the effective tier for the lane reported by this endpoint. + description: The caller's active API usage level grants across exchange lanes, where each grant applies to its exchange_instance and usage_tier reflects the effective tier for the lane reported by this endpoint. items: $ref: '#/components/schemas/ApiUsageLevelGrant' + ApiUsageLevelGrant: type: object required: @@ -4930,22 +4583,17 @@ components: $ref: '#/components/schemas/ExchangeInstance' level: type: string - description: >- - API usage level this grant confers (for example, expert, premier, - paragon, prime, or prestige). + description: API usage level this grant confers (for example, expert, premier, paragon, prime, or prestige). example: prestige expires_ts: type: integer format: int64 nullable: true - description: >- - Unix timestamp (seconds) when the grant expires. Absent for - permanent grants. + description: Unix timestamp (seconds) when the grant expires. Absent for permanent grants. source: type: string - description: >- - How the grant was created: "volume" (earned from trading volume) or - "manual" (assigned by Kalshi). + description: 'How the grant was created: "volume" (earned from trading volume) or "manual" (assigned by Kalshi).' + GetAccountApiUsageLevelVolumeProgressResponse: type: object required: @@ -4953,12 +4601,10 @@ components: properties: volume_progress: type: array - description: >- - Latest cron-computed trading volume progress toward volume-based API - usage tiers for the predictions (event_contract) lane. Volume-based - public tiers are Expert, Premier, Paragon, Prime, and Prestige. + description: Latest cron-computed trading volume progress toward volume-based API usage tiers for the predictions (event_contract) lane. Volume-based public tiers are Expert, Premier, Paragon, Prime, and Prestige. items: $ref: '#/components/schemas/AccountApiUsageLevelVolumeProgress' + AccountApiUsageLevelVolumeProgress: type: object required: @@ -4969,16 +4615,14 @@ components: computed_ts: type: integer format: int64 - description: >- - Unix timestamp (seconds) when this progress was computed; - trailing_30d_volume_fp covers the trailing 30 days ending at this - time. + description: 'Unix timestamp (seconds) when this progress was computed; trailing_30d_volume_fp covers the trailing 30 days ending at this time.' trailing_30d_volume_fp: $ref: '#/components/schemas/FixedPointCount' goals: type: array items: $ref: '#/components/schemas/AccountApiUsageLevelVolumeGoal' + AccountApiUsageLevelVolumeGoal: type: object required: @@ -4994,6 +4638,7 @@ components: $ref: '#/components/schemas/FixedPointCount' keep_volume_goal_fp: $ref: '#/components/schemas/FixedPointCount' + EndpointTokenCost: type: object required: @@ -5009,9 +4654,8 @@ components: description: API route path for the endpoint. cost: type: integer - description: >- - Configured token cost for an endpoint whose cost differs from the - default cost. + description: Configured token cost for an endpoint whose cost differs from the default cost. + GetAccountEndpointCostsResponse: type: object required: @@ -5020,16 +4664,13 @@ components: properties: default_cost: type: integer - description: >- - Default token cost applied to endpoints that are not listed in - `endpoint_costs`. This is currently 10. + description: Default token cost applied to endpoints that are not listed in `endpoint_costs`. This is currently 10. endpoint_costs: type: array - description: >- - API v2 endpoints whose configured token cost differs from - `default_cost`. Endpoints that use the default cost are omitted. + description: API v2 endpoints whose configured token cost differs from `default_cost`. Endpoints that use the default cost are omitted. items: $ref: '#/components/schemas/EndpointTokenCost' + ExchangeStatus: type: object required: @@ -5038,36 +4679,24 @@ components: properties: exchange_active: type: boolean - description: >- - False if the core Kalshi exchange is no longer taking any state - changes at all. This includes but is not limited to trading, new - users, and transfers. True unless we are under maintenance. + description: False if the core Kalshi exchange is no longer taking any state changes at all. This includes but is not limited to trading, new users, and transfers. True unless we are under maintenance. trading_active: type: boolean - description: >- - True if we are currently permitting trading on the exchange. This is - true during trading hours and false outside exchange hours. Kalshi - reserves the right to pause at any time in case issues are detected. + description: True if we are currently permitting trading on the exchange. This is true during trading hours and false outside exchange hours. Kalshi reserves the right to pause at any time in case issues are detected. intra_exchange_transfers_active: type: boolean - description: >- - True if intra-exchange transfers are currently permitted. False when - transfers are temporarily blocked. + description: True if intra-exchange transfers are currently permitted. False when transfers are temporarily blocked. exchange_estimated_resume_time: type: string format: date-time - description: >- - Estimated downtime for the current exchange maintenance window. - However, this is not guaranteed and can be extended. + description: Estimated downtime for the current exchange maintenance window. However, this is not guaranteed and can be extended. nullable: true exchange_index_statuses: type: array - description: >- - Status of each exchange index. The top-level fields above reflect - the default exchange index (0). Absent when the per-index breakdown - is unavailable. + description: Status of each exchange index. The top-level fields above reflect the default exchange index (0). Absent when the per-index breakdown is unavailable. items: $ref: '#/components/schemas/ExchangeIndexStatus' + ExchangeIndexStatus: type: object required: @@ -5084,19 +4713,14 @@ components: description: Description of this exchange shard. exchange_active: type: boolean - description: >- - False if this exchange index is no longer taking any state changes - at all. True unless under maintenance. + description: False if this exchange index is no longer taking any state changes at all. True unless under maintenance. trading_active: type: boolean - description: >- - True if trading is currently permitted on this exchange index. False - outside exchange hours or during pauses. + description: True if trading is currently permitted on this exchange index. False outside exchange hours or during pauses. intra_exchange_transfers_active: type: boolean - description: >- - True if intra-exchange transfers are currently permitted on this - exchange index. False when transfers are temporarily blocked. + description: True if intra-exchange transfers are currently permitted on this exchange index. False when transfers are temporarily blocked. + GetExchangeScheduleResponse: type: object required: @@ -5104,6 +4728,7 @@ components: properties: schedule: $ref: '#/components/schemas/Schedule' + Schedule: type: object required: @@ -5112,18 +4737,15 @@ components: properties: standard_hours: type: array - description: >- - The standard operating hours of the exchange. All times are - expressed in ET. Outside of these times trading will be unavailable. + description: The standard operating hours of the exchange. All times are expressed in ET. Outside of these times trading will be unavailable. items: $ref: '#/components/schemas/WeeklySchedule' maintenance_windows: type: array - description: >- - Scheduled maintenance windows, during which the exchange may be - unavailable. + description: Scheduled maintenance windows, during which the exchange may be unavailable. items: $ref: '#/components/schemas/MaintenanceWindow' + WeeklySchedule: type: object required: @@ -5144,9 +4766,7 @@ components: end_time: type: string format: date-time - description: >- - End date and time for when this weekly schedule is no longer - effective. + description: End date and time for when this weekly schedule is no longer effective. monday: type: array description: Trading hours for Monday. May contain multiple sessions. @@ -5182,6 +4802,7 @@ components: description: Trading hours for Sunday. May contain multiple sessions. items: $ref: '#/components/schemas/DailySchedule' + DailySchedule: type: object required: @@ -5194,6 +4815,7 @@ components: close_time: type: string description: Closing time in ET (Eastern Time) format HH:MM. + MaintenanceWindow: type: object required: @@ -5208,6 +4830,7 @@ components: type: string format: date-time description: End date and time of the maintenance window. + GetHistoricalCutoffResponse: type: object required: @@ -5218,32 +4841,24 @@ components: market_settled_ts: type: string format: date-time - description: > - Cutoff based on **market settlement time**. Markets and their - candlesticks that settled before this timestamp must be accessed via - `GET /historical/markets` and `GET - /historical/markets/{ticker}/candlesticks`. + description: | + Cutoff based on **market settlement time**. Markets and their candlesticks that settled before this timestamp must be accessed via `GET /historical/markets` and `GET /historical/markets/{ticker}/candlesticks`. trades_created_ts: type: string format: date-time - description: > - Cutoff based on **trade fill time**. Fills that occurred before this - timestamp must be accessed via `GET /historical/fills`. + description: | + Cutoff based on **trade fill time**. Fills that occurred before this timestamp must be accessed via `GET /historical/fills`. orders_updated_ts: type: string format: date-time - description: > - Cutoff based on **order cancellation or execution time**. Orders - canceled or fully executed before this timestamp must be accessed - via `GET /historical/orders`. Resting (active) orders are always - available in `GET /portfolio/orders`. + description: | + Cutoff based on **order cancellation or execution time**. Orders canceled or fully executed before this timestamp must be accessed via `GET /historical/orders`. Resting (active) orders are always available in `GET /portfolio/orders`. market_positions_last_updated_ts: type: string format: date-time - description: > - Cutoff based on **position last-update time**. Settled positions - archived from the live data set before this timestamp are served - through the historical section of position reads. + description: | + Cutoff based on **position last-update time**. Settled positions archived from the live data set before this timestamp are served through the historical section of position reads. + GetUserDataTimestampResponse: type: object required: @@ -5253,6 +4868,7 @@ components: type: string format: date-time description: Timestamp when user data was last updated. + GetMarketCandlesticksResponse: type: object required: @@ -5267,6 +4883,7 @@ components: description: Array of candlestick data points for the specified time range. items: $ref: '#/components/schemas/MarketCandlestick' + GetEventCandlesticksResponse: type: object required: @@ -5281,9 +4898,7 @@ components: type: string market_candlesticks: type: array - description: >- - Array of market candlestick arrays, one for each market in the - event. + description: Array of market candlestick arrays, one for each market in the event. items: type: array items: @@ -5291,9 +4906,8 @@ components: adjusted_end_ts: type: integer format: int64 - description: >- - Adjusted end timestamp if the requested candlesticks would be larger - than maxAggregateCandidates. + description: Adjusted end timestamp if the requested candlesticks would be larger than maxAggregateCandidates. + BatchGetMarketCandlesticksResponse: type: object required: @@ -5304,6 +4918,7 @@ components: description: Array of market candlestick data, one entry per requested market. items: $ref: '#/components/schemas/MarketCandlesticksResponse' + MarketCandlesticksResponse: type: object required: @@ -5315,11 +4930,10 @@ components: description: Market ticker string (e.g., 'INXD-24JAN01'). candlesticks: type: array - description: >- - Array of candlestick data points for the market. Includes an initial - data point at the start timestamp when available. + description: Array of candlestick data points for the market. Includes an initial data point at the start timestamp when available. items: $ref: '#/components/schemas/MarketCandlestick' + MarketCandlestick: type: object required: @@ -5336,29 +4950,20 @@ components: description: Unix timestamp for the inclusive end of the candlestick period. yes_bid: $ref: '#/components/schemas/BidAskDistribution' - description: >- - Open, high, low, close (OHLC) data for YES buy offers on the market - during the candlestick period. + description: Open, high, low, close (OHLC) data for YES buy offers on the market during the candlestick period. yes_ask: $ref: '#/components/schemas/BidAskDistribution' - description: >- - Open, high, low, close (OHLC) data for YES sell offers on the market - during the candlestick period. + description: Open, high, low, close (OHLC) data for YES sell offers on the market during the candlestick period. price: $ref: '#/components/schemas/PriceDistribution' - description: >- - Open, high, low, close (OHLC) and more data for trade YES contract - prices on the market during the candlestick period. + description: Open, high, low, close (OHLC) and more data for trade YES contract prices on the market during the candlestick period. volume_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought on the - market during the candlestick period. + description: String representation of the number of contracts bought on the market during the candlestick period. open_interest_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought on the - market by end of the candlestick period (end_period_ts). + description: String representation of the number of contracts bought on the market by end of the candlestick period (end_period_ts). + BidAskDistribution: type: object required: @@ -5369,81 +4974,54 @@ components: properties: open_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Offer price on the market at the start of the candlestick period (in - dollars). + description: Offer price on the market at the start of the candlestick period (in dollars). low_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Lowest offer price on the market during the candlestick period (in - dollars). + description: Lowest offer price on the market during the candlestick period (in dollars). high_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Highest offer price on the market during the candlestick period (in - dollars). + description: Highest offer price on the market during the candlestick period (in dollars). close_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Offer price on the market at the end of the candlestick period (in - dollars). + description: Offer price on the market at the end of the candlestick period (in dollars). + PriceDistribution: type: object properties: open_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - First traded YES contract price on the market during the candlestick - period (in dollars). May be null if there was no trade during the - period. + description: First traded YES contract price on the market during the candlestick period (in dollars). May be null if there was no trade during the period. low_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Lowest traded YES contract price on the market during the - candlestick period (in dollars). May be null if there was no trade - during the period. + description: Lowest traded YES contract price on the market during the candlestick period (in dollars). May be null if there was no trade during the period. high_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Highest traded YES contract price on the market during the - candlestick period (in dollars). May be null if there was no trade - during the period. + description: Highest traded YES contract price on the market during the candlestick period (in dollars). May be null if there was no trade during the period. close_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Last traded YES contract price on the market during the candlestick - period (in dollars). May be null if there was no trade during the - period. + description: Last traded YES contract price on the market during the candlestick period (in dollars). May be null if there was no trade during the period. mean_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Mean traded YES contract price on the market during the candlestick - period (in dollars). May be null if there was no trade during the - period. + description: Mean traded YES contract price on the market during the candlestick period (in dollars). May be null if there was no trade during the period. previous_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Last traded YES contract price on the market before the candlestick - period (in dollars). May be null if there were no trades before the - period. + description: Last traded YES contract price on the market before the candlestick period (in dollars). May be null if there were no trades before the period. min_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Minimum close price of any market during the candlestick period (in - dollars). + description: Minimum close price of any market during the candlestick period (in dollars). max_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Maximum close price of any market during the candlestick period (in - dollars). + description: Maximum close price of any market during the candlestick period (in dollars). + + # Live Data schemas LiveData: type: object required: @@ -5461,6 +5039,7 @@ components: milestone_id: type: string description: Milestone ID + GetLiveDataResponse: type: object required: @@ -5468,6 +5047,7 @@ components: properties: live_data: $ref: '#/components/schemas/LiveData' + GetLiveDatasResponse: type: object required: @@ -5477,6 +5057,7 @@ components: type: array items: $ref: '#/components/schemas/LiveData' + EventLiveData: type: object required: @@ -5489,9 +5070,7 @@ components: details: type: object additionalProperties: true - description: >- - Live data details as a flexible object whose shape depends on the - type. + description: Live data details as a flexible object whose shape depends on the type. is_historical: type: boolean description: >- @@ -5507,6 +5086,7 @@ components: items: type: string description: Chart range menu options. Omitted when unset. + GetEventLiveDataResponse: type: object required: @@ -5514,11 +5094,13 @@ components: properties: live_data: $ref: '#/components/schemas/EventLiveData' + GetGameStatsResponse: type: object properties: pbp: $ref: '#/components/schemas/PlayByPlay' + PlayByPlay: type: object description: Play-by-play data organized by period. @@ -5533,6 +5115,7 @@ components: items: type: object additionalProperties: true + IndexedBalance: type: object required: @@ -5543,6 +5126,7 @@ components: $ref: '#/components/schemas/ExchangeIndex' balance: $ref: '#/components/schemas/FixedPointDollars' + GetBalanceResponse: type: object required: @@ -5554,20 +5138,14 @@ components: balance: type: integer format: int64 - description: >- - Member's available balance in cents. This represents the amount - available for trading. + description: Member's available balance in cents. This represents the amount available for trading. balance_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Member's available balance as a fixed-point dollar string. This - represents the amount available for trading. + description: Member's available balance as a fixed-point dollar string. This represents the amount available for trading. portfolio_value: type: integer format: int64 - description: >- - Member's portfolio value in cents. This is the current value of all - positions held. + description: Member's portfolio value in cents. This is the current value of the positions held by the requested subaccount on the requested exchange index. updated_ts: type: integer format: int64 @@ -5576,19 +5154,19 @@ components: type: array items: $ref: '#/components/schemas/IndexedBalance' - description: >- - User balance breakdown per exchange instance, omitted only when - using a subaccount-restricted API key. + description: 'User balance breakdown per exchange instance, omitted only when using a subaccount-restricted API key.' + CreateSubaccountRequest: type: object properties: exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' - description: Identifier for an exchange shard. Defaults to 0 if unspecified. + description: "Identifier for an exchange shard. Defaults to 0 if unspecified." x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: - validate: gte=0 + validate: "gte=0" + CreateSubaccountResponse: type: object required: @@ -5597,6 +5175,7 @@ components: subaccount_number: type: integer description: The sequential number assigned to this subaccount (1-63). + ApplySubaccountTransferRequest: type: object required: @@ -5610,17 +5189,13 @@ components: format: uuid description: Unique client-provided transfer ID for idempotency. x-oapi-codegen-extra-tags: - validate: required + validate: "required" from_subaccount: type: integer - description: >- - Source subaccount number (0 for primary, 1-63 for numbered - subaccounts). + description: Source subaccount number (0 for primary, 1-63 for numbered subaccounts). to_subaccount: type: integer - description: >- - Destination subaccount number (0 for primary, 1-63 for numbered - subaccounts). + description: Destination subaccount number (0 for primary, 1-63 for numbered subaccounts). amount_cents: type: integer format: int64 @@ -5628,13 +5203,15 @@ components: exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' - description: Identifier for an exchange shard. Defaults to 0 if unspecified. + description: "Identifier for an exchange shard. Defaults to 0 if unspecified." x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: - validate: gte=0 + validate: "gte=0" + ApplySubaccountTransferResponse: type: object description: Empty response indicating successful transfer. + GetSubaccountBalancesResponse: type: object required: @@ -5644,6 +5221,7 @@ components: type: array items: $ref: '#/components/schemas/SubaccountBalance' + SubaccountBalance: type: object required: @@ -5665,6 +5243,7 @@ components: type: integer format: int64 description: Unix timestamp of last balance update. + GetSubaccountTransfersResponse: type: object required: @@ -5677,6 +5256,7 @@ components: cursor: type: string description: Cursor for the next page of results. + SubaccountTransfer: type: object required: @@ -5707,6 +5287,7 @@ components: exchange_index: type: integer description: Exchange index the transfer was applied on. + UpdateSubaccountNettingRequest: type: object required: @@ -5719,6 +5300,7 @@ components: enabled: type: boolean description: Whether netting is enabled for this subaccount. + GetSubaccountNettingResponse: type: object required: @@ -5728,6 +5310,7 @@ components: type: array items: $ref: '#/components/schemas/SubaccountNettingConfig' + SubaccountNettingConfig: type: object required: @@ -5744,6 +5327,8 @@ components: exchange_index: type: integer description: Exchange index of the subaccount. + + # Portfolio schemas (specific to portfolio endpoints, not shared with IB) GetSettlementsResponse: type: object required: @@ -5755,6 +5340,7 @@ components: $ref: '#/components/schemas/Settlement' cursor: type: string + Settlement: type: object required: @@ -5777,55 +5363,51 @@ components: description: The event ticker symbol of the market that was settled. market_result: type: string - enum: - - 'yes' - - 'no' - - scalar - description: >- - The outcome of the market settlement. 'yes' = market resolved to - YES, 'no' = market resolved to NO, 'scalar' = scalar market settled - at a specific value. + enum: ['yes', 'no', 'scalar'] + description: The outcome of the market settlement. 'yes' = market resolved to YES, 'no' = market resolved to NO, 'scalar' = scalar market settled at a specific value. yes_count_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of YES contracts owned at the - time of settlement. + description: String representation of the number of YES contracts owned at the time of settlement. yes_total_cost_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Total cost basis of all YES contracts in fixed-point dollars. no_count_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of NO contracts owned at the - time of settlement. + description: String representation of the number of NO contracts owned at the time of settlement. no_total_cost_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Total cost basis of all NO contracts in fixed-point dollars. revenue: type: integer - description: >- - Total revenue earned from this settlement in cents (winning - contracts pay out 100 cents each). + description: Total revenue earned from this settlement in cents (winning contracts pay out 100 cents each). settled_time: type: string format: date-time description: Timestamp when the market was settled and payouts were processed. fee_cost: $ref: '#/components/schemas/FixedPointDollars' - example: '0.3400' + example: "0.3400" description: Total fees paid in fixed point dollars. value: type: integer nullable: true description: Payout of a single yes contract in cents. + GetPortfolioRestingOrderTotalValueResponse: type: object required: - total_resting_order_value + - resting_order_value_breakdown properties: total_resting_order_value: type: integer description: Total value of resting orders in cents + resting_order_value_breakdown: + type: array + items: + $ref: '#/components/schemas/IndexedBalance' + description: Total value of resting orders broken down by exchange index, with each balance expressed as a fixed-point dollar string. + GetDepositsResponse: type: object required: @@ -5837,6 +5419,7 @@ components: $ref: '#/components/schemas/Deposit' cursor: type: string + Deposit: type: object required: @@ -5862,9 +5445,7 @@ components: - DepositStatusApplied - DepositStatusFailed - DepositStatusReturned - description: >- - Current status of the deposit. 'applied' means funds are reflected - in balance. + description: Current status of the deposit. 'applied' means funds are reflected in balance. type: type: string enum: @@ -5890,9 +5471,8 @@ components: type: integer format: int64 nullable: true - description: >- - Unix timestamp of when the deposit was finalized (applied, failed, - or returned). + description: Unix timestamp of when the deposit was finalized (applied, failed, or returned). + GetWithdrawalsResponse: type: object required: @@ -5904,6 +5484,7 @@ components: $ref: '#/components/schemas/Withdrawal' cursor: type: string + Withdrawal: type: object required: @@ -5929,9 +5510,7 @@ components: - WithdrawalStatusApplied - WithdrawalStatusFailed - WithdrawalStatusReturned - description: >- - Current status of the withdrawal. 'applied' means funds have been - deducted from balance. + description: Current status of the withdrawal. 'applied' means funds have been deducted from balance. type: type: string enum: @@ -5957,9 +5536,9 @@ components: type: integer format: int64 nullable: true - description: >- - Unix timestamp of when the withdrawal was finalized (applied, - failed, or returned). + description: Unix timestamp of when the withdrawal was finalized (applied, failed, or returned). + + # FCM schemas Order: type: object required: @@ -5992,64 +5571,36 @@ components: type: string side: type: string - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] deprecated: true x-go-type-skip-optional-pointer: true - description: > - Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order - direction](/getting_started/order_direction). This field will not be - removed before May 14, 2026. + description: | + Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order direction](/getting_started/order_direction). This field will not be removed before May 14, 2026. action: type: string - enum: - - buy - - sell + enum: [buy, sell] deprecated: true x-go-type-skip-optional-pointer: true - description: > - Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order - direction](/getting_started/order_direction). This field will not be - removed before May 14, 2026. + description: | + Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order direction](/getting_started/order_direction). This field will not be removed before May 14, 2026. outcome_side: type: string - enum: - - 'yes' - - 'no' - description: > - The outcome side this order is positioned for. buy-yes and sell-no - produce 'yes'; buy-no and sell-yes produce 'no'. - - - `outcome_side` describes directional exposure only; it does not - change the order's price. An order at price `p` with - `outcome_side=no` is matched by an order at the same price `p` with - `outcome_side=yes` — both parties trade at the same price, just on - opposite directions. + enum: ['yes', 'no'] + description: | + The outcome side this order is positioned for. buy-yes and sell-no produce 'yes'; buy-no and sell-yes produce 'no'. + `outcome_side` describes directional exposure only; it does not change the order's price. An order at price `p` with `outcome_side=no` is matched by an order at the same price `p` with `outcome_side=yes` — both parties trade at the same price, just on opposite directions. - `outcome_side` and `book_side` will become the canonical way to - determine order direction. The legacy `action`, `side`, and `is_yes` - fields will be deprecated in a future release — please migrate to - these new fields. + `outcome_side` and `book_side` will become the canonical way to determine order direction. The legacy `action`, `side`, and `is_yes` fields will be deprecated in a future release — please migrate to these new fields. book_side: $ref: '#/components/schemas/BookSide' - description: > - Same directional bit as outcome_side in book vocabulary. 'bid' is - equivalent to outcome_side 'yes'; 'ask' is equivalent to - outcome_side 'no'. - + description: | + Same directional bit as outcome_side in book vocabulary. 'bid' is equivalent to outcome_side 'yes'; 'ask' is equivalent to outcome_side 'no'. - `outcome_side` and `book_side` will become the canonical way to - determine order direction. The legacy `action`, `side`, and `is_yes` - fields will be deprecated in a future release — please migrate to - these new fields. + `outcome_side` and `book_side` will become the canonical way to determine order direction. The legacy `action`, `side`, and `is_yes` fields will be deprecated in a future release — please migrate to these new fields. type: type: string - enum: - - limit - - market + enum: [limit, market] status: $ref: '#/components/schemas/OrderStatus' yes_price_dollars: @@ -6060,17 +5611,13 @@ components: description: The no price for this order in fixed-point dollars fill_count_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts that have been - filled + description: String representation of the number of contracts that have been filled remaining_count_fp: $ref: '#/components/schemas/FixedPointCount' description: String representation of the remaining contracts for this order initial_count_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the initial size of the order (contract - units) + description: String representation of the initial size of the order (contract units) taker_fill_cost_dollars: $ref: '#/components/schemas/FixedPointDollars' description: The cost of filled taker orders in dollars @@ -6108,9 +5655,7 @@ components: description: The order group this order is part of cancel_order_on_pause: type: boolean - description: >- - If this flag is set to true, the order will be canceled if the order - is open and trading on the exchange is paused for any reason. + description: If this flag is set to true, the order will be canceled if the order is open and trading on the exchange is paused for any reason. subaccount_number: type: integer nullable: true @@ -6121,6 +5666,7 @@ components: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true x-omitempty: false + Milestone: type: object required: @@ -6140,14 +5686,11 @@ components: description: Unique identifier for the milestone. category: type: string - description: Category of the milestone. E.g. Sports, Elections, Esports, Crypto. + description: 'Category of the milestone. E.g. Sports, Elections, Esports, Crypto.' example: Sports type: type: string - description: >- - Type of the milestone. E.g. football_game, basketball_game, - soccer_tournament_multi_leg, baseball_game, hockey_match, - golf_tournament, political_race. + description: 'Type of the milestone. E.g. football_game, basketball_game, soccer_tournament_multi_leg, baseball_game, hockey_match, golf_tournament, political_race.' example: football_game start_date: type: string @@ -6186,13 +5729,12 @@ components: type: array items: type: string - description: >- - List of event tickers directly related to the outcome of this - milestone. + description: List of event tickers directly related to the outcome of this milestone. last_updated_ts: type: string format: date-time description: Last time this structured target was updated. + GetMilestoneResponse: type: object required: @@ -6201,6 +5743,7 @@ components: milestone: $ref: '#/components/schemas/Milestone' description: The milestone data. + GetMilestonesResponse: type: object required: @@ -6214,6 +5757,7 @@ components: cursor: type: string description: Cursor for pagination. + GetOrdersResponse: type: object required: @@ -6226,6 +5770,7 @@ components: $ref: '#/components/schemas/Order' cursor: type: string + GetOrderQueuePositionResponse: type: object required: @@ -6234,6 +5779,7 @@ components: queue_position_fp: $ref: '#/components/schemas/FixedPointCount' description: The number of preceding shares before the order in the queue. + OrderQueuePosition: type: object required: @@ -6250,6 +5796,7 @@ components: queue_position_fp: $ref: '#/components/schemas/FixedPointCount' description: The number of preceding shares before the order in the queue. + GetOrderQueuePositionsResponse: type: object required: @@ -6260,6 +5807,7 @@ components: description: Queue positions for all matching orders items: $ref: '#/components/schemas/OrderQueuePosition' + MarketPosition: type: object required: @@ -6280,9 +5828,7 @@ components: description: Total spent on this market in dollars position_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought in this - market. Negative means NO contracts and positive means YES contracts + description: String representation of the number of contracts bought in this market. Negative means NO contracts and positive means YES contracts market_exposure_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Cost of the aggregate market position in dollars @@ -6296,6 +5842,7 @@ components: type: string format: date-time description: Last time the position is updated + EventPosition: type: object required: @@ -6314,9 +5861,7 @@ components: description: Total spent on this event in dollars total_cost_shares_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the total number of shares traded on this - event (including both YES and NO contracts) + description: String representation of the total number of shares traded on this event (including both YES and NO contracts) event_exposure_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Cost of the aggregate event position in dollars @@ -6326,6 +5871,7 @@ components: fees_paid_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Fees paid on fill orders, in dollars + GetPositionsResponse: type: object required: @@ -6334,12 +5880,7 @@ components: properties: cursor: type: string - description: >- - The Cursor represents a pointer to the next page of records in the - pagination. Use the value returned here in the cursor query - parameter for this end-point to get the next page containing limit - records. An empty value of this field indicates there is no next - page. + description: The Cursor represents a pointer to the next page of records in the pagination. Use the value returned here in the cursor query parameter for this end-point to get the next page containing limit records. An empty value of this field indicates there is no next page. market_positions: type: array items: @@ -6350,6 +5891,7 @@ components: items: $ref: '#/components/schemas/EventPosition' description: List of event positions + Trade: type: object required: @@ -6371,9 +5913,7 @@ components: description: Unique identifier for the market count_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought or sold in - this trade + description: String representation of the number of contracts bought or sold in this trade yes_price_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Yes price for this trade in dollars @@ -6382,64 +5922,36 @@ components: description: No price for this trade in dollars taker_side: type: string - enum: - - 'yes' - - 'no' - x-enum-varnames: - - TradeTakerSideYes - - TradeTakerSideNo + enum: ['yes', 'no'] + x-enum-varnames: ['TradeTakerSideYes', 'TradeTakerSideNo'] deprecated: true x-go-type-skip-optional-pointer: true - description: > - Deprecated. Use `taker_outcome_side` (or `taker_book_side`) instead. - See [Order direction](/getting_started/order_direction). This field - will not be removed before May 14, 2026. + description: | + Deprecated. Use `taker_outcome_side` (or `taker_book_side`) instead. See [Order direction](/getting_started/order_direction). This field will not be removed before May 14, 2026. taker_outcome_side: type: string - enum: - - 'yes' - - 'no' - x-enum-varnames: - - TradeTakerOutcomeSideYes - - TradeTakerOutcomeSideNo - description: > - The outcome side the taker is positioned for. buy-yes and sell-no - produce 'yes'; buy-no and sell-yes produce 'no'. - - - `taker_outcome_side` describes directional exposure only; it does - not change the trade's price. A trade at price `p` with - `taker_outcome_side=no` is matched against the maker at the same - price `p` with the opposite direction — both parties trade at the - same price. + enum: ['yes', 'no'] + x-enum-varnames: ['TradeTakerOutcomeSideYes', 'TradeTakerOutcomeSideNo'] + description: | + The outcome side the taker is positioned for. buy-yes and sell-no produce 'yes'; buy-no and sell-yes produce 'no'. + `taker_outcome_side` describes directional exposure only; it does not change the trade's price. A trade at price `p` with `taker_outcome_side=no` is matched against the maker at the same price `p` with the opposite direction — both parties trade at the same price. - `taker_outcome_side` and `taker_book_side` will become the canonical - way to determine trade direction. The legacy `taker_side` field will - be deprecated in a future release — please migrate to these new - fields. + `taker_outcome_side` and `taker_book_side` will become the canonical way to determine trade direction. The legacy `taker_side` field will be deprecated in a future release — please migrate to these new fields. taker_book_side: $ref: '#/components/schemas/BookSide' - description: > - Same directional bit as taker_outcome_side in book vocabulary. 'bid' - is equivalent to taker_outcome_side 'yes'; 'ask' is equivalent to - taker_outcome_side 'no'. - + description: | + Same directional bit as taker_outcome_side in book vocabulary. 'bid' is equivalent to taker_outcome_side 'yes'; 'ask' is equivalent to taker_outcome_side 'no'. - `taker_outcome_side` and `taker_book_side` will become the canonical - way to determine trade direction. The legacy `taker_side` field will - be deprecated in a future release — please migrate to these new - fields. + `taker_outcome_side` and `taker_book_side` will become the canonical way to determine trade direction. The legacy `taker_side` field will be deprecated in a future release — please migrate to these new fields. created_time: type: string format: date-time description: Timestamp when this trade was executed is_block_trade: type: boolean - description: >- - True if this trade was matched off-book as a block trade (e.g. via - RFQ / negotiated block proposal); false for trades that filled on - the standard order book. + description: True if this trade was matched off-book as a block trade (e.g. via RFQ / negotiated block proposal); false for trades that filled on the standard order book. + GetIncentiveProgramsResponse: type: object required: @@ -6452,6 +5964,7 @@ components: next_cursor: type: string description: Cursor for pagination to get the next page of results + IncentiveProgram: type: object required: @@ -6470,19 +5983,13 @@ components: description: Unique identifier for the incentive program market_id: type: string - description: >- - The unique identifier of the market associated with this incentive - program + description: The unique identifier of the market associated with this incentive program market_ticker: type: string - description: >- - The ticker symbol of the market associated with this incentive - program + description: The ticker symbol of the market associated with this incentive program incentive_type: type: string - enum: - - liquidity - - volume + enum: ['liquidity', 'volume'] description: Type of incentive program incentive_description: type: string @@ -6510,9 +6017,8 @@ components: target_size_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the target size for the incentive program - (optional) + description: String representation of the target size for the incentive program (optional) + GetTradesResponse: type: object required: @@ -6525,6 +6031,7 @@ components: $ref: '#/components/schemas/Trade' cursor: type: string + Fill: type: object required: @@ -6558,64 +6065,36 @@ components: description: Unique identifier for the market (legacy field name, same as ticker) side: type: string - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] deprecated: true x-go-type-skip-optional-pointer: true - description: > - Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order - direction](/getting_started/order_direction). This field will not be - removed before May 14, 2026. + description: | + Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order direction](/getting_started/order_direction). This field will not be removed before May 14, 2026. action: type: string - enum: - - buy - - sell + enum: ['buy', 'sell'] deprecated: true x-go-type-skip-optional-pointer: true - description: > - Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order - direction](/getting_started/order_direction). This field will not be - removed before May 14, 2026. + description: | + Deprecated. Use `outcome_side` (or `book_side`) instead. See [Order direction](/getting_started/order_direction). This field will not be removed before May 14, 2026. outcome_side: type: string - enum: - - 'yes' - - 'no' - description: > - The outcome side this fill positioned the user for. buy-yes and - sell-no produce 'yes'; buy-no and sell-yes produce 'no'. - - - `outcome_side` describes directional exposure only; it does not - change the fill's price. A fill at price `p` with `outcome_side=no` - is matched against an order at the same price `p` with - `outcome_side=yes` — both parties trade at the same price, just on - opposite directions. + enum: ['yes', 'no'] + description: | + The outcome side this fill positioned the user for. buy-yes and sell-no produce 'yes'; buy-no and sell-yes produce 'no'. + `outcome_side` describes directional exposure only; it does not change the fill's price. A fill at price `p` with `outcome_side=no` is matched against an order at the same price `p` with `outcome_side=yes` — both parties trade at the same price, just on opposite directions. - `outcome_side` and `book_side` will become the canonical way to - determine fill direction. The legacy `action` and `side` fields will - be deprecated in a future release — please migrate to these new - fields. + `outcome_side` and `book_side` will become the canonical way to determine fill direction. The legacy `action` and `side` fields will be deprecated in a future release — please migrate to these new fields. book_side: $ref: '#/components/schemas/BookSide' - description: > - Same directional bit as outcome_side in book vocabulary. 'bid' is - equivalent to outcome_side 'yes'; 'ask' is equivalent to - outcome_side 'no'. - + description: | + Same directional bit as outcome_side in book vocabulary. 'bid' is equivalent to outcome_side 'yes'; 'ask' is equivalent to outcome_side 'no'. - `outcome_side` and `book_side` will become the canonical way to - determine fill direction. The legacy `action` and `side` fields will - be deprecated in a future release — please migrate to these new - fields. + `outcome_side` and `book_side` will become the canonical way to determine fill direction. The legacy `action` and `side` fields will be deprecated in a future release — please migrate to these new fields. count_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought or sold in - this fill + description: String representation of the number of contracts bought or sold in this fill yes_price_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Fill price for the yes side in fixed-point dollars @@ -6624,9 +6103,7 @@ components: description: Fill price for the no side in fixed-point dollars is_taker: type: boolean - description: >- - If true, this fill was a taker (removed liquidity from the order - book) + description: If true, this fill was a taker (removed liquidity from the order book) created_time: type: string format: date-time @@ -6638,13 +6115,12 @@ components: type: integer nullable: true x-omitempty: true - description: >- - Subaccount number (0 for primary, 1-63 for subaccounts). Present for - direct users. + description: Subaccount number (0 for primary, 1-63 for subaccounts). Present for direct users. ts: type: integer format: int64 description: Unix timestamp when this fill was executed (legacy field name) + GetFillsResponse: type: object required: @@ -6657,6 +6133,8 @@ components: $ref: '#/components/schemas/Fill' cursor: type: string + + # Structured Target schemas StructuredTarget: type: object properties: @@ -6671,14 +6149,10 @@ components: description: Type of the structured target. details: type: object - description: >- - Additional details about the structured target. Contains flexible - JSON data specific to the target type. + description: Additional details about the structured target. Contains flexible JSON data specific to the target type. source_id: type: string - description: >- - External source identifier for the structured target, if available - (e.g., third-party data provider ID). + description: External source identifier for the structured target, if available (e.g., third-party data provider ID). source_ids: type: object additionalProperties: @@ -6688,6 +6162,7 @@ components: type: string format: date-time description: Timestamp when this structured target was last updated. + GetStructuredTargetsResponse: type: object properties: @@ -6697,17 +6172,19 @@ components: $ref: '#/components/schemas/StructuredTarget' cursor: type: string - description: >- - Pagination cursor for the next page. Empty if there are no more - results. + description: Pagination cursor for the next page. Empty if there are no more results. + GetStructuredTargetResponse: type: object properties: structured_target: $ref: '#/components/schemas/StructuredTarget' + + # Order Group schemas EmptyResponse: type: object description: An empty response body + IntraExchangeInstanceTransferRequest: type: object required: @@ -6733,7 +6210,7 @@ components: x-go-type-skip-optional-pointer: true description: Source exchange shard index (default 0) x-oapi-codegen-extra-tags: - validate: gte=0,lte=100 + validate: "gte=0,lte=100" destination_exchange_shard: type: integer minimum: 0 @@ -6742,7 +6219,8 @@ components: x-go-type-skip-optional-pointer: true description: Destination exchange shard index (default 0) x-oapi-codegen-extra-tags: - validate: gte=0,lte=100 + validate: "gte=0,lte=100" + IntraExchangeInstanceTransferResponse: type: object required: @@ -6751,15 +6229,13 @@ components: transfer_id: type: string description: The ID of the transfer that was created + IntraExchangeInstanceTransferStatus: type: string - enum: - - pending - - complete - x-enum-varnames: - - IntraExchangeInstanceTransferStatusPending - - IntraExchangeInstanceTransferStatusComplete + enum: ['pending', 'complete'] + x-enum-varnames: ['IntraExchangeInstanceTransferStatusPending', 'IntraExchangeInstanceTransferStatusComplete'] description: Transfer status. + IntraExchangeInstanceTransfer: type: object required: @@ -6796,6 +6272,7 @@ components: type: integer format: int64 description: Unix timestamp when the transfer was created + GetIntraExchangeInstanceTransfersResponse: type: object required: @@ -6807,9 +6284,8 @@ components: $ref: '#/components/schemas/IntraExchangeInstanceTransfer' cursor: type: string - description: >- - Cursor for the next page of results. Omitted when there are no - further pages. + description: Cursor for the next page of results. Omitted when there are no further pages. + GetIntraExchangeInstanceTransferResponse: type: object required: @@ -6817,6 +6293,7 @@ components: properties: transfer: $ref: '#/components/schemas/IntraExchangeInstanceTransfer' + OrderGroup: type: object required: @@ -6829,9 +6306,7 @@ components: x-go-type-skip-optional-pointer: true contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the current maximum contracts allowed over - a rolling 15-second window. + description: String representation of the current maximum contracts allowed over a rolling 15-second window. x-go-type-skip-optional-pointer: true is_auto_cancel_enabled: type: boolean @@ -6842,6 +6317,7 @@ components: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true x-omitempty: false + GetOrderGroupsResponse: type: object properties: @@ -6850,6 +6326,7 @@ components: items: $ref: '#/components/schemas/OrderGroup' x-go-type-skip-optional-pointer: true + GetOrderGroupResponse: type: object required: @@ -6861,9 +6338,7 @@ components: description: Whether auto-cancel is enabled for this order group contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the current maximum contracts allowed over - a rolling 15-second window. + description: String representation of the current maximum contracts allowed over a rolling 15-second window. x-go-type-skip-optional-pointer: true orders: type: array @@ -6876,41 +6351,32 @@ components: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true x-omitempty: false + CreateOrderGroupRequest: type: object properties: subaccount: type: integer minimum: 0 - description: >- - Optional subaccount number to use for this order group (0 for - primary, 1-63 for subaccounts). Subaccount-restricted API keys must - omit this field or pass their locked subaccount. + description: Optional subaccount number to use for this order group (0 for primary, 1-63 for subaccounts). Subaccount-restricted API keys must omit this field or pass their locked subaccount. contracts_limit: type: integer format: int64 minimum: 1 - description: >- - Specifies the maximum number of contracts that can be matched within - this group over a rolling 15-second window. Whole contracts only. - Provide contracts_limit or contracts_limit_fp; if both provided they - must match. + description: Specifies the maximum number of contracts that can be matched within this group over a rolling 15-second window. Whole contracts only. Provide contracts_limit or contracts_limit_fp; if both provided they must match. x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: validate: omitempty,gte=1 contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the maximum number of contracts that can be - matched within this group over a rolling 15-second window. Provide - contracts_limit or contracts_limit_fp; if both provided they must - match. + description: String representation of the maximum number of contracts that can be matched within this group over a rolling 15-second window. Provide contracts_limit or contracts_limit_fp; if both provided they must match. exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 x-go-type-skip-optional-pointer: true + UpdateOrderGroupLimitRequest: type: object properties: @@ -6918,22 +6384,15 @@ components: type: integer format: int64 minimum: 1 - description: >- - New maximum number of contracts that can be matched within this - group over a rolling 15-second window. Whole contracts only. Provide - contracts_limit or contracts_limit_fp; if both provided they must - match. + description: New maximum number of contracts that can be matched within this group over a rolling 15-second window. Whole contracts only. Provide contracts_limit or contracts_limit_fp; if both provided they must match. x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: validate: omitempty,gte=1 contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the new maximum number of contracts that - can be matched within this group over a rolling 15-second window. - Provide contracts_limit or contracts_limit_fp; if both provided they - must match. + description: String representation of the new maximum number of contracts that can be matched within this group over a rolling 15-second window. Provide contracts_limit or contracts_limit_fp; if both provided they must match. + CreateOrderGroupResponse: type: object required: @@ -6946,15 +6405,14 @@ components: subaccount: type: integer minimum: 0 - description: >- - Subaccount number that owns the created order group (0 for primary, - 1-63 for subaccounts). + description: Subaccount number that owns the created order group (0 for primary, 1-63 for subaccounts). x-go-type-skip-optional-pointer: true exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true x-omitempty: false + GetCommunicationsIDResponse: type: object required: @@ -6963,6 +6421,7 @@ components: communications_id: type: string description: A public communications ID which is used to identify the user + BlockTradeProposal: type: object required: @@ -6989,25 +6448,17 @@ components: description: User ID of the proposal creator buyer_user_id: type: string - description: >- - User ID of the buyer. Empty when the authenticated user is not the - buyer. + description: User ID of the buyer. Empty when the authenticated user is not the buyer. buyer_subtrader_id: type: string - description: >- - Subtrader ID of the buyer. Empty when the authenticated user is not - the buyer. + description: Subtrader ID of the buyer. Empty when the authenticated user is not the buyer. x-go-type-skip-optional-pointer: true seller_user_id: type: string - description: >- - User ID of the seller. Empty when the authenticated user is not the - seller. + description: User ID of the seller. Empty when the authenticated user is not the seller. seller_subtrader_id: type: string - description: >- - Subtrader ID of the seller. Empty when the authenticated user is not - the seller. + description: Subtrader ID of the seller. Empty when the authenticated user is not the seller. x-go-type-skip-optional-pointer: true market_ticker: type: string @@ -7023,9 +6474,7 @@ components: maker_side: type: string description: The maker side of the trade - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] expiration_ts: type: string format: date-time @@ -7067,6 +6516,7 @@ components: type: string description: Order ID for the seller after the proposal is executed x-go-type-skip-optional-pointer: true + GetBlockTradeProposalsResponse: type: object required: @@ -7081,6 +6531,7 @@ components: type: string description: Cursor for pagination to get the next page of results x-go-type-skip-optional-pointer: true + ProposeBlockTradeRequest: type: object required: @@ -7099,18 +6550,13 @@ components: validate: required buyer_subtrader_id: type: string - description: >- - Subtrader ID of the buyer. Provide either this or buyer_subaccount, - not both. + description: Subtrader ID of the buyer. Provide either this or buyer_subaccount, not both. x-go-type-skip-optional-pointer: true buyer_subaccount: type: integer minimum: 0 maximum: 63 - description: >- - User-managed subaccount number of the buyer (0 for primary, 1-63 for - numbered subaccounts). Provide either this or buyer_subtrader_id, - not both. + description: User-managed subaccount number of the buyer (0 for primary, 1-63 for numbered subaccounts). Provide either this or buyer_subtrader_id, not both. seller_user_id: type: string description: User ID of the seller @@ -7118,18 +6564,13 @@ components: validate: required seller_subtrader_id: type: string - description: >- - Subtrader ID of the seller. Provide either this or - seller_subaccount, not both. + description: Subtrader ID of the seller. Provide either this or seller_subaccount, not both. x-go-type-skip-optional-pointer: true seller_subaccount: type: integer minimum: 0 maximum: 63 - description: >- - User-managed subaccount number of the seller (0 for primary, 1-63 - for numbered subaccounts). Provide either this or - seller_subtrader_id, not both. + description: User-managed subaccount number of the seller (0 for primary, 1-63 for numbered subaccounts). Provide either this or seller_subtrader_id, not both. market_ticker: type: string description: The ticker of the market for this block trade @@ -7152,9 +6593,7 @@ components: maker_side: type: string description: The maker side of the trade - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] x-oapi-codegen-extra-tags: validate: required,oneof=yes no expiration_ts: @@ -7163,6 +6602,7 @@ components: description: Expiration time of the proposal x-oapi-codegen-extra-tags: validate: required + ProposeBlockTradeResponse: type: object required: @@ -7171,23 +6611,20 @@ components: block_trade_proposal_id: type: string description: The ID of the newly created block trade proposal + AcceptBlockTradeProposalRequest: type: object properties: subtrader_id: type: string - description: >- - Subtrader ID to accept as. Provide either this or subaccount, not - both. + description: Subtrader ID to accept as. Provide either this or subaccount, not both. x-go-type-skip-optional-pointer: true subaccount: type: integer minimum: 0 maximum: 63 - description: >- - User-managed subaccount number to accept as (0 for primary, 1-63 for - numbered subaccounts). Provide either this or subtrader_id, not - both. + description: User-managed subaccount number to accept as (0 for primary, 1-63 for numbered subaccounts). Provide either this or subtrader_id, not both. + RFQ: type: object required: @@ -7209,18 +6646,14 @@ components: description: The ticker of the market this RFQ is for contracts_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts requested in the - RFQ + description: String representation of the number of contracts requested in the RFQ target_cost_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Total value of the RFQ in dollars status: type: string description: Current status of the RFQ (open, closed) - enum: - - open - - closed + enum: [open, closed] created_ts: type: string format: date-time @@ -7249,9 +6682,7 @@ components: x-go-type-skip-optional-pointer: true creator_subaccount: type: integer - description: >- - Subaccount number of the RFQ creator (visible when the caller is the - RFQ creator) + description: Subaccount number of the RFQ creator (visible when the caller is the RFQ creator) cancelled_ts: type: string format: date-time @@ -7260,6 +6691,7 @@ components: type: string format: date-time description: Timestamp when the RFQ was last updated + GetRFQsResponse: type: object required: @@ -7274,6 +6706,7 @@ components: type: string description: Cursor for pagination to get the next page of results x-go-type-skip-optional-pointer: true + GetRFQResponse: type: object required: @@ -7282,6 +6715,7 @@ components: rfq: $ref: '#/components/schemas/RFQ' description: The details of the requested RFQ + CreateRFQRequest: type: object required: @@ -7293,23 +6727,16 @@ components: description: The ticker of the market for which to create an RFQ contracts: type: integer - description: >- - Whole-contract count for the RFQ. Use contracts_fp for partial - contract values; if both are provided, they must match. + description: Whole-contract count for the RFQ. Use contracts_fp for partial contract values; if both are provided, they must match. x-go-type-skip-optional-pointer: true contracts_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - Fixed-point number of contracts for the RFQ. Supports partial - contracts in 0.01-contract increments; if contracts is also - provided, both values must match. + description: Fixed-point number of contracts for the RFQ. Supports partial contracts in 0.01-contract increments; if contracts is also provided, both values must match. target_cost_centi_cents: type: integer format: int64 - description: >- - DEPRECATED: The target cost for the RFQ in centi-cents. Use - target_cost_dollars instead. + description: 'DEPRECATED: The target cost for the RFQ in centi-cents. Use target_cost_dollars instead.' deprecated: true x-go-type-skip-optional-pointer: true target_cost_dollars: @@ -7330,10 +6757,9 @@ components: x-go-type-skip-optional-pointer: true subaccount: type: integer - description: >- - The subaccount number to create the RFQ for (direct members only; 0 - for primary, 1-63 for subaccounts) + description: The subaccount number to create the RFQ for (direct members only; 0 for primary, 1-63 for subaccounts) x-go-type-skip-optional-pointer: true + CreateRFQResponse: type: object required: @@ -7342,6 +6768,7 @@ components: id: type: string description: The ID of the newly created RFQ + Quote: type: object required: @@ -7393,18 +6820,11 @@ components: status: type: string description: Current status of the quote - enum: - - open - - accepted - - confirmed - - executed - - cancelled + enum: [open, accepted, confirmed, executed, cancelled] accepted_side: type: string description: The side that was accepted (yes or no) - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] accepted_ts: type: string format: date-time @@ -7426,9 +6846,7 @@ components: description: Whether to rest the remainder of the quote after execution post_only: type: boolean - description: >- - Whether the quote creator's order is post-only (visible when the - caller is the quote creator) + description: Whether the quote creator's order is post-only (visible when the caller is the quote creator) cancellation_reason: type: string description: Reason for quote cancellation if cancelled @@ -7454,20 +6872,17 @@ components: x-go-type-skip-optional-pointer: true creator_subaccount: type: integer - description: >- - Subaccount number of the quote creator (visible when the caller is - the quote creator) + description: Subaccount number of the quote creator (visible when the caller is the quote creator) rfq_creator_subaccount: type: integer - description: >- - Subaccount number of the RFQ creator (visible when the caller is the - RFQ creator) + description: Subaccount number of the RFQ creator (visible when the caller is the RFQ creator) yes_contracts_fp: $ref: '#/components/schemas/FixedPointCount' description: Number of YES contracts offered in the quote (fixed-point) no_contracts_fp: $ref: '#/components/schemas/FixedPointCount' description: Number of NO contracts offered in the quote (fixed-point) + GetQuotesResponse: type: object required: @@ -7482,6 +6897,7 @@ components: type: string description: Cursor for pagination to get the next page of results x-go-type-skip-optional-pointer: true + GetQuoteResponse: type: object required: @@ -7490,6 +6906,7 @@ components: quote: $ref: '#/components/schemas/Quote' description: The details of the requested quote + CreateQuoteRequest: type: object required: @@ -7514,14 +6931,11 @@ components: description: Whether to rest the remainder of the quote after execution post_only: type: boolean - description: >- - If true, the quote creator's resting order will be cancelled rather - than crossed if it would take liquidity. Defaults to false. + description: If true, the quote creator's resting order will be cancelled rather than crossed if it would take liquidity. Defaults to false. subaccount: type: integer - description: >- - Optional subaccount number to place the quote under (0 for primary, - 1-63 for subaccounts) + description: Optional subaccount number to place the quote under (0 for primary, 1-63 for subaccounts) + CreateQuoteResponse: type: object required: @@ -7530,6 +6944,7 @@ components: id: type: string description: The ID of the newly created quote + AcceptQuoteRequest: type: object required: @@ -7538,9 +6953,9 @@ components: accepted_side: type: string description: The side of the quote to accept (yes or no) - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] + + # Order schemas GetOrderResponse: type: object required: @@ -7548,6 +6963,7 @@ components: properties: order: $ref: '#/components/schemas/Order' + CreateOrderRequest: type: object required: @@ -7564,33 +6980,25 @@ components: x-go-type-skip-optional-pointer: true side: type: string - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] x-oapi-codegen-extra-tags: validate: required,oneof=yes no action: type: string - enum: - - buy - - sell + enum: ['buy', 'sell'] x-oapi-codegen-extra-tags: validate: required,oneof=buy sell count: type: integer minimum: 1 - description: >- - Order quantity in contracts (whole contracts only). Provide count or - count_fp; if both provided they must match. + description: Order quantity in contracts (whole contracts only). Provide count or count_fp; if both provided they must match. x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: validate: omitempty,gte=1 count_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the order quantity in contracts. Provide - count or count_fp; if both provided they must match. + description: String representation of the order quantity in contracts. Provide count or count_fp; if both provided they must match. yes_price: type: integer minimum: 1 @@ -7610,50 +7018,33 @@ components: expiration_ts: type: integer format: int64 - description: > - Optional Unix timestamp in seconds for when the order expires. To - place - + description: | + Optional Unix timestamp in seconds for when the order expires. To place an expiring order, set `time_in_force` to `good_till_canceled` and - - provide this `expiration_ts`. `GTT` is an internal execution type - and is - + provide this `expiration_ts`. `GTT` is an internal execution type and is not a valid API value for `time_in_force`. The `immediate_or_cancel` - time-in-force value cannot be combined with `expiration_ts`. time_in_force: type: string - description: > - Specifies how long the order remains active. Use - `good_till_canceled` - + description: | + Specifies how long the order remains active. Use `good_till_canceled` with `expiration_ts` for an order that should rest until a specific - expiration time; without `expiration_ts`, `good_till_canceled` is a - true good-till-canceled order. `GTT` is not a valid API value. - enum: - - fill_or_kill - - good_till_canceled - - immediate_or_cancel + enum: ['fill_or_kill', 'good_till_canceled', 'immediate_or_cancel'] x-oapi-codegen-extra-tags: - validate: >- - omitempty,oneof=fill_or_kill good_till_canceled - immediate_or_cancel + validate: omitempty,oneof=fill_or_kill good_till_canceled immediate_or_cancel x-go-type-skip-optional-pointer: true buy_max_cost: type: integer - description: >- - Maximum cost in cents. When specified, the order will automatically - have Fill-or-Kill (FoK) behavior. + description: Maximum cost in cents. When specified, the order will automatically have Fill-or-Kill (FoK) behavior. post_only: type: boolean reduce_only: type: boolean sell_position_floor: type: integer - description: 'Deprecated: Use reduce_only instead. Only accepts value of 0.' + description: "Deprecated: Use reduce_only instead. Only accepts value of 0." self_trade_prevention_type: allOf: - $ref: '#/components/schemas/SelfTradePreventionType' @@ -7666,25 +7057,20 @@ components: x-go-type-skip-optional-pointer: true cancel_order_on_pause: type: boolean - description: >- - If this flag is set to true, the order will be canceled if the order - is open and trading on the exchange is paused for any reason. + description: If this flag is set to true, the order will be canceled if the order is open and trading on the exchange is paused for any reason. subaccount: type: integer minimum: 0 default: 0 - description: >- - The subaccount number to use for this order. 0 is the primary - subaccount. + description: The subaccount number to use for this order. 0 is the primary subaccount. x-go-type-skip-optional-pointer: true exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 - description: >- - Exchange shard index. Defaults to 0. Use -1 to auto-route by market - ticker. + description: "Exchange shard index. Defaults to 0. Use -1 to auto-route by market ticker." x-go-type-skip-optional-pointer: true + CreateOrderResponse: type: object required: @@ -7692,6 +7078,7 @@ components: properties: order: $ref: '#/components/schemas/Order' + BatchCreateOrdersRequest: type: object required: @@ -7703,6 +7090,7 @@ components: validate: required,dive items: $ref: '#/components/schemas/CreateOrderRequest' + BatchCreateOrdersResponse: type: object required: @@ -7712,6 +7100,7 @@ components: type: array items: $ref: '#/components/schemas/BatchCreateOrdersIndividualResponse' + BatchCreateOrdersIndividualResponse: type: object properties: @@ -7720,12 +7109,13 @@ components: nullable: true order: allOf: - - $ref: '#/components/schemas/Order' + - $ref: '#/components/schemas/Order' nullable: true error: allOf: - - $ref: '#/components/schemas/ErrorResponse' + - $ref: '#/components/schemas/ErrorResponse' nullable: true + BatchCancelOrdersRequest: type: object properties: @@ -7739,9 +7129,8 @@ components: type: array items: $ref: '#/components/schemas/BatchCancelOrdersRequestOrder' - description: >- - An array of orders to cancel, each optionally specifying a - subaccount + description: An array of orders to cancel, each optionally specifying a subaccount + BatchCancelOrdersRequestOrder: type: object required: @@ -7754,22 +7143,19 @@ components: type: integer minimum: 0 default: 0 - description: >- - Optional subaccount number to use for this cancellation (0 for - primary, 1-63 for subaccounts) + description: Optional subaccount number to use for this cancellation (0 for primary, 1-63 for subaccounts) x-go-type-skip-optional-pointer: true exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 - description: >- - Exchange shard index. Defaults to 0. Use -1 to auto-route by market - ticker. + description: "Exchange shard index. Defaults to 0. Use -1 to auto-route by market ticker." x-go-type-skip-optional-pointer: true market_ticker: type: string description: Market ticker. Required when exchange_index is -1 (auto). x-go-type-skip-optional-pointer: true + BatchCancelOrdersResponse: type: object required: @@ -7779,6 +7165,7 @@ components: type: array items: $ref: '#/components/schemas/BatchCancelOrdersIndividualResponse' + BatchCancelOrdersIndividualResponse: type: object required: @@ -7787,22 +7174,19 @@ components: properties: order_id: type: string - description: >- - The order ID to identify which order had an error during batch - cancellation + description: The order ID to identify which order had an error during batch cancellation order: allOf: - $ref: '#/components/schemas/Order' nullable: true reduced_by_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts that were - successfully canceled from this order + description: String representation of the number of contracts that were successfully canceled from this order error: allOf: - $ref: '#/components/schemas/ErrorResponse' nullable: true + AmendOrderRequest: type: object required: @@ -7813,9 +7197,7 @@ components: subaccount: type: integer minimum: 0 - description: >- - Optional subaccount number to use for this amendment (0 for primary, - 1-63 for subaccounts) + description: Optional subaccount number to use for this amendment (0 for primary, 1-63 for subaccounts) default: 0 x-go-type-skip-optional-pointer: true ticker: @@ -7823,15 +7205,11 @@ components: description: Market ticker side: type: string - enum: - - 'yes' - - 'no' + enum: ["yes", "no"] description: Side of the order action: type: string - enum: - - buy - - sell + enum: ["buy", "sell"] description: Action of the order client_order_id: type: string @@ -7853,38 +7231,25 @@ components: description: Updated no price for the order in cents yes_price_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Updated yes price for the order in fixed-point dollars. Exactly one - of yes_price, no_price, yes_price_dollars, and no_price_dollars must - be passed. + description: Updated yes price for the order in fixed-point dollars. Exactly one of yes_price, no_price, yes_price_dollars, and no_price_dollars must be passed. no_price_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Updated no price for the order in fixed-point dollars. Exactly one - of yes_price, no_price, yes_price_dollars, and no_price_dollars must - be passed. + description: Updated no price for the order in fixed-point dollars. Exactly one of yes_price, no_price, yes_price_dollars, and no_price_dollars must be passed. count: type: integer minimum: 1 - description: >- - Updated quantity for the order (whole contracts only). If updating - quantity, provide count or count_fp; if both provided they must - match. + description: Updated quantity for the order (whole contracts only). If updating quantity, provide count or count_fp; if both provided they must match. count_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the updated quantity for the order. If - updating quantity, provide count or count_fp; if both provided they - must match. + description: String representation of the updated quantity for the order. If updating quantity, provide count or count_fp; if both provided they must match. exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 - description: >- - Exchange shard index. Defaults to 0. Use -1 to auto-route by market - ticker. + description: "Exchange shard index. Defaults to 0. Use -1 to auto-route by market ticker." x-go-type-skip-optional-pointer: true + AmendOrderResponse: type: object required: @@ -7897,6 +7262,7 @@ components: order: $ref: '#/components/schemas/Order' description: The order after amendment + CreateOrderV2Request: type: object required: @@ -7910,8 +7276,8 @@ components: ticker: HIGHNY-24JAN01-T60 client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 side: bid - count: '10.00' - price: '0.5600' + count: "10.00" + price: "0.5600" time_in_force: good_till_canceled self_trade_prevention_type: taker_at_cross post_only: false @@ -7941,37 +7307,21 @@ components: expiration_time: type: integer format: int64 - description: > - Optional Unix timestamp in seconds for when the order expires. To - place - + description: | + Optional Unix timestamp in seconds for when the order expires. To place an expiring order, set `time_in_force` to `good_till_canceled` and - - provide this `expiration_time`. `GTT` is an internal execution type - and - + provide this `expiration_time`. `GTT` is an internal execution type and is not a valid API value for `time_in_force`. The - `immediate_or_cancel` time-in-force value cannot be combined with - `expiration_time`. time_in_force: type: string - description: > - Specifies how long the order remains active. Use - `good_till_canceled` - - with `expiration_time` for an order that should rest until a - specific - - expiration time; without `expiration_time`, `good_till_canceled` is - a - + description: | + Specifies how long the order remains active. Use `good_till_canceled` + with `expiration_time` for an order that should rest until a specific + expiration time; without `expiration_time`, `good_till_canceled` is a true good-till-canceled order. `GTT` is not a valid API value. - enum: - - fill_or_kill - - good_till_canceled - - immediate_or_cancel + enum: ['fill_or_kill', 'good_till_canceled', 'immediate_or_cancel'] x-oapi-codegen-extra-tags: validate: required,oneof=fill_or_kill good_till_canceled immediate_or_cancel x-go-type-skip-optional-pointer: true @@ -7985,21 +7335,14 @@ components: x-go-type-skip-optional-pointer: true cancel_order_on_pause: type: boolean - description: >- - If this flag is set to true, the order will be canceled if the order - is open and trading on the exchange is paused for any reason. + description: If this flag is set to true, the order will be canceled if the order is open and trading on the exchange is paused for any reason. reduce_only: type: boolean - description: >- - Specifies whether the order place count should be capped by the - member's current position. + description: Specifies whether the order place count should be capped by the member's current position. subaccount: type: integer minimum: 0 - description: >- - The subaccount number to use for this order. 0 is the primary - subaccount. Subaccount-restricted API keys must omit this field or - pass their locked subaccount. + description: The subaccount number to use for this order. 0 is the primary subaccount. Subaccount-restricted API keys must omit this field or pass their locked subaccount. order_group_id: type: string description: The order group this order is part of @@ -8008,10 +7351,9 @@ components: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 - description: >- - Exchange shard index. Defaults to 0. Use -1 to auto-route by market - ticker. + description: "Exchange shard index. Defaults to 0. Use -1 to auto-route by market ticker." x-go-type-skip-optional-pointer: true + CreateOrderV2Response: type: object required: @@ -8022,8 +7364,8 @@ components: example: order_id: 3b23c1c7-f4ef-4f0d-8b9a-9e53c61f1a0d client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 - fill_count: '0.00' - remaining_count: '10.00' + fill_count: "0.00" + remaining_count: "10.00" ts_ms: 1715793600123 properties: order_id: @@ -8035,25 +7377,18 @@ components: description: Number of contracts filled immediately upon placement. remaining_count: $ref: '#/components/schemas/FixedPointCount' - description: >- - Number of contracts remaining after placement. For IOC orders, this - reflects the final state after unfilled contracts are canceled. + description: Number of contracts remaining after placement. For IOC orders, this reflects the final state after unfilled contracts are canceled. average_fill_price: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Volume-weighted average fill price. Only present when fill_count > - 0. + description: Volume-weighted average fill price. Only present when fill_count > 0. average_fee_paid: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Volume-weighted average fee paid per contract for fills resulting - from this request. Only present when fill_count > 0. + description: Volume-weighted average fee paid per contract for fills resulting from this request. Only present when fill_count > 0. ts_ms: type: integer format: int64 - description: >- - Matching engine timestamp at which the order was processed, as Unix - epoch milliseconds. + description: Matching engine timestamp at which the order was processed, as Unix epoch milliseconds. + CancelOrderV2Response: type: object required: @@ -8063,7 +7398,7 @@ components: example: order_id: 3b23c1c7-f4ef-4f0d-8b9a-9e53c61f1a0d client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 - reduced_by: '10.00' + reduced_by: "10.00" ts_ms: 1715793660456 properties: order_id: @@ -8072,33 +7407,26 @@ components: type: string reduced_by: $ref: '#/components/schemas/FixedPointCount' - description: >- - Number of contracts that were canceled (i.e. the remaining count at - time of cancellation). + description: Number of contracts that were canceled (i.e. the remaining count at time of cancellation). ts_ms: type: integer format: int64 - description: >- - Matching engine timestamp at which the cancellation was processed, - as Unix epoch milliseconds. + description: Matching engine timestamp at which the cancellation was processed, as Unix epoch milliseconds. + DecreaseOrderV2Request: type: object example: - reduce_by: '2.00' + reduce_by: "2.00" exchange_index: 0 properties: reduce_by: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the number of contracts to reduce by. - Exactly one of `reduce_by` or `reduce_to` must be provided. + description: String representation of the number of contracts to reduce by. Exactly one of `reduce_by` or `reduce_to` must be provided. reduce_to: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the number of contracts to reduce to. - Exactly one of `reduce_by` or `reduce_to` must be provided. + description: String representation of the number of contracts to reduce to. Exactly one of `reduce_by` or `reduce_to` must be provided. exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' @@ -8108,6 +7436,7 @@ components: type: string description: Market ticker. Required when exchange_index is -1 (auto). x-go-type-skip-optional-pointer: true + DecreaseOrderV2Response: type: object required: @@ -8117,7 +7446,7 @@ components: example: order_id: 3b23c1c7-f4ef-4f0d-8b9a-9e53c61f1a0d client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 - remaining_count: '8.00' + remaining_count: "8.00" ts_ms: 1715793680789 properties: order_id: @@ -8130,9 +7459,8 @@ components: ts_ms: type: integer format: int64 - description: >- - Matching engine timestamp at which the decrease was processed, as - Unix epoch milliseconds. + description: Matching engine timestamp at which the decrease was processed, as Unix epoch milliseconds. + AmendOrderV2Request: type: object required: @@ -8143,8 +7471,8 @@ components: example: ticker: HIGHNY-24JAN01-T60 side: bid - price: '0.5700' - count: '8.00' + price: "0.5700" + count: "8.00" client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 updated_client_order_id: 2a0e3fc9-b593-4aa3-96e5-82f7f7566c2a exchange_index: 0 @@ -8165,10 +7493,7 @@ components: x-go-type-skip-optional-pointer: true count: $ref: '#/components/schemas/FixedPointCount' - description: >- - Updated total/max fillable count for the order. Set this to the - order's already filled count plus the desired resting remaining - count after the amend. + description: Updated total/max fillable count for the order. Set this to the order's already filled count plus the desired resting remaining count after the amend. x-go-type-skip-optional-pointer: true client_order_id: type: string @@ -8182,10 +7507,9 @@ components: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 - description: >- - Exchange shard index. Defaults to 0. Use -1 to auto-route by market - ticker. + description: "Exchange shard index. Defaults to 0. Use -1 to auto-route by market ticker." x-go-type-skip-optional-pointer: true + AmendOrderV2Response: type: object required: @@ -8194,8 +7518,8 @@ components: example: order_id: 3b23c1c7-f4ef-4f0d-8b9a-9e53c61f1a0d client_order_id: 2a0e3fc9-b593-4aa3-96e5-82f7f7566c2a - remaining_count: '8.00' - fill_count: '0.00' + remaining_count: "8.00" + fill_count: "0.00" ts_ms: 1715793690123 properties: order_id: @@ -8206,38 +7530,27 @@ components: $ref: '#/components/schemas/FixedPointCount' nullable: true x-omitempty: false - description: >- - Number of resting contracts remaining after the amend. This is the - actual post-amend resting quantity, not the request's total/max - fillable count. Only present when the amend caused a fill or changed - the resting size. + description: Number of resting contracts remaining after the amend. This is the actual post-amend resting quantity, not the request's total/max fillable count. Only present when the amend caused a fill or changed the resting size. fill_count: $ref: '#/components/schemas/FixedPointCount' nullable: true x-omitempty: false - description: >- - Number of contracts filled as a result of the amend crossing the - book. Only present when fills occurred or remaining size changed. + description: Number of contracts filled as a result of the amend crossing the book. Only present when fills occurred or remaining size changed. average_fill_price: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: false - description: >- - Volume-weighted average fill price for fills resulting from the - amend. Only present when fills occurred. + description: Volume-weighted average fill price for fills resulting from the amend. Only present when fills occurred. average_fee_paid: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: false - description: >- - Volume-weighted average fee paid per contract for fills resulting - from the amend. Only present when fills occurred. + description: Volume-weighted average fee paid per contract for fills resulting from the amend. Only present when fills occurred. ts_ms: type: integer format: int64 - description: >- - Matching engine timestamp at which the amend was processed, as Unix - epoch milliseconds. + description: Matching engine timestamp at which the amend was processed, as Unix epoch milliseconds. + BatchCreateOrdersV2Request: type: object required: @@ -8247,16 +7560,16 @@ components: - ticker: HIGHNY-24JAN01-T60 client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 side: bid - count: '10.00' - price: '0.5600' + count: "10.00" + price: "0.5600" time_in_force: good_till_canceled self_trade_prevention_type: taker_at_cross exchange_index: 0 - ticker: HIGHNY-24JAN01-T60 client_order_id: 2a0e3fc9-b593-4aa3-96e5-82f7f7566c2a side: ask - count: '5.00' - price: '0.5800' + count: "5.00" + price: "0.5800" time_in_force: immediate_or_cancel self_trade_prevention_type: maker exchange_index: 0 @@ -8267,6 +7580,7 @@ components: validate: required,dive items: $ref: '#/components/schemas/CreateOrderV2Request' + BatchCreateOrdersV2Response: type: object required: @@ -8275,15 +7589,15 @@ components: orders: - order_id: 3b23c1c7-f4ef-4f0d-8b9a-9e53c61f1a0d client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 - fill_count: '0.00' - remaining_count: '10.00' + fill_count: "0.00" + remaining_count: "10.00" ts_ms: 1715793600123 - order_id: a6d6010d-6d5f-40a1-a7e7-5501386bb621 client_order_id: 2a0e3fc9-b593-4aa3-96e5-82f7f7566c2a - fill_count: '5.00' - remaining_count: '0.00' - average_fill_price: '0.5800' - average_fee_paid: '0.0012' + fill_count: "5.00" + remaining_count: "0.00" + average_fill_price: "0.5800" + average_fee_paid: "0.0012" ts_ms: 1715793600456 properties: orders: @@ -8310,28 +7624,23 @@ components: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: false - description: >- - Volume-weighted average fill price. Only present when - fill_count > 0. + description: Volume-weighted average fill price. Only present when fill_count > 0. average_fee_paid: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: false - description: >- - Volume-weighted average fee paid per contract. Only present - when fill_count > 0. + description: Volume-weighted average fee paid per contract. Only present when fill_count > 0. ts_ms: type: integer format: int64 nullable: true x-omitempty: false - description: >- - Matching engine timestamp at which the order was processed, as - Unix epoch milliseconds. Absent when the request errored. + description: Matching engine timestamp at which the order was processed, as Unix epoch milliseconds. Absent when the request errored. error: allOf: - $ref: '#/components/schemas/ErrorResponse' nullable: true + BatchCancelOrdersV2Request: type: object required: @@ -8349,9 +7658,7 @@ components: type: array x-oapi-codegen-extra-tags: validate: required,dive - description: >- - An array of orders to cancel, each optionally specifying a - subaccount. + description: An array of orders to cancel, each optionally specifying a subaccount. items: type: object required: @@ -8363,22 +7670,18 @@ components: subaccount: type: integer minimum: 0 - description: >- - Optional subaccount number to use for this cancellation (0 for - primary, 1-63 for subaccounts). Subaccount-restricted API keys - must omit this field or pass their locked subaccount. + description: Optional subaccount number to use for this cancellation (0 for primary, 1-63 for subaccounts). Subaccount-restricted API keys must omit this field or pass their locked subaccount. exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 - description: >- - Exchange shard index. Defaults to 0. Use -1 to auto-route by - market ticker. + description: "Exchange shard index. Defaults to 0. Use -1 to auto-route by market ticker." x-go-type-skip-optional-pointer: true market_ticker: type: string description: Market ticker. Required when exchange_index is -1 (auto). x-go-type-skip-optional-pointer: true + BatchCancelOrdersV2Response: type: object required: @@ -8387,11 +7690,11 @@ components: orders: - order_id: 3b23c1c7-f4ef-4f0d-8b9a-9e53c61f1a0d client_order_id: 8c35ecb3-328f-4f52-8c7c-0f4b9862f8d1 - reduced_by: '10.00' + reduced_by: "10.00" ts_ms: 1715793660456 - order_id: a6d6010d-6d5f-40a1-a7e7-5501386bb621 client_order_id: 2a0e3fc9-b593-4aa3-96e5-82f7f7566c2a - reduced_by: '5.00' + reduced_by: "5.00" ts_ms: 1715793660789 properties: orders: @@ -8404,30 +7707,25 @@ components: properties: order_id: type: string - description: >- - The order ID identifying which order this entry corresponds - to. + description: The order ID identifying which order this entry corresponds to. client_order_id: type: string nullable: true reduced_by: $ref: '#/components/schemas/FixedPointCount' - description: >- - Number of contracts that were canceled (i.e. the remaining - count at time of cancellation). Zero if the cancel errored. + description: Number of contracts that were canceled (i.e. the remaining count at time of cancellation). Zero if the cancel errored. ts_ms: type: integer format: int64 nullable: true x-omitempty: false - description: >- - Matching engine timestamp at which the cancellation was - processed, as Unix epoch milliseconds. Absent when the cancel - errored. + description: Matching engine timestamp at which the cancellation was processed, as Unix epoch milliseconds. Absent when the cancel errored. error: allOf: - $ref: '#/components/schemas/ErrorResponse' nullable: true + + # Multivariate Event Collection schemas AssociatedEvent: type: object required: @@ -8445,21 +7743,18 @@ components: type: integer format: int32 nullable: true - description: >- - Maximum number of markets from this event (inclusive). Null means no - limit. + description: Maximum number of markets from this event (inclusive). Null means no limit. size_min: type: integer format: int32 nullable: true - description: >- - Minimum number of markets from this event (inclusive). Null means no - limit. + description: Minimum number of markets from this event (inclusive). Null means no limit. active_quoters: type: array items: type: string description: List of active quoters for this event. + MultivariateEventCollection: type: object required: @@ -8483,9 +7778,7 @@ components: description: Unique identifier for the collection. series_ticker: type: string - description: >- - Series associated with the collection. Events produced in the - collection will be associated with this series. + description: Series associated with the collection. Events produced in the collection will be associated with this series. exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' @@ -8501,15 +7794,11 @@ components: open_date: type: string format: date-time - description: >- - The open date of the collection. Before this time, the collection - cannot be interacted with. + description: The open date of the collection. Before this time, the collection cannot be interacted with. close_date: type: string format: date-time - description: >- - The close date of the collection. After this time, the collection - cannot be interacted with. + description: The close date of the collection. After this time, the collection cannot be interacted with. associated_events: type: array items: @@ -8519,44 +7808,28 @@ components: type: array items: type: string - description: >- - [DEPRECATED - Use associated_events instead] A list of events - associated with the collection. Markets in these events can be - passed as inputs to the Lookup and Create endpoints. + description: '[DEPRECATED - Use associated_events instead] A list of events associated with the collection. Markets in these events can be passed as inputs to the Lookup and Create endpoints.' is_ordered: type: boolean - description: >- - Whether the collection is ordered. If true, the order of markets - passed into Lookup/Create affects the output. If false, the order - does not matter. + description: Whether the collection is ordered. If true, the order of markets passed into Lookup/Create affects the output. If false, the order does not matter. is_single_market_per_event: type: boolean - description: >- - [DEPRECATED - Use associated_events instead] Whether the collection - accepts multiple markets from the same event passed into - Lookup/Create. + description: '[DEPRECATED - Use associated_events instead] Whether the collection accepts multiple markets from the same event passed into Lookup/Create.' is_all_yes: type: boolean - description: >- - [DEPRECATED - Use associated_events instead] Whether the collection - requires that only the market side of 'yes' may be used. + description: '[DEPRECATED - Use associated_events instead] Whether the collection requires that only the market side of ''yes'' may be used.' size_min: type: integer format: int32 - description: >- - The minimum number of markets that must be passed into Lookup/Create - (inclusive). + description: The minimum number of markets that must be passed into Lookup/Create (inclusive). size_max: type: integer format: int32 - description: >- - The maximum number of markets that must be passed into Lookup/Create - (inclusive). + description: The maximum number of markets that must be passed into Lookup/Create (inclusive). functional_description: type: string - description: >- - A functional description of the collection describing how inputs - affect the output. + description: A functional description of the collection describing how inputs affect the output. + GetMultivariateEventCollectionResponse: type: object required: @@ -8565,6 +7838,7 @@ components: multivariate_contract: $ref: '#/components/schemas/MultivariateEventCollection' description: The multivariate event collection. + GetMultivariateEventCollectionsResponse: type: object required: @@ -8577,13 +7851,9 @@ components: description: List of multivariate event collections. cursor: type: string - description: >- - The Cursor represents a pointer to the next page of records in the - pagination. Use the value returned here in the cursor query - parameter for this end-point to get the next page containing limit - records. An empty value of this field indicates there is no next - page. + description: The Cursor represents a pointer to the next page of records in the pagination. Use the value returned here in the cursor query parameter for this end-point to get the next page containing limit records. An empty value of this field indicates there is no next page. x-go-type-skip-optional-pointer: true + TickerPair: type: object required: @@ -8599,12 +7869,11 @@ components: description: Event ticker identifier. side: type: string - enum: - - 'yes' - - 'no' + enum: ['yes', 'no'] description: Side of the market (yes or no). x-oapi-codegen-extra-tags: validate: required,oneof=yes no + CreateMarketInMultivariateEventCollectionRequest: type: object required: @@ -8614,14 +7883,13 @@ components: type: array items: $ref: '#/components/schemas/TickerPair' - description: >- - List of selected markets that act as parameters to determine which - market is created. + description: List of selected markets that act as parameters to determine which market is created. x-oapi-codegen-extra-tags: validate: required,dive with_market_payload: type: boolean description: Whether to include the market payload in the response. + CreateMarketInMultivariateEventCollectionResponse: type: object required: @@ -8637,20 +7905,16 @@ components: market: $ref: '#/components/schemas/Market' description: Market payload of the created market. + # Market Orderbook schemas PriceLevelDollarsCountFp: type: array minItems: 2 maxItems: 2 - example: - - '0.1500' - - '100.00' + example: ["0.1500", "100.00"] items: type: string - description: >- - Price level in dollars represented as [dollars_string, fp] where - dollars_string is like "0.1500" and fp is a FixedPointCount string - (fixed-point contract count). The second element is the contract - quantity (not price). + description: Price level in dollars represented as [dollars_string, fp] where dollars_string is like "0.1500" and fp is a FixedPointCount string (fixed-point contract count). The second element is the contract quantity (not price). + OrderbookCountFp: type: object required: @@ -8665,9 +7929,8 @@ components: type: array items: $ref: '#/components/schemas/PriceLevelDollarsCountFp' - description: >- - Orderbook with fixed-point contract counts (fp) in all dollar price - levels. + description: Orderbook with fixed-point contract counts (fp) in all dollar price levels. + GetMarketOrderbooksResponse: type: object required: @@ -8677,6 +7940,7 @@ components: type: array items: $ref: '#/components/schemas/MarketOrderbookFp' + MarketOrderbookFp: type: object required: @@ -8687,6 +7951,7 @@ components: type: string orderbook_fp: $ref: '#/components/schemas/OrderbookCountFp' + GetMarketOrderbookResponse: type: object required: @@ -8695,6 +7960,7 @@ components: orderbook_fp: $ref: '#/components/schemas/OrderbookCountFp' description: Orderbook with fixed-point contract counts (fp) in all price levels. + GetEventsResponse: type: object required: @@ -8713,9 +7979,8 @@ components: $ref: '#/components/schemas/Milestone' cursor: type: string - description: >- - Pagination cursor for the next page. Empty if there are no more - results. + description: Pagination cursor for the next page. Empty if there are no more results. + GetMultivariateEventsResponse: type: object required: @@ -8729,9 +7994,8 @@ components: $ref: '#/components/schemas/EventData' cursor: type: string - description: >- - Pagination cursor for the next page. Empty if there are no more - results. + description: Pagination cursor for the next page. Empty if there are no more results. + EventFeeChange: type: object required: @@ -8756,21 +8020,17 @@ components: - $ref: '#/components/schemas/FeeType' nullable: true example: quadratic - description: >- - New fee type override for the event. When null, the event clears any - prior override and falls back to the parent series' fee structure. + description: New fee type override for the event. When null, the event clears any prior override and falls back to the parent series' fee structure. fee_multiplier_override: type: number format: double nullable: true - description: >- - New fee multiplier override for the event. When null, the event - clears any prior override and falls back to the parent series' fee - multiplier. + description: New fee multiplier override for the event. When null, the event clears any prior override and falls back to the parent series' fee multiplier. scheduled_ts: type: string format: date-time description: Timestamp when this fee change is scheduled to take effect + GetEventFeeChangesResponse: type: object required: @@ -8783,9 +8043,8 @@ components: $ref: '#/components/schemas/EventFeeChange' cursor: type: string - description: >- - Pagination cursor for the next page. Empty if there are no more - results. + description: Pagination cursor for the next page. Empty if there are no more results. + GetEventResponse: type: object required: @@ -8797,13 +8056,10 @@ components: description: Data for the event. markets: type: array - description: >- - Data for the markets in this event. This field is deprecated in - favour of the "markets" field inside the event. Which will be filled - with the same value if you use the query parameter - "with_nested_markets=true". + description: Data for the markets in this event. This field is deprecated in favour of the "markets" field inside the event. Which will be filled with the same value if you use the query parameter "with_nested_markets=true". items: $ref: '#/components/schemas/Market' + MarketMetadata: type: object required: @@ -8820,6 +8076,7 @@ components: color_code: type: string description: The color code for the market. + GetEventMetadataResponse: type: object required: @@ -8855,6 +8112,7 @@ components: x-omitempty: true description: Event scope, based on the competition. x-go-type-skip-optional-pointer: true + GetEventForecastPercentilesHistoryResponse: type: object required: @@ -8865,6 +8123,7 @@ components: description: Array of forecast percentile data points over time. items: $ref: '#/components/schemas/ForecastPercentilesPoint' + ForecastPercentilesPoint: type: object required: @@ -8889,6 +8148,7 @@ components: description: Array of forecast values at different percentiles. items: $ref: '#/components/schemas/PercentilePoint' + PercentilePoint: type: object required: @@ -8910,6 +8170,7 @@ components: formatted_forecast: type: string description: The human-readable formatted forecast value. + EventData: type: object required: @@ -8936,14 +8197,10 @@ components: description: Full title of the event. collateral_return_type: type: string - description: >- - Specifies how collateral is returned when markets settle (e.g., - 'binary' for standard yes/no markets). + description: Specifies how collateral is returned when markets settle (e.g., 'binary' for standard yes/no markets). mutually_exclusive: type: boolean - description: >- - If true, only one market in this event can resolve to 'yes'. If - false, multiple markets can resolve to 'yes'. + description: If true, only one market in this event can resolve to 'yes'. If false, multiple markets can resolve to 'yes'. category: type: string description: Event category (deprecated, use series-level category instead). @@ -8954,23 +8211,16 @@ components: format: date-time nullable: true x-omitempty: true - description: >- - The specific date this event is based on. Only filled when the event - uses a date strike (mutually exclusive with strike_period). + description: The specific date this event is based on. Only filled when the event uses a date strike (mutually exclusive with strike_period). strike_period: type: string nullable: true x-omitempty: true - description: >- - The time period this event covers (e.g., 'week', 'month'). Only - filled when the event uses a period strike (mutually exclusive with - strike_date). + description: The time period this event covers (e.g., 'week', 'month'). Only filled when the event uses a period strike (mutually exclusive with strike_date). markets: type: array x-omitempty: true - description: >- - Array of markets associated with this event. Only populated when - 'with_nested_markets=true' is specified in the request. + description: Array of markets associated with this event. Only populated when 'with_nested_markets=true' is specified in the request. items: $ref: '#/components/schemas/Market' x-go-type-skip-optional-pointer: true @@ -8988,9 +8238,7 @@ components: nullable: true items: $ref: '#/components/schemas/SettlementSource' - description: >- - The official sources used for the determination of markets within - this event. Methodology is defined in the rulebook. + description: The official sources used for the determination of markets within this event. Methodology is defined in the rulebook. last_updated_ts: type: string format: date-time @@ -8999,22 +8247,19 @@ components: type: string nullable: true x-omitempty: true - description: >- - Fee type override for this event. When present, takes precedence - over the series-level fee for this event's markets. + description: Fee type override for this event. When present, takes precedence over the series-level fee for this event's markets. fee_multiplier_override: type: number format: double nullable: true x-omitempty: true - description: >- - Fee multiplier override for this event. Paired with - fee_type_override. + description: Fee multiplier override for this event. Paired with fee_type_override. exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true x-omitempty: false + Series: type: object required: @@ -9035,16 +8280,10 @@ components: description: Ticker that identifies this series. frequency: type: string - description: >- - Description of the frequency of the series. There is no fixed value - set here, but will be something human-readable like weekly, daily, - one-off. + description: Description of the frequency of the series. There is no fixed value set here, but will be something human-readable like weekly, daily, one-off. title: type: string - description: >- - Title describing the series. For full context use you should use - this field with the title field of the events belonging to this - series. + description: Title describing the series. For full context use you should use this field with the title field of the events belonging to this series. category: type: string description: Category specifies the category which this series belongs to. @@ -9053,28 +8292,19 @@ components: nullable: true items: type: string - description: >- - Tags specifies the subjects that this series relates to, multiple - series from different categories can have the same tags. + description: Tags specifies the subjects that this series relates to, multiple series from different categories can have the same tags. settlement_sources: type: array nullable: true items: $ref: '#/components/schemas/SettlementSource' - description: >- - SettlementSources specifies the official sources used for the - determination of markets within the series. Methodology is defined - in the rulebook. + description: SettlementSources specifies the official sources used for the determination of markets within the series. Methodology is defined in the rulebook. contract_url: type: string - description: >- - ContractUrl provides a direct link to the original filing of the - contract which underlies the series. + description: ContractUrl provides a direct link to the original filing of the contract which underlies the series. contract_terms_url: type: string - description: >- - ContractTermsUrl is the URL to the current terms of the contract - underlying the series. + description: ContractTermsUrl is the URL to the current terms of the contract underlying the series. product_metadata: type: object nullable: true @@ -9083,33 +8313,20 @@ components: fee_type: allOf: - $ref: '#/components/schemas/FeeType' - description: >- - FeeType is a string representing the series' fee structure. Fee - structures can be found at - https://kalshi.com/docs/kalshi-fee-schedule.pdf. 'quadratic' is - described by the General Trading Fees Table, - 'quadratic_with_maker_fees' is described by the General Trading Fees - Table with maker fees described in the Maker Fees section, 'flat' is - described by the Specific Trading Fees Table. + description: "FeeType is a string representing the series' fee structure. Fee structures can be found at https://kalshi.com/docs/kalshi-fee-schedule.pdf. 'quadratic' is described by the General Trading Fees Table, 'quadratic_with_maker_fees' is described by the General Trading Fees Table with maker fees described in the Maker Fees section, 'flat' is described by the Specific Trading Fees Table." fee_multiplier: type: number format: double - description: >- - FeeMultiplier is a floating point multiplier applied to the fee - calculations. + description: FeeMultiplier is a floating point multiplier applied to the fee calculations. additional_prohibitions: type: array nullable: true items: type: string - description: >- - AdditionalProhibitions is a list of additional trading prohibitions - for this series. + description: AdditionalProhibitions is a list of additional trading prohibitions for this series. volume_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the total number of contracts traded across - all events in this series. + description: String representation of the total number of contracts traded across all events in this series. last_updated_ts: type: string format: date-time @@ -9119,6 +8336,7 @@ components: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true x-omitempty: false + SeriesFeeChange: type: object required: @@ -9146,6 +8364,7 @@ components: type: string format: date-time description: Timestamp when this fee change is scheduled to take effect + GetSeriesResponse: type: object required: @@ -9153,6 +8372,7 @@ components: properties: series: $ref: '#/components/schemas/Series' + GetSeriesListResponse: type: object required: @@ -9162,6 +8382,7 @@ components: type: array items: $ref: '#/components/schemas/Series' + GetSeriesFeeChangesResponse: type: object required: @@ -9171,6 +8392,7 @@ components: type: array items: $ref: '#/components/schemas/SeriesFeeChange' + SettlementSource: type: object properties: @@ -9182,6 +8404,7 @@ components: type: string description: URL to the settlement source x-go-type-skip-optional-pointer: true + GetMarketsResponse: type: object required: @@ -9194,6 +8417,7 @@ components: $ref: '#/components/schemas/Market' cursor: type: string + GetMarketResponse: type: object required: @@ -9201,6 +8425,7 @@ components: properties: market: $ref: '#/components/schemas/Market' + MveSelectedLeg: type: object properties: @@ -9220,9 +8445,8 @@ components: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: true - description: >- - The settlement value of the YES/LONG side of the contract in - dollars. Only filled after determination + description: The settlement value of the YES/LONG side of the contract in dollars. Only filled after determination + PriceRange: type: object required: @@ -9239,6 +8463,7 @@ components: step: type: string description: Price step/tick size for this range in dollars + Market: type: object required: @@ -9282,9 +8507,7 @@ components: type: string market_type: type: string - enum: - - binary - - scalar + enum: [binary, scalar] description: Identifies the type of market title: type: string @@ -9333,32 +8556,20 @@ components: description: The amount of time after determination that the market settles status: type: string - enum: - - initialized - - inactive - - active - - closed - - determined - - disputed - - amended - - finalized + enum: [initialized, inactive, active, closed, determined, disputed, amended, finalized] description: The current status of the market in its lifecycle. yes_bid_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Price for the highest YES buy offer on this market in dollars yes_bid_size_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - Total contract size of orders to buy YES at the best bid price - (fixed-point count string). + description: Total contract size of orders to buy YES at the best bid price (fixed-point count string). yes_ask_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Price for the lowest YES sell offer on this market in dollars yes_ask_size_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - Total contract size of orders to sell YES at the best ask price - (fixed-point count string). + description: Total contract size of orders to sell YES at the best ask price (fixed-point count string). no_bid_dollars: $ref: '#/components/schemas/FixedPointDollars' description: Price for the highest NO buy offer on this market in dollars @@ -9376,59 +8587,41 @@ components: description: String representation of the 24h market volume in contracts result: type: string - enum: - - 'yes' - - 'no' - - scalar - - '' + enum: ['yes', 'no', 'scalar', ''] can_close_early: type: boolean open_interest_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the number of contracts bought on this - market disconsidering netting + description: String representation of the number of contracts bought on this market disconsidering netting notional_value_dollars: $ref: '#/components/schemas/FixedPointDollars' description: The total value of a single contract at settlement in dollars previous_yes_bid_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Price for the highest YES buy offer on this market a day ago in - dollars + description: Price for the highest YES buy offer on this market a day ago in dollars previous_yes_ask_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Price for the lowest YES sell offer on this market a day ago in - dollars + description: Price for the lowest YES sell offer on this market a day ago in dollars previous_price_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Price for the last traded YES contract on this market a day ago in - dollars + description: Price for the last traded YES contract on this market a day ago in dollars liquidity_dollars: allOf: - $ref: '#/components/schemas/FixedPointDollars' deprecated: true x-go-type-skip-optional-pointer: true - description: >- - DEPRECATED: This field is deprecated and will always return - "0.0000". + description: 'DEPRECATED: This field is deprecated and will always return "0.0000".' settlement_value_dollars: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: true - description: >- - The settlement value of the YES/LONG side of the contract in - dollars. Only filled after determination + description: The settlement value of the YES/LONG side of the contract in dollars. Only filled after determination settlement_ts: type: string format: date-time nullable: true x-omitempty: true - description: >- - Timestamp when the market was settled. Only filled for settled - markets + description: Timestamp when the market was settled. Only filled for settled markets expiration_value: type: string description: The value that was considered for the settlement @@ -9436,9 +8629,7 @@ components: type: string format: date-time nullable: true - description: >- - The recorded datetime when the underlying event occurred, if - available + description: The recorded datetime when the underlying event occurred, if available fee_waiver_expiration_time: type: string format: date-time @@ -9453,15 +8644,7 @@ components: x-go-type-skip-optional-pointer: true strike_type: type: string - enum: - - greater - - greater_or_equal - - less - - less_or_equal - - between - - functional - - custom - - structured + enum: [greater, greater_or_equal, less, less_or_equal, between, functional, custom, structured] x-omitempty: true description: Strike type defines how the market strike is defined and evaluated x-go-type-skip-optional-pointer: true @@ -9510,9 +8693,7 @@ components: x-omitempty: true price_level_structure: type: string - description: >- - Price level structure for this market, defining price ranges and - tick sizes + description: Price level structure for this market, defining price ranges and tick sizes price_ranges: type: array description: Valid price ranges for orders on this market @@ -9521,15 +8702,14 @@ components: is_provisional: type: boolean x-omitempty: true - description: >- - If true, the market may be removed after determination if there is - no activity on it + description: If true, the market may be removed after determination if there is no activity on it x-go-type-skip-optional-pointer: true exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true x-omitempty: false + tags: - name: api-keys description: API key management endpoints diff --git a/specs/perps_asyncapi.yaml b/specs/perps_asyncapi.yaml index 2cf06ea..36a85aa 100644 --- a/specs/perps_asyncapi.yaml +++ b/specs/perps_asyncapi.yaml @@ -2,23 +2,15 @@ asyncapi: 3.0.0 info: title: Kalshi Perps WebSocket API version: 2.0.0 - description: > - WebSocket API for receiving real-time market data notifications and updates - on Kalshi perps markets. - + description: | + WebSocket API for receiving real-time market data notifications and updates on Kalshi perps markets. Supported channels: - - `orderbook_delta` - - `ticker` - - `trade` - - `fill` - - `user_orders` - - `order_group_updates` contact: name: Kalshi Support @@ -38,6 +30,7 @@ info: description: Real-time margin market data updates - name: private description: Private/authenticated margin data channels + servers: production: host: external-api-margin-ws.kalshi.com @@ -53,7 +46,9 @@ servers: description: Demo margin WebSocket server (encrypted connection only) security: - $ref: '#/components/securitySchemes/apiKey' + defaultContentType: application/json + channels: root: address: / @@ -87,6 +82,7 @@ channels: $ref: '#/components/messages/listSubscriptionsResponse' errorResponse: $ref: '#/components/messages/errorResponse' + control_frames: address: / title: Connection Keep-Alive @@ -102,128 +98,98 @@ channels: $ref: '#/components/messages/outgoingPing' outgoingPong: $ref: '#/components/messages/outgoingPong' + orderbook_delta: address: orderbook_delta title: Orderbook Updates - description: > + description: | Real-time margin orderbook price-level changes. - Requirements: - - authenticated connection - - market specification required via `market_ticker` or `market_tickers` - - - sends `orderbook_snapshot` first, then incremental `orderbook_delta` - updates + - sends `orderbook_snapshot` first, then incremental `orderbook_delta` updates messages: orderbookSnapshot: $ref: '#/components/messages/orderbookSnapshot' orderbookDelta: $ref: '#/components/messages/orderbookDelta' + ticker: address: ticker title: Market Ticker - description: > - Margin market updates are delivered on a single channel. `ticker` messages - include - - price, top-of-book size, volume, open-interest, and optional - reference/mark prices. - - - Messages are coalesced to at most one per market per second (latest value - wins + description: | + Margin market updates are delivered on a single channel. `ticker` messages include + price, top-of-book size, volume, open-interest, and optional reference/mark prices. + Messages are coalesced to at most one per market per second (latest value wins within the window). - Requirements: - - - no additional channel-level auth beyond the authenticated WebSocket - connection - + - no additional channel-level auth beyond the authenticated WebSocket connection - market specification optional - - supports `market_ticker`/`market_tickers` messages: ticker: $ref: '#/components/messages/ticker' + trade: address: trade title: Public Trades - description: > + description: | Public notifications for executed margin trades. - Requirements: - - - no additional channel-level auth beyond the authenticated WebSocket - connection - + - no additional channel-level auth beyond the authenticated WebSocket connection - market specification optional via `market_ticker` or `market_tickers` messages: trade: $ref: '#/components/messages/trade' + fill: address: fill title: User Fills - description: > - Private fill notifications for the authenticated user on the margin - exchange. - + description: | + Private fill notifications for the authenticated user on the margin exchange. Requirements: - - authenticated connection - - market specification optional via `market_ticker` or `market_tickers` - - supports `update_subscription` with `add_markets` and `delete_markets` messages: fill: $ref: '#/components/messages/fill' + user_orders: address: user_orders title: User Orders - description: > - Private order created/updated notifications for the authenticated user on - the margin exchange. - + description: | + Private order created/updated notifications for the authenticated user on the margin exchange. Requirements: - - authenticated connection - - market specification optional via `market_tickers` - - supports `update_subscription` with `add_markets` and `delete_markets` messages: userOrder: $ref: '#/components/messages/userOrder' + order_group_updates: address: order_group_updates title: Order Group Updates - description: > - Real-time order group lifecycle and limit updates. Requires - authentication. - + description: | + Real-time order group lifecycle and limit updates. Requires authentication. **Requirements:** - - Authentication required - - Market specification ignored - - - Updates sent when order groups are created, triggered, reset, deleted, - or have limits updated - + - Updates sent when order groups are created, triggered, reset, deleted, or have limits updated **Use case:** Tracking order group lifecycle and limits messages: orderGroupUpdates: $ref: '#/components/messages/orderGroupUpdates' + operations: sendPing: action: receive @@ -234,6 +200,7 @@ operations: - $ref: '#/channels/control_frames/messages/incomingPing' tags: - name: control-frames + sendPong: action: receive title: Send Pong @@ -243,6 +210,7 @@ operations: - $ref: '#/channels/control_frames/messages/incomingPong' tags: - name: control-frames + sendSubscribe: action: receive title: Subscribe to Channels @@ -252,6 +220,7 @@ operations: - $ref: '#/channels/root/messages/subscribeCommand' tags: - name: commands + sendUnsubscribe: action: receive title: Unsubscribe from Channels @@ -261,6 +230,7 @@ operations: - $ref: '#/channels/root/messages/unsubscribeCommand' tags: - name: commands + sendListSubscriptions: action: receive title: List Subscriptions @@ -270,6 +240,7 @@ operations: - $ref: '#/channels/root/messages/listSubscriptionsCommand' tags: - name: commands + sendUpdateSubscription: action: receive title: Update Subscription - Add Markets @@ -279,6 +250,7 @@ operations: - $ref: '#/channels/root/messages/updateSubscriptionCommand' tags: - name: commands + sendUpdateSubscriptionDelete: action: receive title: Update Subscription - Delete Markets @@ -288,6 +260,7 @@ operations: - $ref: '#/channels/root/messages/updateSubscriptionDeleteCommand' tags: - name: commands + sendUpdateSubscriptionSingleSid: action: receive title: Update Subscription - Single SID @@ -297,6 +270,7 @@ operations: - $ref: '#/channels/root/messages/updateSubscriptionSingleSidCommand' tags: - name: commands + receivePing: action: send title: Receive Ping @@ -306,6 +280,7 @@ operations: - $ref: '#/channels/control_frames/messages/outgoingPing' tags: - name: control-frames + receivePong: action: send title: Receive Pong @@ -315,6 +290,7 @@ operations: - $ref: '#/channels/control_frames/messages/outgoingPong' tags: - name: control-frames + receiveSubscribed: action: send title: Subscription Confirmed @@ -324,6 +300,7 @@ operations: - $ref: '#/channels/root/messages/subscribedResponse' tags: - name: responses + receiveUnsubscribed: action: send title: Unsubscription Confirmed @@ -333,6 +310,7 @@ operations: - $ref: '#/channels/root/messages/unsubscribedResponse' tags: - name: responses + receiveOk: action: send title: Update Confirmed @@ -342,6 +320,7 @@ operations: - $ref: '#/channels/root/messages/okResponse' tags: - name: responses + receiveListSubscriptions: action: send title: List Subscriptions Response @@ -351,6 +330,7 @@ operations: - $ref: '#/channels/root/messages/listSubscriptionsResponse' tags: - name: responses + receiveError: action: send title: Error Response @@ -360,6 +340,7 @@ operations: - $ref: '#/channels/root/messages/errorResponse' tags: - name: responses + receiveOrderbookSnapshot: action: send title: Orderbook Snapshot @@ -369,6 +350,7 @@ operations: - $ref: '#/channels/orderbook_delta/messages/orderbookSnapshot' tags: - name: market-data + receiveOrderbookDelta: action: send title: Orderbook Delta @@ -378,6 +360,7 @@ operations: - $ref: '#/channels/orderbook_delta/messages/orderbookDelta' tags: - name: market-data + receiveTicker: action: send title: Ticker Update @@ -387,6 +370,7 @@ operations: - $ref: '#/channels/ticker/messages/ticker' tags: - name: market-data + receiveTrade: action: send title: Trade Update @@ -396,6 +380,7 @@ operations: - $ref: '#/channels/trade/messages/trade' tags: - name: market-data + receiveFill: action: send title: Fill Notification @@ -405,6 +390,7 @@ operations: - $ref: '#/channels/fill/messages/fill' tags: - name: private + receiveUserOrder: action: send title: User Order Update @@ -414,6 +400,7 @@ operations: - $ref: '#/channels/user_orders/messages/userOrder' tags: - name: private + receiveOrderGroupUpdates: action: send title: Order Group Updates @@ -424,6 +411,7 @@ operations: - $ref: '#/channels/order_group_updates/messages/orderGroupUpdates' tags: - name: private + components: messages: incomingPing: @@ -474,6 +462,7 @@ components: - name: emptyPong summary: Kalshi sends pong payload: '' + subscribeCommand: name: subscribe title: Subscribe Command @@ -516,6 +505,7 @@ components: contentType: application/json payload: $ref: '#/components/schemas/updateSubscriptionCommandPayload' + subscribedResponse: name: subscribed title: Subscribed Response @@ -551,6 +541,7 @@ components: contentType: application/json payload: $ref: '#/components/schemas/errorResponsePayload' + orderbookSnapshot: name: orderbook_snapshot title: Orderbook Snapshot @@ -608,55 +599,47 @@ components: sid: 21 seq: 7 msg: - event_type: limit_updated - order_group_id: og_123 - contracts_limit_fp: '150.00' + event_type: "limit_updated" + order_group_id: "og_123" + contracts_limit_fp: "150.00" + schemas: commandId: type: integer minimum: 0 description: Unique ID of a command within a WebSocket session + subscriptionId: type: integer minimum: 1 description: Server-generated subscription identifier + sequenceNumber: type: integer minimum: 1 description: Sequence number used for snapshot/delta consistency + marketTicker: type: string description: Unique market identifier + bookSide: type: string - enum: - - bid - - ask + enum: ["bid", "ask"] + selfTradePreventionType: type: string - enum: - - taker_at_cross - - maker + enum: ["taker_at_cross", "maker"] description: Self-trade prevention type + lastUpdateReason: type: string - enum: - - '' - - Decrease - - Amend - - MarginCancel - - SelfTradeCancel - - ExpiryCancel - - Trade - - PostOnlyCrossCancel - description: >- - Margin order update reason when the delta corresponds to the - authenticated user's order. + enum: ["", "Decrease", "Amend", "MarginCancel", "SelfTradeCancel", "ExpiryCancel", "Trade", "PostOnlyCrossCancel"] + description: Margin order update reason when the delta corresponds to the authenticated user's order. + tickerPrice: type: object - required: - - price - - ts_ms + required: ["price", "ts_ms"] properties: price: type: string @@ -665,12 +648,10 @@ components: type: integer format: int64 description: Unix timestamp in milliseconds. + fundingRate: type: object - required: - - rate - - next_funding_time_ms - - ts_ms + required: ["rate", "next_funding_time_ms", "ts_ms"] properties: rate: type: number @@ -684,42 +665,34 @@ components: type: integer format: int64 description: Unix timestamp in milliseconds for the funding snapshot. + priceLevelDollarsCountFp: type: array items: type: string minItems: 2 maxItems: 2 - description: '[price_in_dollars, contract_count_fp]' + description: "[price_in_dollars, contract_count_fp]" + subscribeCommandPayload: type: object - required: - - id - - cmd - - params + required: ["id", "cmd", "params"] properties: id: $ref: '#/components/schemas/commandId' cmd: type: string - const: subscribe + const: "subscribe" params: type: object - required: - - channels + required: ["channels"] properties: channels: type: array minItems: 1 items: type: string - enum: - - orderbook_delta - - ticker - - trade - - fill - - user_orders - - order_group_updates + enum: ["orderbook_delta", "ticker", "trade", "fill", "user_orders", "order_group_updates"] market_ticker: type: string market_tickers: @@ -734,44 +707,38 @@ components: skip_ticker_ack: type: boolean default: false + unsubscribeCommandPayload: type: object - required: - - id - - cmd - - params + required: ["id", "cmd", "params"] properties: id: $ref: '#/components/schemas/commandId' cmd: type: string - const: unsubscribe + const: "unsubscribe" params: type: object - required: - - sids + required: ["sids"] properties: sids: type: array items: $ref: '#/components/schemas/subscriptionId' minItems: 1 + updateSubscriptionCommandPayload: type: object - required: - - id - - cmd - - params + required: ["id", "cmd", "params"] properties: id: $ref: '#/components/schemas/commandId' cmd: type: string - const: update_subscription + const: "update_subscription" params: type: object - required: - - action + required: ["action"] properties: sid: $ref: '#/components/schemas/subscriptionId' @@ -794,47 +761,39 @@ components: default: false action: type: string - enum: - - add_markets - - delete_markets + enum: ["add_markets", "delete_markets"] + listSubscriptionsCommandPayload: type: object - required: - - id - - cmd + required: ["id", "cmd"] properties: id: $ref: '#/components/schemas/commandId' cmd: type: string - const: list_subscriptions + const: "list_subscriptions" + subscribedResponsePayload: type: object - required: - - type - - msg + required: ["type", "msg"] properties: id: $ref: '#/components/schemas/commandId' type: type: string - const: subscribed + const: "subscribed" msg: type: object - required: - - channel - - sid + required: ["channel", "sid"] properties: channel: type: string sid: $ref: '#/components/schemas/subscriptionId' + unsubscribedResponsePayload: type: object - required: - - sid - - seq - - type + required: ["sid", "seq", "type"] properties: id: $ref: '#/components/schemas/commandId' @@ -844,11 +803,11 @@ components: $ref: '#/components/schemas/sequenceNumber' type: type: string - const: unsubscribed + const: "unsubscribed" + okResponsePayload: type: object - required: - - type + required: ["type"] properties: id: $ref: '#/components/schemas/commandId' @@ -858,7 +817,7 @@ components: $ref: '#/components/schemas/sequenceNumber' type: type: string - const: ok + const: "ok" msg: type: object properties: @@ -866,46 +825,39 @@ components: type: array items: $ref: '#/components/schemas/marketTicker' + listSubscriptionsResponsePayload: type: object - required: - - id - - type - - msg + required: ["id", "type", "msg"] properties: id: $ref: '#/components/schemas/commandId' type: type: string - const: ok + const: "ok" msg: type: array items: type: object - required: - - channel - - sid + required: ["channel", "sid"] properties: channel: type: string sid: $ref: '#/components/schemas/subscriptionId' + errorResponsePayload: type: object - required: - - type - - msg + required: ["type", "msg"] properties: id: $ref: '#/components/schemas/commandId' type: type: string - const: error + const: "error" msg: type: object - required: - - code - - msg + required: ["code", "msg"] properties: code: type: integer @@ -915,25 +867,21 @@ components: type: string market_ticker: type: string + marginOrderbookSnapshotPayload: type: object - required: - - type - - sid - - seq - - msg + required: ["type", "sid", "seq", "msg"] properties: type: type: string - const: orderbook_snapshot + const: "orderbook_snapshot" sid: $ref: '#/components/schemas/subscriptionId' seq: $ref: '#/components/schemas/sequenceNumber' msg: type: object - required: - - market_ticker + required: ["market_ticker"] properties: market_ticker: $ref: '#/components/schemas/marketTicker' @@ -945,28 +893,21 @@ components: type: array items: $ref: '#/components/schemas/priceLevelDollarsCountFp' + marginOrderbookDeltaPayload: type: object - required: - - type - - sid - - seq - - msg + required: ["type", "sid", "seq", "msg"] properties: type: type: string - const: orderbook_delta + const: "orderbook_delta" sid: $ref: '#/components/schemas/subscriptionId' seq: $ref: '#/components/schemas/sequenceNumber' msg: type: object - required: - - market_ticker - - price - - delta - - side + required: ["market_ticker", "price", "delta", "side"] properties: market_ticker: $ref: '#/components/schemas/marketTicker' @@ -986,43 +927,25 @@ components: type: integer format: int64 description: Unix timestamp in milliseconds. + marginTickerPayload: type: object - required: - - type - - sid - - msg + required: ["type", "sid", "msg"] properties: type: type: string - const: ticker + const: "ticker" sid: $ref: '#/components/schemas/subscriptionId' msg: type: object - required: - - market_ticker - - price - - bid - - ask - - bid_size_fp - - ask_size_fp - - last_trade_size_fp - - volume - - volume_notional_value_dollars - - volume_24h - - volume_24h_notional_value_dollars - - open_interest - - open_interest_notional_value_dollars - - ts_ms + required: ["market_ticker", "price", "bid", "ask", "bid_size_fp", "ask_size_fp", "last_trade_size_fp", "volume", "volume_notional_value_dollars", "volume_24h", "volume_24h_notional_value_dollars", "open_interest", "open_interest_notional_value_dollars", "ts_ms"] properties: market_ticker: $ref: '#/components/schemas/marketTicker' price: type: string - description: >- - Last traded price in USD as a fixed-point decimal string (4 - decimals). + description: Last traded price in USD as a fixed-point decimal string (4 decimals). bid: type: string description: USD price as a fixed-point decimal string (4 decimals). @@ -1046,9 +969,7 @@ components: description: One sided trade volume in the last 24 hours in contracts. volume_24h_notional_value_dollars: type: string - description: >- - Total notional value of one sided trade volume in the last 24 - hours in dollars. + description: Total notional value of one sided trade volume in the last 24 hours in dollars. open_interest: type: string description: One sided open interest in contracts. @@ -1069,27 +990,19 @@ components: type: integer format: int64 description: Unix timestamp in milliseconds. + marginTradePayload: type: object - required: - - type - - sid - - msg + required: ["type", "sid", "msg"] properties: type: type: string - const: trade + const: "trade" sid: $ref: '#/components/schemas/subscriptionId' msg: type: object - required: - - trade_id - - market_ticker - - price - - count - - taker_side - - ts_ms + required: ["trade_id", "market_ticker", "price", "count", "taker_side", "ts_ms"] properties: trade_id: type: string @@ -1106,31 +1019,19 @@ components: type: integer format: int64 description: Unix timestamp in milliseconds. + marginFillPayload: type: object - required: - - type - - sid - - msg + required: ["type", "sid", "msg"] properties: type: type: string - const: fill + const: "fill" sid: $ref: '#/components/schemas/subscriptionId' msg: type: object - required: - - trade_id - - order_id - - market_ticker - - is_taker - - side - - ts_ms - - price - - count - - fee_cost - - post_position + required: ["trade_id", "order_id", "market_ticker", "is_taker", "side", "ts_ms", "price", "count", "fee_cost", "post_position"] properties: trade_id: type: string @@ -1160,30 +1061,19 @@ components: type: string subaccount: type: integer + marginUserOrderPayload: type: object - required: - - type - - sid - - msg + required: ["type", "sid", "msg"] properties: type: type: string - const: user_order + const: "user_order" sid: $ref: '#/components/schemas/subscriptionId' msg: type: object - required: - - order_id - - user_id - - client_order_id - - ticker - - side - - price - - fill_count - - remaining_count - - created_ts_ms + required: ["order_id", "user_id", "client_order_id", "ticker", "side", "price", "fill_count", "remaining_count", "created_ts_ms"] properties: order_id: type: string @@ -1222,51 +1112,37 @@ components: description: Unix timestamp in milliseconds. subaccount_number: type: integer + orderGroupUpdatesPayload: type: object - required: - - type - - sid - - seq - - msg + required: ["type", "sid", "seq", "msg"] properties: type: type: string - const: order_group_updates + const: "order_group_updates" sid: $ref: '#/components/schemas/subscriptionId' seq: $ref: '#/components/schemas/sequenceNumber' msg: type: object - required: - - event_type - - order_group_id - - ts_ms + required: ["event_type", "order_group_id", "ts_ms"] properties: event_type: type: string description: Order group event type - enum: - - created - - triggered - - reset - - deleted - - limit_updated + enum: ["created", "triggered", "reset", "deleted", "limit_updated"] order_group_id: type: string description: Order group identifier contracts_limit_fp: type: string - description: >- - Updated contracts limit in fixed-point (2 decimals). Present for - "created" and "limit_updated" events only. + description: Updated contracts limit in fixed-point (2 decimals). Present for "created" and "limit_updated" events only. ts_ms: type: integer format: int64 - description: >- - Matching engine timestamp at which the event was processed, as - Unix epoch milliseconds. + description: Matching engine timestamp at which the event was processed, as Unix epoch milliseconds. + securitySchemes: apiKey: type: apiKey diff --git a/specs/perps_openapi.yaml b/specs/perps_openapi.yaml index c926d5b..5cb16c2 100644 --- a/specs/perps_openapi.yaml +++ b/specs/perps_openapi.yaml @@ -2,14 +2,14 @@ openapi: 3.0.0 info: title: Kalshi Trade API Manual Endpoints version: 0.0.1 - description: >- - Manually defined OpenAPI spec for endpoints being migrated to spec-first - approach + description: Manually defined OpenAPI spec for endpoints being migrated to spec-first approach + servers: - url: https://external-api.kalshi.com/trade-api/v2 description: Production perps REST API server - url: https://external-api.demo.kalshi.co/trade-api/v2 description: Demo perps REST API server + paths: /margin/fcm/subtraders: post: @@ -45,6 +45,127 @@ paths: $ref: '#/components/responses/ConflictError' '500': $ref: '#/components/responses/InternalServerError' + + /margin/fcm/subtraders/risk_controls: + get: + operationId: GetFCMSubtraderRiskControls + summary: Get FCM Subtrader Risk Controls + description: | + Returns the initial margin caps configured for an FCM member's subtrader on the margined + exchange. A cap with no market_ticker applies across all markets; the remaining caps are + scoped to a single market each. Markets without a cap are omitted. + tags: + - fcm + security: + - kalshiAccessKey: [] + kalshiAccessSignature: [] + kalshiAccessTimestamp: [] + parameters: + - name: subtrader_id + in: query + required: true + description: The subtrader whose initial margin caps should be returned. Must belong to the requesting FCM. + schema: + type: string + - name: market_ticker + in: query + required: false + description: Restricts the response to the cap scoped to this market when supplied. + schema: + type: string + x-go-type-skip-optional-pointer: true + responses: + '200': + description: Risk controls retrieved successfully + content: + application/json: + schema: + $ref: '#/components/schemas/GetFCMSubtraderRiskControlsResponse' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/UnauthorizedError' + '403': + $ref: '#/components/responses/ForbiddenError' + '404': + $ref: '#/components/responses/NotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' + put: + operationId: UpdateFCMSubtraderRiskControls + summary: Update FCM Subtrader Risk Controls + description: Sets the initial margin cap for an FCM member's subtrader on the margined exchange. + tags: + - fcm + security: + - kalshiAccessKey: [] + kalshiAccessSignature: [] + kalshiAccessTimestamp: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateFCMSubtraderRiskControlsRequest' + responses: + '200': + description: Risk controls updated successfully + content: + application/json: + schema: + $ref: '#/components/schemas/EmptyResponse' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/UnauthorizedError' + '403': + $ref: '#/components/responses/ForbiddenError' + '404': + $ref: '#/components/responses/NotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' + delete: + operationId: DeleteFCMSubtraderRiskControls + summary: Delete FCM Subtrader Risk Controls + description: Removes the initial margin cap for an FCM member's subtrader on the margined exchange. + tags: + - fcm + security: + - kalshiAccessKey: [] + kalshiAccessSignature: [] + kalshiAccessTimestamp: [] + parameters: + - name: subtrader_id + in: query + required: true + description: The subtrader whose initial margin cap should be removed. Must belong to the requesting FCM. + schema: + type: string + - name: market_ticker + in: query + required: false + description: Scopes the initial margin cap removal to this market when supplied. + schema: + type: string + x-go-type-skip-optional-pointer: true + responses: + '200': + description: Risk controls deleted successfully + content: + application/json: + schema: + $ref: '#/components/schemas/EmptyResponse' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/UnauthorizedError' + '403': + $ref: '#/components/responses/ForbiddenError' + '404': + $ref: '#/components/responses/NotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' + /account/limits/perps: get: operationId: GetPerpsAccountApiLimits @@ -67,11 +188,12 @@ paths: description: Unauthorized '500': description: Internal server error + /margin/exchange/status: get: operationId: GetMarginExchangeStatus summary: Get Exchange Status - description: Endpoint for getting the margin exchange status. + description: 'Endpoint for getting the margin exchange status.' tags: - exchange responses: @@ -99,13 +221,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ExchangeStatus' + /margin/risk_parameters: get: operationId: GetMarginRiskParameters summary: Get Risk Parameters - description: >- - Returns system-wide margin risk parameters including liquidation - thresholds and per-market initial margin multipliers. + description: 'Returns system-wide margin risk parameters including liquidation thresholds and per-market initial margin multipliers.' tags: - risk responses: @@ -115,11 +236,12 @@ paths: application/json: schema: $ref: '#/components/schemas/GetMarginRiskParametersResponse' + /margin/orders: get: operationId: GetMarginOrders summary: Get Orders - description: Endpoint for listing margin orders with optional filtering. + description: 'Endpoint for listing margin orders with optional filtering.' tags: - orders security: @@ -180,6 +302,7 @@ paths: $ref: '#/components/responses/RateLimitError' '500': $ref: '#/components/responses/InternalServerError' + /margin/orders/{order_id}: get: operationId: GetMarginOrder @@ -206,12 +329,11 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + delete: operationId: CancelMarginOrder summary: Cancel Order - description: >- - Endpoint for canceling an order. Cancels all remaining resting contracts - and returns the canceled order details. + description: Endpoint for canceling an order. Cancels all remaining resting contracts and returns the canceled order details. tags: - orders security: @@ -234,14 +356,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /margin/orders/{order_id}/decrease: post: operationId: DecreaseMarginOrder summary: Decrease Order - description: >- - Endpoint for decreasing the number of contracts in an existing order. - Exactly one of `reduce_by` or `reduce_to` must be provided. Canceling an - order is equivalent to decreasing to zero. + description: Endpoint for decreasing the number of contracts in an existing order. Exactly one of `reduce_by` or `reduce_to` must be provided. Canceling an order is equivalent to decreasing to zero. tags: - orders security: @@ -272,22 +392,16 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /margin/orders/{order_id}/amend: post: operationId: AmendMarginOrder summary: Amend Order - description: >- - Endpoint for amending the price and/or max number of fillable contracts - in an existing margin order. + description: Endpoint for amending the price and/or max number of fillable contracts in an existing margin order. x-mint: - content: > + content: | - - Amending a resting order preserves queue position only when the - amendment decreases size. All other amendments — like increasing size - or changing price forfeit queue position and place the order at the - back of the queue. - + Amending a resting order preserves queue position only when the amendment decreases size. All other amendments — like increasing size or changing price forfeit queue position and place the order at the back of the queue. tags: - orders @@ -319,6 +433,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /margin/markets: get: operationId: GetMarginMarkets @@ -347,13 +462,12 @@ paths: $ref: '#/components/responses/RateLimitError' '500': $ref: '#/components/responses/InternalServerError' + /margin/markets/{ticker}: get: operationId: GetMarginMarket summary: Get Market - description: >- - Endpoint for fetching a margin market with trading stats (price, volume, - open interest). + description: Endpoint for fetching a margin market with trading stats (price, volume, open interest). tags: - market parameters: @@ -378,6 +492,7 @@ paths: $ref: '#/components/responses/RateLimitError' '500': $ref: '#/components/responses/InternalServerError' + /margin/markets/{ticker}/orderbook: get: operationId: GetMarginMarketOrderbook @@ -402,9 +517,7 @@ paths: default: 0 - name: aggregation_tick_size in: query - description: >- - Tick size in dollars for aggregating price levels (e.g., 0.10 for 10 - cent buckets) + description: Tick size in dollars for aggregating price levels (e.g., 0.10 for 10 cent buckets) required: false schema: type: string @@ -423,6 +536,7 @@ paths: $ref: '#/components/responses/RateLimitError' '500': $ref: '#/components/responses/InternalServerError' + /margin/markets/{ticker}/candlesticks: get: operationId: GetMarginMarketCandlesticks @@ -440,49 +554,34 @@ paths: - name: start_ts in: query required: true - description: >- - Start timestamp (Unix timestamp). Candlesticks will include those - ending on or after this time. + description: Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time. schema: type: integer format: int64 - name: end_ts in: query required: true - description: >- - End timestamp (Unix timestamp). Candlesticks will include those - ending on or before this time. + description: End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time. schema: type: integer format: int64 - name: period_interval in: query required: true - description: >- - Time period length of each candlestick in minutes. Valid values are - 1 (1 minute), 60 (1 hour), or 1440 (1 day). + description: Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day). schema: type: integer - enum: - - 1 - - 60 - - 1440 + enum: [1, 60, 1440] x-oapi-codegen-extra-tags: - validate: required,oneof=1 60 1440 + validate: "required,oneof=1 60 1440" - name: include_latest_before_start in: query required: false - description: > - If true, prepends the latest candlestick available before the - start_ts. This synthetic candlestick is created by: - + description: | + If true, prepends the latest candlestick available before the start_ts. This synthetic candlestick is created by: 1. Finding the most recent real candlestick before start_ts - - 2. Projecting it forward to the first period boundary (calculated as - the next period interval after start_ts) - - 3. Setting all OHLC prices to null, and `price.previous` to the - close price from the real candlestick + 2. Projecting it forward to the first period boundary (calculated as the next period interval after start_ts) + 3. Setting all OHLC prices to null, and `price.previous` to the close price from the real candlestick schema: type: boolean default: false @@ -499,6 +598,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /margin/fills: get: operationId: GetMarginFills @@ -562,11 +662,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/positions: get: operationId: GetMarginPositions summary: Get Positions - description: Endpoint for retrieving the authenticated user's margin positions. + description: 'Endpoint for retrieving the authenticated user''s margin positions.' tags: - portfolio security: @@ -600,14 +701,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/trades: get: operationId: GetMarginTrades summary: Get Trades - description: >- - Endpoint for retrieving public margin trades for a given market ticker. - Returns a paginated response. Use the cursor value from the previous - response to get the next page. + description: 'Endpoint for retrieving public margin trades for a given market ticker. Returns a paginated response. Use the cursor value from the previous response to get the next page.' tags: - market parameters: @@ -659,13 +758,12 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /margin/enabled: get: operationId: GetMarginEnabled summary: Get Enabled Status - description: >- - Endpoint for checking if margin trading is enabled for the authenticated - user. + description: Endpoint for checking if margin trading is enabled for the authenticated user. tags: - exchange security: @@ -683,13 +781,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/notional_risk_limit: get: operationId: GetMarginNotionalRiskLimit summary: Get Notional Risk Limit - description: >- - Endpoint for retrieving the notional value risk limit for the - authenticated margin user. + description: 'Endpoint for retrieving the notional value risk limit for the authenticated margin user.' tags: - risk security: @@ -707,24 +804,16 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/balance: get: operationId: GetMarginBalance summary: Get Balance - description: >- - Endpoint for retrieving the balance breakdown for the authenticated - direct margin user. Returns cash balance (aggregate and per-subaccount), - position value, total balance, and maintenance margin requirement. + description: 'Endpoint for retrieving the balance breakdown for the authenticated direct margin user. Returns cash balance (aggregate and per-subaccount), position value, total balance, and maintenance margin requirement.' x-mint: - content: > + content: | - - **Rate limit:** 5 tokens per request, or 50 tokens when - `compute_available_balance=true` (the available-balance computation - scans all resting orders). See `GET - /trade-api/v2/account/endpoint_costs` for current non-default endpoint - costs. - + **Rate limit:** 5 tokens per request, or 50 tokens when `compute_available_balance=true` (the available-balance computation scans all resting orders). See `GET /trade-api/v2/account/endpoint_costs` for current non-default endpoint costs. tags: - portfolio @@ -740,10 +829,7 @@ paths: type: boolean default: false x-go-type-skip-optional-pointer: true - description: >- - When true, computes available_balance per subaccount at an increased - rate limit cost. Available balance is 0 when the flag is false or - omitted. + description: 'When true, computes available_balance per subaccount at an increased rate limit cost. Available balance is 0 when the flag is false or omitted.' responses: '200': description: Margin balance retrieved successfully @@ -759,15 +845,12 @@ paths: $ref: '#/components/responses/RateLimitError' '500': $ref: '#/components/responses/InternalServerError' + /margin/risk: get: operationId: GetMarginRisk summary: Get Risk - description: >- - Endpoint for retrieving leverage and liquidation price data for the - authenticated direct margin user. Returns account-level leverage plus - per-position leverage and liquidation prices, grouped by subaccount and - market. + description: 'Endpoint for retrieving leverage and liquidation price data for the authenticated direct margin user. Returns account-level leverage plus per-position leverage and liquidation prices, grouped by subaccount and market.' tags: - risk security: @@ -787,14 +870,12 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + /margin/fee_tiers: get: operationId: GetMarginFeeTiers summary: Get Fee Tiers - description: >- - Endpoint for retrieving the margin fee tiers for the authenticated - direct margin user. Returns a map of margin market tickers to their fee - tier strings. + description: 'Endpoint for retrieving the margin fee tiers for the authenticated direct margin user. Returns a map of margin market tickers to their fee tier strings.' tags: - fees security: @@ -812,15 +893,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/funding_history: get: operationId: GetMarginFundingHistory summary: Get Funding History - description: >- - Endpoint for retrieving the authenticated user's historical margin - funding payments joined with funding rates for a specific market, or - across all markets when ticker is empty, over an inclusive UTC date - range. + description: 'Endpoint for retrieving the authenticated user''s historical margin funding payments joined with funding rates for a specific market, or across all markets when ticker is empty, over an inclusive UTC date range.' tags: - funding security: @@ -831,18 +909,14 @@ paths: - name: ticker in: query required: false - description: >- - Market ticker for funding history. Leave empty to query across all - markets. + description: Market ticker for funding history. Leave empty to query across all markets. schema: type: string x-go-type-skip-optional-pointer: true - name: start_date in: query required: true - description: >- - Inclusive UTC start date for funding history range (YYYY-MM-DD - format) + description: Inclusive UTC start date for funding history range (YYYY-MM-DD format) schema: type: string format: date @@ -875,13 +949,12 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + /margin/funding_rates/historical: get: operationId: GetMarginHistoricalFundingRates summary: Get Historical Funding Rates - description: >- - Endpoint for retrieving historical margin funding rates for a market, or - across all markets when ticker is empty. + description: Endpoint for retrieving historical margin funding rates for a market, or across all markets when ticker is empty. tags: - funding parameters: @@ -895,18 +968,14 @@ paths: - name: start_ts in: query required: false - description: >- - Start timestamp (Unix timestamp in seconds). If omitted, defaults to - the earliest available data. + description: Start timestamp (Unix timestamp in seconds). If omitted, defaults to the earliest available data. schema: type: integer format: int64 - name: end_ts in: query required: false - description: >- - End timestamp (Unix timestamp in seconds). If omitted, defaults to - the current time. + description: End timestamp (Unix timestamp in seconds). If omitted, defaults to the current time. schema: type: integer format: int64 @@ -921,16 +990,13 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /margin/funding_rates/estimate: get: operationId: GetMarginFundingRateEstimate summary: Get Funding Rate Estimate - description: > - Returns the estimated funding rate for the current, in-progress funding - period. The value is a time-weighted average of the premium index - computed over `[last_funding_time, now)`, so it continues to move as new - data accumulates through the window and is only finalized at - `next_funding_time`. + description: | + Returns the estimated funding rate for the current, in-progress funding period. The value is a time-weighted average of the premium index computed over `[last_funding_time, now)`, so it continues to move as new data accumulates through the window and is only finalized at `next_funding_time`. tags: - funding parameters: @@ -954,11 +1020,12 @@ paths: $ref: '#/components/responses/BadRequestError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/intra_exchange_instance_transfer: post: operationId: IntraExchangeInstanceTransfer summary: Intra Account Transfer - description: Endpoint for transferring funds within the same account. + description: 'Endpoint for transferring funds within the same account.' tags: - portfolio security: @@ -986,14 +1053,12 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/margin/subaccounts: post: operationId: CreateMarginSubaccount summary: Create Subaccount - description: >- - Creates a new subaccount for the authenticated user in the margin - exchange. Subaccounts are numbered sequentially starting from 1. Maximum - 63 numbered subaccounts per user (64 including the primary account). + description: 'Creates a new subaccount for the authenticated user in the margin exchange. Subaccounts are numbered sequentially starting from 1. Maximum 63 numbered subaccounts per user (64 including the primary account).' tags: - portfolio security: @@ -1015,13 +1080,12 @@ paths: $ref: '#/components/responses/ForbiddenError' '500': $ref: '#/components/responses/InternalServerError' + /portfolio/margin/subaccounts/transfer: post: operationId: ApplyMarginSubaccountTransfer summary: Transfer Between Subaccounts - description: >- - Transfers funds between the authenticated user's margin subaccounts. Use - 0 for the primary account, or 1-63 for numbered subaccounts. + description: 'Transfers funds between the authenticated user''s margin subaccounts. Use 0 for the primary account, or 1-63 for numbered subaccounts.' tags: - portfolio security: @@ -1047,13 +1111,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/order_groups: get: operationId: GetMarginOrderGroups summary: Get Order Groups - description: >- - Retrieves all order groups for the authenticated user on the margin - exchange. + description: 'Retrieves all order groups for the authenticated user on the margin exchange.' tags: - order-groups security: @@ -1075,14 +1138,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/order_groups/create: post: operationId: CreateMarginOrderGroup summary: Create Order Group - description: >- - Creates a new order group on the margin exchange with a contracts limit - measured over a rolling window. When the limit is hit, all orders in the - group are cancelled and no new orders can be placed until reset. + description: 'Creates a new order group on the margin exchange with a contracts limit measured over a rolling window. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.' tags: - order-groups security: @@ -1108,13 +1169,12 @@ paths: $ref: '#/components/responses/UnauthorizedError' '500': $ref: '#/components/responses/InternalServerError' + /margin/order_groups/{order_group_id}: get: operationId: GetMarginOrderGroup summary: Get Order Group - description: >- - Retrieves details for a single order group on the margin exchange - including all order IDs and auto-cancel status. + description: 'Retrieves details for a single order group on the margin exchange including all order IDs and auto-cancel status.' tags: - order-groups security: @@ -1140,9 +1200,7 @@ paths: delete: operationId: DeleteMarginOrderGroup summary: Delete Order Group - description: >- - Deletes an order group on the margin exchange and cancels all orders - within it. + description: 'Deletes an order group on the margin exchange and cancels all orders within it.' tags: - order-groups security: @@ -1165,14 +1223,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /margin/order_groups/{order_group_id}/reset: put: operationId: ResetMarginOrderGroup summary: Reset Order Group - description: >- - Resets the order group matched contracts counter to zero on the margin - exchange, allowing new orders to be placed again after the limit was - hit. + description: 'Resets the order group matched contracts counter to zero on the margin exchange, allowing new orders to be placed again after the limit was hit.' tags: - order-groups security: @@ -1201,13 +1257,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /margin/order_groups/{order_group_id}/trigger: put: operationId: TriggerMarginOrderGroup summary: Trigger Order Group - description: >- - Triggers the order group on the margin exchange, canceling all orders in - the group and preventing new orders until the group is reset. + description: 'Triggers the order group on the margin exchange, canceling all orders in the group and preventing new orders until the group is reset.' tags: - order-groups security: @@ -1236,14 +1291,12 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + /margin/order_groups/{order_group_id}/limit: put: operationId: UpdateMarginOrderGroupLimit summary: Update Order Group Limit - description: >- - Updates the order group contracts limit on the margin exchange. If the - updated limit would immediately trigger the group, all orders in the - group are canceled and the group is triggered. + description: 'Updates the order group contracts limit on the margin exchange. If the updated limit would immediately trigger the group, all orders in the group are canceled and the group is triggered.' tags: - order-groups security: @@ -1274,6 +1327,7 @@ paths: $ref: '#/components/responses/NotFoundError' '500': $ref: '#/components/responses/InternalServerError' + components: securitySchemes: kalshiAccessKey: @@ -1323,9 +1377,7 @@ components: schema: $ref: '#/components/schemas/ErrorResponse' RateLimitError: - description: >- - Rate limit exceeded. The default cost is 10 tokens per request. Use GET - /trade-api/v2/account/endpoint_costs to list non-default endpoint costs. + description: 'Rate limit exceeded. The default cost is 10 tokens per request. Use GET /trade-api/v2/account/endpoint_costs to list non-default endpoint costs.' content: application/json: schema: @@ -1344,10 +1396,9 @@ components: properties: subtrader_suffix: type: string - pattern: ^[a-z0-9]{1,16}$ - description: >- - Suffix for the new subtrader. The full subtrader id is composed - server-side as {user_id}_{subtrader_suffix}. + pattern: '^[a-z0-9]{1,16}$' + description: Suffix for the new subtrader. The full subtrader id is composed server-side as {user_id}_{subtrader_suffix}. + CreateMarginFCMSubtraderResponse: type: object required: @@ -1355,9 +1406,8 @@ components: properties: subtrader_id: type: string - description: >- - The full id of the created subtrader, in the form - {user_id}_{subtrader_suffix}. + description: The full id of the created subtrader, in the form {user_id}_{subtrader_suffix}. + ApplySubaccountTransferRequest: type: object required: @@ -1371,17 +1421,13 @@ components: format: uuid description: Unique client-provided transfer ID for idempotency. x-oapi-codegen-extra-tags: - validate: required + validate: "required" from_subaccount: type: integer - description: >- - Source subaccount number (0 for primary, 1-63 for numbered - subaccounts). + description: Source subaccount number (0 for primary, 1-63 for numbered subaccounts). to_subaccount: type: integer - description: >- - Destination subaccount number (0 for primary, 1-63 for numbered - subaccounts). + description: Destination subaccount number (0 for primary, 1-63 for numbered subaccounts). amount_cents: type: integer format: int64 @@ -1395,38 +1441,24 @@ components: subaccount: type: integer minimum: 0 - description: >- - Optional subaccount number to use for this order group (0 for - primary, 1-63 for subaccounts). Subaccount-restricted API keys must - omit this field or pass their locked subaccount. + description: Optional subaccount number to use for this order group (0 for primary, 1-63 for subaccounts). Subaccount-restricted API keys must omit this field or pass their locked subaccount. contracts_limit: type: integer format: int64 minimum: 1 - description: >- - Specifies the maximum number of contracts that can be matched within - this group over a rolling 15-second window. Whole contracts only. - Provide contracts_limit or contracts_limit_fp; if both provided they - must match. + description: Specifies the maximum number of contracts that can be matched within this group over a rolling 15-second window. Whole contracts only. Provide contracts_limit or contracts_limit_fp; if both provided they must match. x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: validate: omitempty,gte=1 contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the maximum number of contracts that can be - matched within this group over a rolling 15-second window. Provide - contracts_limit or contracts_limit_fp; if both provided they must - match. + description: String representation of the maximum number of contracts that can be matched within this group over a rolling 15-second window. Provide contracts_limit or contracts_limit_fp; if both provided they must match. exchange_index: allOf: - $ref: '#/components/schemas/ExchangeIndex' default: 0 - description: >- - The market group this order group is bound to (default 0). All - orders placed into this order group must be for markets whose - exchange_index matches this value. + description: The market group this order group is bound to (default 0). All orders placed into this order group must be for markets whose exchange_index matches this value. x-go-type-skip-optional-pointer: true CreateOrderGroupResponse: type: object @@ -1440,9 +1472,7 @@ components: subaccount: type: integer minimum: 0 - description: >- - Subaccount number that owns the created order group (0 for primary, - 1-63 for subaccounts). + description: Subaccount number that owns the created order group (0 for primary, 1-63 for subaccounts). x-go-type-skip-optional-pointer: true exchange_index: allOf: @@ -1456,6 +1486,55 @@ components: subaccount_number: type: integer description: The sequential number assigned to this subaccount (1-63). + UpdateFCMSubtraderRiskControlsRequest: + type: object + required: + - subtrader_id + - im_cap + properties: + subtrader_id: + type: string + description: The subtrader whose initial margin cap should be updated. Must belong to the requesting FCM. + market_ticker: + type: string + description: Scopes the initial margin cap to this market when supplied. + x-go-type-skip-optional-pointer: true + im_cap: + allOf: + - $ref: '#/components/schemas/FixedPointDollars' + description: A non-negative fixed-point US dollar amount with up to 4 decimal places. + pattern: '^[0-9]+(\.[0-9]{1,4})?$' + maxLength: 20 + example: "100.0000" + GetFCMSubtraderRiskControlsResponse: + type: object + required: + - risk_controls + properties: + risk_controls: + type: array + description: One entry per configured initial margin cap. + items: + $ref: '#/components/schemas/FCMSubtraderRiskControls' + FCMSubtraderRiskControls: + type: object + required: + - subtrader_id + - im_cap + properties: + subtrader_id: + type: string + description: The subtrader the initial margin cap applies to. + market_ticker: + type: string + description: The market the cap is scoped to. Absent when the cap applies across all markets. + x-go-type-skip-optional-pointer: true + im_cap: + allOf: + - $ref: '#/components/schemas/FixedPointDollars' + description: A non-negative fixed-point US dollar amount with up to 4 decimal places. + example: "100.0000" + # Order Group schemas EmptyResponse: type: object description: An empty response body @@ -1473,13 +1552,11 @@ components: description: Additional details about the error, if available ExchangeIndex: type: integer - description: Identifier for an exchange shard. Defaults to 0 if unspecified. + description: "Identifier for an exchange shard. Defaults to 0 if unspecified." example: 0 ExchangeInstance: type: string - enum: - - event_contract - - margined + enum: ['event_contract', 'margined'] description: The exchange instance type BucketLimit: type: object @@ -1521,10 +1598,7 @@ components: $ref: '#/components/schemas/BucketLimit' grants: type: array - description: >- - The caller's active API usage level grants across exchange lanes, - where each grant applies to its exchange_instance and usage_tier - reflects the effective tier for the lane reported by this endpoint. + description: The caller's active API usage level grants across exchange lanes, where each grant applies to its exchange_instance and usage_tier reflects the effective tier for the lane reported by this endpoint. items: $ref: '#/components/schemas/ApiUsageLevelGrant' ApiUsageLevelGrant: @@ -1543,31 +1617,19 @@ components: type: integer format: int64 nullable: true - description: >- - Unix timestamp (seconds) when the grant expires. Absent for - permanent grants. + description: Unix timestamp (seconds) when the grant expires. Absent for permanent grants. source: type: string - description: >- - How the grant was created: "volume" (earned from trading volume) or - "manual" (assigned by Kalshi). + description: 'How the grant was created: "volume" (earned from trading volume) or "manual" (assigned by Kalshi).' FixedPointCount: type: string - description: >- - Fixed-point contract count string (2 decimals, e.g., "10.00"; referred - to as "fp" in field names). Requests accept 0-2 decimal places (e.g., - "10", "10.0", "10.00"); responses always emit 2 decimals. Fractional - contract values (e.g., "2.50") are supported; the minimum granularity is - 0.01 contracts. - example: '10.00' + description: Fixed-point contract count string (2 decimals, e.g., "10.00"; referred to as "fp" in field names). Requests accept 0-2 decimal places (e.g., "10", "10.0", "10.00"); responses always emit 2 decimals. Fractional contract values (e.g., "2.50") are supported; the minimum granularity is 0.01 contracts. + example: "10.00" + # Common schemas FixedPointDollars: type: string - description: >- - US dollar amount as a fixed-point decimal string with up to 6 decimal - places of precision. This is the maximum supported precision; valid - quote intervals for a given market are constrained by that market's - price level structure. - example: '0.5600' + description: Fixed-point US dollar string. Most request fields accept 2-4 decimal places (e.g., "0.56", "0.5600"); responses emit up to 6. Valid quote intervals for a given market are constrained by that market's price level structure. + example: "0.5600" GetOrderGroupResponse: type: object required: @@ -1579,9 +1641,7 @@ components: description: Whether auto-cancel is enabled for this order group contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the current maximum contracts allowed over - a rolling 15-second window. + description: String representation of the current maximum contracts allowed over a rolling 15-second window. x-go-type-skip-optional-pointer: true orders: type: array @@ -1626,7 +1686,7 @@ components: x-go-type-skip-optional-pointer: true description: Source exchange shard index (default 0) x-oapi-codegen-extra-tags: - validate: gte=0,lte=100 + validate: "gte=0,lte=100" destination_exchange_shard: type: integer minimum: 0 @@ -1635,7 +1695,7 @@ components: x-go-type-skip-optional-pointer: true description: Destination exchange shard index (default 0) x-oapi-codegen-extra-tags: - validate: gte=0,lte=100 + validate: "gte=0,lte=100" IntraExchangeInstanceTransferResponse: type: object required: @@ -1656,9 +1716,7 @@ components: x-go-type-skip-optional-pointer: true contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' - description: >- - String representation of the current maximum contracts allowed over - a rolling 15-second window. + description: String representation of the current maximum contracts allowed over a rolling 15-second window. x-go-type-skip-optional-pointer: true is_auto_cancel_enabled: type: boolean @@ -1668,31 +1726,20 @@ components: allOf: - $ref: '#/components/schemas/ExchangeIndex' x-go-type-skip-optional-pointer: true + # Market Orderbook schemas PriceLevelDollarsCountFp: type: array minItems: 2 maxItems: 2 - example: - - '0.1500' - - '100.00' + example: ["0.1500", "100.00"] items: type: string - description: >- - Price level in dollars represented as [dollars_string, fp] where - dollars_string is like "0.1500" and fp is a FixedPointCount string - (fixed-point contract count). The second element is the contract - quantity (not price). + description: Price level in dollars represented as [dollars_string, fp] where dollars_string is like "0.1500" and fp is a FixedPointCount string (fixed-point contract count). The second element is the contract quantity (not price). SelfTradePreventionType: type: string - enum: - - taker_at_cross - - maker - description: > - The self-trade prevention type for orders. `taker_at_cross` cancels the - taker order when it would trade against another order from the same - user; execution stops and any partial fills already matched are - executed. `maker` cancels the resting maker order and continues - matching. + enum: ['taker_at_cross', 'maker'] + description: | + The self-trade prevention type for orders. `taker_at_cross` cancels the taker order when it would trade against another order from the same user; execution stops and any partial fills already matched are executed. `maker` cancels the resting maker order and continues matching. UpdateOrderGroupLimitRequest: type: object properties: @@ -1700,22 +1747,14 @@ components: type: integer format: int64 minimum: 1 - description: >- - New maximum number of contracts that can be matched within this - group over a rolling 15-second window. Whole contracts only. Provide - contracts_limit or contracts_limit_fp; if both provided they must - match. + description: New maximum number of contracts that can be matched within this group over a rolling 15-second window. Whole contracts only. Provide contracts_limit or contracts_limit_fp; if both provided they must match. x-go-type-skip-optional-pointer: true x-oapi-codegen-extra-tags: validate: omitempty,gte=1 contracts_limit_fp: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the new maximum number of contracts that - can be matched within this group over a rolling 15-second window. - Provide contracts_limit or contracts_limit_fp; if both provided they - must match. + description: String representation of the new maximum number of contracts that can be matched within this group over a rolling 15-second window. Provide contracts_limit or contracts_limit_fp; if both provided they must match. ExchangeStatus: type: object required: @@ -1724,14 +1763,11 @@ components: properties: exchange_active: type: boolean - description: >- - False if the exchange is no longer taking any state changes at all. - True unless under maintenance. + description: False if the exchange is no longer taking any state changes at all. True unless under maintenance. trading_active: type: boolean - description: >- - True if trading is currently permitted on the exchange. False - outside exchange hours or during pauses. + description: True if trading is currently permitted on the exchange. False outside exchange hours or during pauses. + GetMarginRiskParametersResponse: type: object required: @@ -1752,10 +1788,7 @@ components: additionalProperties: type: number format: double - description: >- - Map of market ticker to initial margin multiplier. The initial - margin requirement is the maintenance margin multiplied by this - value. + description: Map of market ticker to initial margin multiplier. The initial margin requirement is the maintenance margin multiplied by this value. CreateMarginOrderRequest: type: object required: @@ -1790,10 +1823,7 @@ components: format: int64 time_in_force: type: string - enum: - - fill_or_kill - - good_till_canceled - - immediate_or_cancel + enum: ['fill_or_kill', 'good_till_canceled', 'immediate_or_cancel'] x-oapi-codegen-extra-tags: validate: required,oneof=fill_or_kill good_till_canceled immediate_or_cancel x-go-type-skip-optional-pointer: true @@ -1807,28 +1837,21 @@ components: x-go-type-skip-optional-pointer: true cancel_order_on_pause: type: boolean - description: >- - If this flag is set to true, the order will be canceled if the order - is open and trading on the exchange is paused for any reason. + description: If this flag is set to true, the order will be canceled if the order is open and trading on the exchange is paused for any reason. reduce_only: type: boolean - description: >- - Specifies whether the order place count should be capped by the - member's current position. Orders with reduce_only set to true will - be rejected unless time_in_force is immediate_or_cancel or - fill_or_kill. + description: Specifies whether the order place count should be capped by the member's current position. Orders with reduce_only set to true will be rejected unless time_in_force is immediate_or_cancel or fill_or_kill. subaccount: type: integer minimum: 0 default: 0 - description: >- - The subaccount number to use for this margin order. 0 is the primary - subaccount. + description: The subaccount number to use for this margin order. 0 is the primary subaccount. x-go-type-skip-optional-pointer: true order_group_id: type: string description: The order group this order is part of x-go-type-skip-optional-pointer: true + CreateMarginOrderResponse: type: object required: @@ -1845,19 +1868,14 @@ components: description: Number of contracts filled immediately upon placement. remaining_count: $ref: '#/components/schemas/FixedPointCount' - description: >- - Number of contracts remaining after placement. For IOC orders, this - reflects the final state after unfilled contracts are canceled. + description: Number of contracts remaining after placement. For IOC orders, this reflects the final state after unfilled contracts are canceled. average_fill_price: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Volume-weighted average fill price. Only present when fill_count > - 0. + description: Volume-weighted average fill price. Only present when fill_count > 0. average_fee_paid: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Volume-weighted average fee paid per contract for fills resulting - from this request. Only present when fill_count > 0. + description: Volume-weighted average fee paid per contract for fills resulting from this request. Only present when fill_count > 0. + GetMarginOrderResponse: type: object required: @@ -1865,6 +1883,7 @@ components: properties: order: $ref: '#/components/schemas/MarginOrder' + GetMarginOrdersResponse: type: object required: @@ -1877,6 +1896,7 @@ components: $ref: '#/components/schemas/MarginOrder' cursor: type: string + MarginOrder: type: object required: @@ -1933,20 +1953,17 @@ components: x-omitempty: false cancel_order_on_pause: type: boolean - description: >- - If this flag is set to true, the order will be canceled if the order - is open and trading on the exchange is paused for any reason. + description: If this flag is set to true, the order will be canceled if the order is open and trading on the exchange is paused for any reason. order_group_id: type: string description: The order group this order is part of order_source: $ref: '#/components/schemas/OrderSource' - description: >- - The source of the order. Indicates whether the order was placed by - the user or by the system on behalf of the user. + description: The source of the order. Indicates whether the order was placed by the user or by the system on behalf of the user. order_reason: $ref: '#/components/schemas/OrderReason' description: The reason for a system-generated order, when applicable. + CancelMarginOrderResponse: type: object required: @@ -1959,24 +1976,20 @@ components: type: string reduced_by: $ref: '#/components/schemas/FixedPointCount' - description: >- - Number of contracts that were canceled (i.e. the remaining count at - time of cancellation). + description: Number of contracts that were canceled (i.e. the remaining count at time of cancellation). + DecreaseMarginOrderRequest: type: object properties: reduce_by: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the number of contracts to reduce by. - Exactly one of `reduce_by` or `reduce_to` must be provided. + description: String representation of the number of contracts to reduce by. Exactly one of `reduce_by` or `reduce_to` must be provided. reduce_to: $ref: '#/components/schemas/FixedPointCount' nullable: true - description: >- - String representation of the number of contracts to reduce to. - Exactly one of `reduce_by` or `reduce_to` must be provided. + description: String representation of the number of contracts to reduce to. Exactly one of `reduce_by` or `reduce_to` must be provided. + DecreaseMarginOrderResponse: type: object required: @@ -1990,6 +2003,7 @@ components: remaining_count: $ref: '#/components/schemas/FixedPointCount' description: Number of contracts remaining after the decrease. + AmendMarginOrderRequest: type: object required: @@ -2024,6 +2038,7 @@ components: type: string description: The new client-specified order ID after amendment x-go-type-skip-optional-pointer: true + AmendMarginOrderResponse: type: object required: @@ -2037,30 +2052,23 @@ components: $ref: '#/components/schemas/FixedPointCount' nullable: true x-omitempty: false - description: >- - Number of contracts remaining after the amend. Only present when the - amend caused a fill or changed the resting size. + description: Number of contracts remaining after the amend. Only present when the amend caused a fill or changed the resting size. fill_count: $ref: '#/components/schemas/FixedPointCount' nullable: true x-omitempty: false - description: >- - Number of contracts filled as a result of the amend crossing the - book. Only present when fills occurred or remaining size changed. + description: Number of contracts filled as a result of the amend crossing the book. Only present when fills occurred or remaining size changed. average_fill_price: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: false - description: >- - Volume-weighted average fill price for fills resulting from the - amend. Only present when fills occurred. + description: Volume-weighted average fill price for fills resulting from the amend. Only present when fills occurred. average_fee_paid: $ref: '#/components/schemas/FixedPointDollars' nullable: true x-omitempty: false - description: >- - Volume-weighted average fee paid per contract for fills resulting - from the amend. Only present when fills occurred. + description: Volume-weighted average fee paid per contract for fills resulting from the amend. Only present when fills occurred. + MarginOrderbookCount: type: object required: @@ -2069,18 +2077,15 @@ components: properties: bids: type: array - description: >- - Bid price levels, ordered from best bid downward. Each level is - [price, quantity]. + description: Bid price levels, ordered from best bid downward. Each level is [price, quantity]. items: $ref: '#/components/schemas/PriceLevelDollarsCountFp' asks: type: array - description: >- - Ask price levels, ordered from best ask upward. Each level is - [price, quantity]. + description: Ask price levels, ordered from best ask upward. Each level is [price, quantity]. items: $ref: '#/components/schemas/PriceLevelDollarsCountFp' + MarginOrderbookResponse: type: object required: @@ -2088,6 +2093,7 @@ components: properties: orderbook: $ref: '#/components/schemas/MarginOrderbookCount' + MarginMarket: type: object required: @@ -2106,10 +2112,7 @@ components: type: string exchange_index: type: integer - description: >- - The group of markets this market belongs to for order groups. Order - groups may only reference markets whose exchange_index matches - theirs. + description: The group of markets this market belongs to for order groups. Order groups may only reference markets whose exchange_index matches theirs. contract_size: type: string description: Fixed-point number with 6 decimal places @@ -2124,9 +2127,8 @@ components: type: number format: double description: > - Leverage estimate (1 / margin_rate) evaluated at a small - retail-sized notional position. Actual leverage may be lower for - larger positions as the liquidation margin rate grows with size. + Leverage estimate (1 / margin_rate) evaluated at a small retail-sized notional position. + Actual leverage may be lower for larger positions as the liquidation margin rate grows with size. Null when margin config or price data is unavailable. leverage_estimates: type: object @@ -2134,26 +2136,26 @@ components: type: number format: double description: > - Leverage estimates (1 / margin_rate) keyed by notional position size - in dollars ("1000", "10000", "100000", "1000000"). Leverage - decreases at larger notionals as the liquidation margin rate grows - with size. Null when margin config or price data is unavailable. + Leverage estimates (1 / margin_rate) keyed by notional position size in dollars + ("1000", "10000", "100000", "1000000"). Leverage decreases at larger notionals as + the liquidation margin rate grows with size. + Null when margin config or price data is unavailable. long_leverage_estimates: type: object additionalProperties: type: number format: double description: > - Leverage estimates for a long position, keyed by the same notional - position sizes as leverage_estimates. + Leverage estimates for a long position, keyed by the same notional position sizes + as leverage_estimates. short_leverage_estimates: type: object additionalProperties: type: number format: double description: > - Leverage estimates for a short position, keyed by the same notional - position sizes as long_leverage_estimates. + Leverage estimates for a short position, keyed by the same notional position sizes + as long_leverage_estimates. price: $ref: '#/components/schemas/FixedPointDollars' description: Last trade price in dollars. @@ -2174,9 +2176,7 @@ components: description: One sided trade volume in the last 24 hours. volume_24h_notional_value_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Total notional value of one sided trade volume in the last 24 hours - in dollars. + description: Total notional value of one sided trade volume in the last 24 hours in dollars. bid: $ref: '#/components/schemas/FixedPointDollars' description: Best bid price in dollars. @@ -2194,6 +2194,7 @@ components: description: Underlying reference price, scaled per contract. schedule: $ref: '#/components/schemas/MarginMarketSchedule' + MarginMarketSchedule: type: object nullable: true @@ -2210,16 +2211,13 @@ components: type: integer format: int64 nullable: true - description: >- - Unix timestamp in seconds for the next scheduled close. Null while - closed. + description: Unix timestamp in seconds for the next scheduled close. Null while closed. next_open_ts: type: integer format: int64 nullable: true - description: >- - Unix timestamp in seconds for the next scheduled open. Null while - open. + description: Unix timestamp in seconds for the next scheduled open. Null while open. + TickerPrice: type: object required: @@ -2233,40 +2231,26 @@ components: type: integer format: int64 description: Source timestamp in epoch milliseconds. + MarginMarketStatus: type: string - enum: - - inactive - - active - - closed + enum: [inactive, active, closed] description: The status of a margin market + OrderSource: type: string - enum: - - user - - system - description: >- - The source of the order. 'user' indicates a user-placed order, 'system' - indicates a system-generated order. + enum: ['user', 'system'] + description: The source of the order. 'user' indicates a user-placed order, 'system' indicates a system-generated order. + OrderReason: type: string - enum: - - liquidation - - take_profit_stop_loss - description: >- - The reason for a system-generated order. Present for liquidation and - TP/SL orders. + enum: ['liquidation', 'take_profit_stop_loss'] + description: The reason for a system-generated order. Present for liquidation and TP/SL orders. + LastUpdateReason: type: string - enum: - - '' - - Decrease - - Amend - - MarginCancel - - SelfTradeCancel - - ExpiryCancel - - Trade - - PostOnlyCrossCancel + enum: ['', 'Decrease', 'Amend', 'MarginCancel', 'SelfTradeCancel', 'ExpiryCancel', 'Trade', 'PostOnlyCrossCancel'] + MarginMarketResponse: type: object required: @@ -2274,6 +2258,7 @@ components: properties: market: $ref: '#/components/schemas/MarginMarket' + GetMarginMarketsResponse: type: object required: @@ -2283,6 +2268,7 @@ components: type: array items: $ref: '#/components/schemas/MarginMarket' + GetMarginFillsResponse: type: object required: @@ -2295,6 +2281,7 @@ components: $ref: '#/components/schemas/MarginFill' cursor: type: string + MarginFill: type: object required: @@ -2335,19 +2322,16 @@ components: description: Fill price in fixed-point dollars entry_price: type: string - description: >- - Position entry price used to compute incremental realized PnL for - this fill + description: Position entry price used to compute incremental realized PnL for this fill fees: type: string description: Fees paid on filled contracts, in dollars realized_pnl: type: string - description: >- - Incremental realized PnL contributed by this fill, in fixed-point - dollars + description: Incremental realized PnL contributed by this fill, in fixed-point dollars order_source: $ref: '#/components/schemas/OrderSource' + GetMarginPositionsResponse: type: object required: @@ -2357,6 +2341,7 @@ components: type: array items: $ref: '#/components/schemas/MarginPosition' + MarginPosition: type: object required: @@ -2370,17 +2355,13 @@ components: properties: subaccount: type: integer - description: >- - The subaccount number that holds this position (0 for primary, 1-63 - for subaccounts) + description: The subaccount number that holds this position (0 for primary, 1-63 for subaccounts) market_ticker: type: string description: Market ticker symbol position: $ref: '#/components/schemas/FixedPointCount' - description: >- - Position size as a fixed-point count string (positive = long, - negative = short) + description: Position size as a fixed-point count string (positive = long, negative = short) entry_price: $ref: '#/components/schemas/FixedPointDollars' description: Weighted average entry price of the open position @@ -2390,30 +2371,19 @@ components: margin_used: $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Maintenance-margin-based capital usage for the open position. Null - when the position shares its asset class with other portfolio-margin - positions in the subaccount, since margin is then computed jointly - for the group and cannot be attributed to a single market. + description: Maintenance-margin-based capital usage for the open position. Null when the position shares its asset class with other portfolio-margin positions in the subaccount, since margin is then computed jointly for the group and cannot be attributed to a single market. fees: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Total fees accumulated over the lifetime of the current open - position, resets when position is fully closed + description: Total fees accumulated over the lifetime of the current open position, resets when position is fully closed roe: type: number format: double nullable: true - description: >- - Return on equity as a percentage (unrealized_pnl / margin_used * - 100). Null when margin_used is zero or not attributable to this - market. + description: Return on equity as a percentage (unrealized_pnl / margin_used * 100). Null when margin_used is zero or not attributable to this market. is_portfolio: type: boolean - description: >- - True when this position is hedged within a portfolio, so margin_used - and roe cannot be attributed to it individually and are not - reported. + description: 'True when this position is hedged within a portfolio, so margin_used and roe cannot be attributed to it individually and are not reported.' + GetMarginTradesResponse: type: object required: @@ -2426,6 +2396,7 @@ components: $ref: '#/components/schemas/MarginTrade' cursor: type: string + MarginTrade: type: object required: @@ -2457,10 +2428,9 @@ components: description: Side of the taker in this trade BookSide: type: string - enum: - - bid - - ask + enum: ['bid', 'ask'] description: The side of an order or trade (bid or ask) + MarginEnabledResponse: type: object required: @@ -2469,6 +2439,7 @@ components: enabled: type: boolean description: Indicates whether margin trading is enabled for the user + NotionalRiskLimitResponse: type: object required: @@ -2477,21 +2448,16 @@ components: properties: default_notional_value_risk_limit: type: string - description: >- - The notional value risk limit for the user as a fixed-point dollar - string with 4 decimal places (e.g., "5000.0000") - example: '5000.0000' + description: The notional value risk limit for the user as a fixed-point dollar string with 4 decimal places (e.g., "5000.0000") + example: "5000.0000" notional_value_risk_limits_by_market_ticker: type: object additionalProperties: type: string - description: >- - Map of market_ticker to notional value risk limit as a fixed-point - dollar string with 4 decimal places (e.g., "5000.0000"). If present, - the market-level risk limit overrides the default notional value - risk limit. + description: Map of market_ticker to notional value risk limit as a fixed-point dollar string with 4 decimal places (e.g., "5000.0000"). If present, the market-level risk limit overrides the default notional value risk limit. example: - market-abc-123: '5000.0000' + "market-abc-123": "5000.0000" + MarginSubaccountBalance: type: object required: @@ -2508,34 +2474,23 @@ components: description: The subaccount number (0 for primary, 1-63 for subaccounts) position_value: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Mark-to-market value of open positions for this subaccount in - fixed-point dollars + description: Mark-to-market value of open positions for this subaccount in fixed-point dollars account_equity: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Account equity for this subaccount in fixed-point dollars. 0 for - self clearing members. + description: Account equity for this subaccount in fixed-point dollars. 0 for self clearing members. maintenance_margin: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Maintenance margin requirement for this subaccount in fixed-point - dollars + description: Maintenance margin requirement for this subaccount in fixed-point dollars initial_margin: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Initial margin requirement for this subaccount in fixed-point - dollars. 0 for self clearing members. + description: Initial margin requirement for this subaccount in fixed-point dollars. 0 for self clearing members. resting_orders_margin: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Margin locked by resting orders for this subaccount in fixed-point - dollars. 0 unless compute_available_balance is passed. + description: Margin locked by resting orders for this subaccount in fixed-point dollars. 0 unless compute_available_balance is passed. available_balance: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Available balance for this subaccount in fixed-point dollars. 0 for - institutional users or if compute_available_balance was not passed. + description: Available balance for this subaccount in fixed-point dollars. 0 for institutional users or if compute_available_balance was not passed. + GetMarginBalanceResponse: type: object required: @@ -2550,6 +2505,7 @@ components: settled_funds: $ref: '#/components/schemas/FixedPointDollars' description: Total settled funds across all subaccounts in fixed-point dollars + MarginRiskPosition: type: object required: @@ -2574,36 +2530,24 @@ components: description: Current mark price for the market in fixed-point dollars position_notional: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Absolute notional value of the position (|qty| * mark_price) in - fixed-point dollars + description: Absolute notional value of the position (|qty| * mark_price) in fixed-point dollars maintenance_margin_required: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Maintenance margin requirement for this position in fixed-point - dollars. Null if margin config is missing. + description: Maintenance margin requirement for this position in fixed-point dollars. Null if margin config is missing. nullable: true position_leverage: type: number format: double - description: >- - Position leverage ratio (position_notional / - maintenance_margin_required). Null when maintenance margin is zero - or config is missing. + description: 'Position leverage ratio (position_notional / maintenance_margin_required). Null when maintenance margin is zero or config is missing.' nullable: true estimated_liquidation_price: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Estimated portfolio-aware liquidation price for this position within - the subaccount. Null when no valid liquidation price exists. + description: 'Estimated portfolio-aware liquidation price for this position within the subaccount. Null when no valid liquidation price exists.' nullable: true is_portfolio: type: boolean - description: >- - True when this position is hedged within a portfolio, so - maintenance_margin_required, position_leverage, and - estimated_liquidation_price cannot be attributed to it individually - and are not reported. + description: 'True when this position is hedged within a portfolio, so maintenance_margin_required, position_leverage, and estimated_liquidation_price cannot be attributed to it individually and are not reported.' + GetMarginRiskResponse: type: object required: @@ -2614,26 +2558,20 @@ components: account_leverage: type: number format: double - description: >- - Account-level leverage (total_position_notional / - total_maintenance_margin). Null when total maintenance margin is - zero. + description: 'Account-level leverage (total_position_notional / total_maintenance_margin). Null when total maintenance margin is zero.' nullable: true total_position_notional: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Sum of absolute position notional values across all positions in - fixed-point dollars + description: Sum of absolute position notional values across all positions in fixed-point dollars total_maintenance_margin: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Sum of maintenance margin requirements across all positions in - fixed-point dollars + description: Sum of maintenance margin requirements across all positions in fixed-point dollars positions: type: array items: $ref: '#/components/schemas/MarginRiskPosition' description: Per-position risk breakdown grouped by subaccount and market + GetMarginFeeTiersResponse: type: object required: @@ -2645,19 +2583,14 @@ components: additionalProperties: type: number format: double - description: >- - A map of margin market ticker to the maker-side fee rate as a - decimal fraction of notional (e.g. 0.0005 = 0.05% = 5 bps). Multiply - notional by this value to compute the fee. + description: A map of margin market ticker to the maker-side fee rate as a decimal fraction of notional (e.g. 0.0005 = 0.05% = 5 bps). Multiply notional by this value to compute the fee. taker_fee_rates: type: object additionalProperties: type: number format: double - description: >- - A map of margin market ticker to the taker-side fee rate as a - decimal fraction of notional (e.g. 0.0012 = 0.12% = 12 bps). - Multiply notional by this value to compute the fee. + description: A map of margin market ticker to the taker-side fee rate as a decimal fraction of notional (e.g. 0.0012 = 0.12% = 12 bps). Multiply notional by this value to compute the fee. + MarginFundingHistoryEntry: type: object required: @@ -2685,9 +2618,7 @@ components: description: Mark price at the time of funding funding_amount: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Dollar amount of the funding payment (positive = received, negative - = paid) + description: Dollar amount of the funding payment (positive = received, negative = paid) quantity: $ref: '#/components/schemas/FixedPointCount' description: Position size at time of funding as a fixed-point count string @@ -2695,6 +2626,7 @@ components: type: integer nullable: true description: Subaccount number (0 for primary) + GetMarginFundingHistoryResponse: type: object required: @@ -2705,6 +2637,7 @@ components: items: $ref: '#/components/schemas/MarginFundingHistoryEntry' description: Array of historical funding payment entries + MarginFundingRate: type: object required: @@ -2727,6 +2660,7 @@ components: mark_price: $ref: '#/components/schemas/FixedPointDollars' description: Mark price at the time of funding + GetMarginHistoricalFundingRatesResponse: type: object required: @@ -2737,6 +2671,7 @@ components: items: $ref: '#/components/schemas/MarginFundingRate' description: Array of historical funding rate entries + GetMarginFundingRateEstimateResponse: type: object required: @@ -2760,6 +2695,7 @@ components: type: string format: date-time description: Timestamp of the next scheduled funding event + GetMarginMarketCandlesticksResponse: type: object required: @@ -2774,6 +2710,7 @@ components: description: Array of candlestick data points for the specified time range. items: $ref: '#/components/schemas/MarginMarketCandlestick' + MarginMarketCandlestick: type: object required: @@ -2792,39 +2729,26 @@ components: description: Unix timestamp for the inclusive end of the candlestick period. bid: $ref: '#/components/schemas/BidAskDistributionHistorical' - description: >- - Open, high, low, close (OHLC) data for buy offers on the market - during the candlestick period. + description: Open, high, low, close (OHLC) data for buy offers on the market during the candlestick period. ask: $ref: '#/components/schemas/BidAskDistributionHistorical' - description: >- - Open, high, low, close (OHLC) data for sell offers on the market - during the candlestick period. + description: Open, high, low, close (OHLC) data for sell offers on the market during the candlestick period. price: $ref: '#/components/schemas/PriceDistributionHistorical' - description: >- - Open, high, low, close (OHLC) and more data for trade prices on the - market during the candlestick period. + description: Open, high, low, close (OHLC) and more data for trade prices on the market during the candlestick period. volume: $ref: '#/components/schemas/FixedPointCount' - description: >- - Number of contracts traded on the market during the candlestick - period. + description: Number of contracts traded on the market during the candlestick period. volume_notional_value_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Notional value of contracts traded on the market during the - candlestick period. + description: Notional value of contracts traded on the market during the candlestick period. open_interest: $ref: '#/components/schemas/FixedPointCount' - description: >- - Number of contracts held on the market by end of the candlestick - period (end_period_ts). + description: Number of contracts held on the market by end of the candlestick period (end_period_ts). open_interest_notional_value_dollars: $ref: '#/components/schemas/FixedPointDollars' - description: >- - Notional value of contracts held on the market by end of the - candlestick period (end_period_ts). + description: Notional value of contracts held on the market by end of the candlestick period (end_period_ts). + BidAskDistributionHistorical: type: object required: @@ -2832,10 +2756,7 @@ components: - low - high - close - description: >- - OHLC data for quoted prices on one side of the orderbook during the - candlestick period. These values reflect bid or ask quotes, not executed - trade prices. + description: OHLC data for quoted prices on one side of the orderbook during the candlestick period. These values reflect bid or ask quotes, not executed trade prices. properties: open: $ref: '#/components/schemas/FixedPointDollars' @@ -2849,6 +2770,7 @@ components: close: $ref: '#/components/schemas/FixedPointDollars' description: Quoted price at the end of the candlestick period (in dollars). + PriceDistributionHistorical: type: object required: @@ -2863,52 +2785,38 @@ components: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Price of the first trade during the candlestick period (in dollars). - Null if no trades occurred. + description: Price of the first trade during the candlestick period (in dollars). Null if no trades occurred. low: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Lowest trade price during the candlestick period (in dollars). Null - if no trades occurred. + description: Lowest trade price during the candlestick period (in dollars). Null if no trades occurred. high: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Highest trade price during the candlestick period (in dollars). Null - if no trades occurred. + description: Highest trade price during the candlestick period (in dollars). Null if no trades occurred. close: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Price of the last trade during the candlestick period (in dollars). - Null if no trades occurred. + description: Price of the last trade during the candlestick period (in dollars). Null if no trades occurred. mean: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Volume-weighted average price during the candlestick period (in - dollars). Null if no trades occurred. + description: Volume-weighted average price during the candlestick period (in dollars). Null if no trades occurred. previous: allOf: - $ref: '#/components/schemas/FixedPointDollars' nullable: true - description: >- - Close price from the previous candlestick period (in dollars). Null - if this is the first candlestick or no prior trade exists. + description: Close price from the previous candlestick period (in dollars). Null if this is the first candlestick or no prior trade exists. + parameters: CursorQuery: name: cursor in: query - description: >- - Pagination cursor. Use the cursor value returned from the previous - response to get the next page of results. Leave empty for the first - page. + description: Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. schema: type: string x-go-type-skip-optional-pointer: true @@ -2923,7 +2831,7 @@ components: maximum: 1000 default: 100 x-oapi-codegen-extra-tags: - validate: omitempty,min=1,max=1000 + validate: "omitempty,min=1,max=1000" MarginOrdersLimitQuery: name: limit in: query @@ -2935,7 +2843,7 @@ components: maximum: 10000 default: 10000 x-oapi-codegen-extra-tags: - validate: omitempty,min=1,max=10000 + validate: "omitempty,min=1,max=10000" MaxTsQuery: name: max_ts in: query @@ -2981,9 +2889,7 @@ components: name: subaccount in: query required: false - description: >- - Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, - defaults to all subaccounts. + description: Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. schema: type: integer minimum: 0 diff --git a/specs/perps_scm_openapi.yaml b/specs/perps_scm_openapi.yaml index 014cb01..c0219d2 100644 --- a/specs/perps_scm_openapi.yaml +++ b/specs/perps_scm_openapi.yaml @@ -687,6 +687,7 @@ components: quantity_centicount: { type: integer, format: int64, description: Position quantity in centicounts. } variation_margin_centicents: { type: integer, format: int64, description: Variation margin for this market. } notional_value_centicents: { type: integer, format: int64, description: Notional value for this market. } + session_avg_price_fp: { type: string, description: Average entry price for the current settlement session, as a fixed-point dollar string. Omitted when the position quantity is zero. } SettlementEstimate: type: object diff --git a/tests/_contract_support.py b/tests/_contract_support.py index cc2d91a..afc1f5a 100644 --- a/tests/_contract_support.py +++ b/tests/_contract_support.py @@ -1550,6 +1550,22 @@ class Exclusion: path_template="/margin/fcm/subtraders", request_body_schema="#/components/schemas/CreateMarginFCMSubtraderRequest", ), + MethodEndpointEntry( + sdk_method="kalshi.perps.resources.fcm.FcmResource.risk_controls", + http_method="GET", + path_template="/margin/fcm/subtraders/risk_controls", + ), + MethodEndpointEntry( + sdk_method="kalshi.perps.resources.fcm.FcmResource.update_risk_controls", + http_method="PUT", + path_template="/margin/fcm/subtraders/risk_controls", + request_body_schema="#/components/schemas/UpdateFCMSubtraderRiskControlsRequest", + ), + MethodEndpointEntry( + sdk_method="kalshi.perps.resources.fcm.FcmResource.delete_risk_controls", + http_method="DELETE", + path_template="/margin/fcm/subtraders/risk_controls", + ), ] # SCM/Klear endpoints — validated against ``specs/perps_scm_openapi.yaml``. diff --git a/tests/perps/klear/test_margin.py b/tests/perps/klear/test_margin.py index 13ae7de..83a8608 100644 --- a/tests/perps/klear/test_margin.py +++ b/tests/perps/klear/test_margin.py @@ -368,6 +368,27 @@ async def test_async_happy(self, auth_async_klear_client: AsyncKlearClient) -> N assert resp.settlement_balance_centicents == 7 await auth_async_klear_client.close() + def test_session_avg_price_fp_optional(self) -> None: + from decimal import Decimal + + from kalshi.perps.klear.models.margin import MarketSettlementEstimate + + bare = MarketSettlementEstimate( + quantity_centicount=1, + variation_margin_centicents=2, + notional_value_centicents=3, + ) + assert bare.session_avg_price_fp is None + parsed = MarketSettlementEstimate.model_validate( + { + "quantity_centicount": 1, + "variation_margin_centicents": 2, + "notional_value_centicents": 3, + "session_avg_price_fp": "123.4500", + } + ) + assert parsed.session_avg_price_fp == Decimal("123.4500") + # --------------------------------------------------------------------------- # # obligation_history / obligation_history_all diff --git a/tests/perps/test_fcm.py b/tests/perps/test_fcm.py index c99c96b..7d11010 100644 --- a/tests/perps/test_fcm.py +++ b/tests/perps/test_fcm.py @@ -3,6 +3,7 @@ from __future__ import annotations import json +from decimal import Decimal import httpx import pytest @@ -10,10 +11,11 @@ from pydantic import ValidationError from kalshi.errors import AuthRequiredError -from kalshi.perps import PerpsClient, PerpsConfig +from kalshi.perps import AsyncPerpsClient, PerpsClient, PerpsConfig from kalshi.perps.models.fcm import ( CreateMarginFCMSubtraderRequest, CreateMarginFCMSubtraderResponse, + UpdateFCMSubtraderRiskControlsRequest, ) BASE = "https://external-api.demo.kalshi.co/trade-api/v2" @@ -68,3 +70,160 @@ def test_unauthenticated_raises(self) -> None: client = PerpsClient(config=PerpsConfig.demo(max_retries=0)) with pytest.raises(AuthRequiredError): client.fcm.create_subtrader(subtrader_suffix="desk1") + + +class TestUpdateFCMSubtraderRiskControlsRequest: + def test_serializes(self) -> None: + req = UpdateFCMSubtraderRiskControlsRequest( + subtrader_id="user_desk1", + im_cap=Decimal("100.0000"), + market_ticker="BTC-PERP", + ) + assert req.model_dump(exclude_none=True, by_alias=True, mode="json") == { + "subtrader_id": "user_desk1", + "im_cap": "100.0000", + "market_ticker": "BTC-PERP", + } + + def test_rejects_negative_im_cap(self) -> None: + with pytest.raises(ValidationError): + UpdateFCMSubtraderRiskControlsRequest( + subtrader_id="user_desk1", + im_cap=Decimal("-1.00"), + ) + + def test_forbids_extra(self) -> None: + with pytest.raises(ValidationError): + UpdateFCMSubtraderRiskControlsRequest( # type: ignore[call-arg] + subtrader_id="user_desk1", + im_cap=Decimal("1.00"), + phantom=1, + ) + + +class TestFcmRiskControls: + @respx.mock + def test_get_risk_controls(self, perps_client: PerpsClient) -> None: + route = respx.get(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response( + 200, + json={ + "risk_controls": [ + { + "subtrader_id": "user_desk1", + "im_cap": "100.0000", + }, + { + "subtrader_id": "user_desk1", + "market_ticker": "BTC-PERP", + "im_cap": "25.5000", + }, + ] + }, + ) + ) + resp = perps_client.fcm.risk_controls(subtrader_id="user_desk1") + assert len(resp.risk_controls) == 2 + assert resp.risk_controls[0].market_ticker is None + assert resp.risk_controls[0].im_cap == Decimal("100.0000") + assert resp.risk_controls[1].market_ticker == "BTC-PERP" + assert dict(route.calls[0].request.url.params) == {"subtrader_id": "user_desk1"} + + @respx.mock + def test_get_risk_controls_filters_market(self, perps_client: PerpsClient) -> None: + route = respx.get(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response(200, json={"risk_controls": []}) + ) + perps_client.fcm.risk_controls(subtrader_id="user_desk1", market_ticker="ETH-PERP") + assert dict(route.calls[0].request.url.params) == { + "subtrader_id": "user_desk1", + "market_ticker": "ETH-PERP", + } + + @respx.mock + def test_update_risk_controls_kwargs(self, perps_client: PerpsClient) -> None: + route = respx.put(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response(200, json={}) + ) + perps_client.fcm.update_risk_controls( + subtrader_id="user_desk1", + im_cap=Decimal("50.0000"), + market_ticker="BTC-PERP", + ) + assert json.loads(route.calls[0].request.content) == { + "subtrader_id": "user_desk1", + "im_cap": "50.0000", + "market_ticker": "BTC-PERP", + } + + @respx.mock + def test_update_risk_controls_request_model(self, perps_client: PerpsClient) -> None: + route = respx.put(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response(200, json={}) + ) + req = UpdateFCMSubtraderRiskControlsRequest( + subtrader_id="user_a", + im_cap=Decimal("10.00"), + ) + perps_client.fcm.update_risk_controls(request=req) + assert json.loads(route.calls[0].request.content) == { + "subtrader_id": "user_a", + "im_cap": "10.00", + } + assert route.called + + def test_update_requires_args(self, perps_client: PerpsClient) -> None: + with pytest.raises(TypeError, match="update_risk_controls"): + perps_client.fcm.update_risk_controls() # type: ignore[call-overload] + + @respx.mock + def test_delete_risk_controls(self, perps_client: PerpsClient) -> None: + route = respx.delete(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response(200, json={}) + ) + perps_client.fcm.delete_risk_controls( + subtrader_id="user_desk1", + market_ticker="BTC-PERP", + ) + assert dict(route.calls[0].request.url.params) == { + "subtrader_id": "user_desk1", + "market_ticker": "BTC-PERP", + } + + def test_unauthenticated_raises(self) -> None: + client = PerpsClient(config=PerpsConfig.demo(max_retries=0)) + with pytest.raises(AuthRequiredError): + client.fcm.risk_controls(subtrader_id="user_desk1") + with pytest.raises(AuthRequiredError): + client.fcm.update_risk_controls(subtrader_id="user_desk1", im_cap=Decimal("1")) + with pytest.raises(AuthRequiredError): + client.fcm.delete_risk_controls(subtrader_id="user_desk1") + + +class TestAsyncFcmRiskControls: + @respx.mock + @pytest.mark.asyncio + async def test_async_roundtrip(self, async_perps_client: AsyncPerpsClient) -> None: + respx.get(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response( + 200, + json={ + "risk_controls": [ + {"subtrader_id": "user_desk1", "im_cap": "1.0000"}, + ] + }, + ) + ) + respx.put(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response(200, json={}) + ) + respx.delete(f"{BASE}/margin/fcm/subtraders/risk_controls").mock( + return_value=httpx.Response(200, json={}) + ) + resp = await async_perps_client.fcm.risk_controls(subtrader_id="user_desk1") + assert resp.risk_controls[0].im_cap == Decimal("1.0000") + await async_perps_client.fcm.update_risk_controls( + subtrader_id="user_desk1", + im_cap=Decimal("2.00"), + ) + await async_perps_client.fcm.delete_risk_controls(subtrader_id="user_desk1") diff --git a/tests/test_async_orders.py b/tests/test_async_orders.py index 82b29d6..dfd7a1a 100644 --- a/tests/test_async_orders.py +++ b/tests/test_async_orders.py @@ -121,6 +121,7 @@ async def test_list_with_all_new_filters(self, orders: AsyncOrdersResource) -> N limit=50, cursor="abc", subaccount=7, + exchange_index=0, ) params = dict(route.calls[0].request.url.params) assert params["ticker"] == "MKT-A" @@ -131,6 +132,7 @@ async def test_list_with_all_new_filters(self, orders: AsyncOrdersResource) -> N assert params["limit"] == "50" assert params["cursor"] == "abc" assert params["subaccount"] == "7" + assert params["exchange_index"] == "0" @respx.mock @pytest.mark.asyncio diff --git a/tests/test_contracts.py b/tests/test_contracts.py index d24dd7b..178c0bf 100644 --- a/tests/test_contracts.py +++ b/tests/test_contracts.py @@ -1486,6 +1486,9 @@ def _assert_params_match( "#/components/schemas/CreateMarginFCMSubtraderRequest": ( "kalshi.perps.models.fcm.CreateMarginFCMSubtraderRequest" ), + "#/components/schemas/UpdateFCMSubtraderRiskControlsRequest": ( + "kalshi.perps.models.fcm.UpdateFCMSubtraderRiskControlsRequest" + ), } PERPS_SCM_BODY_MODEL_MAP: dict[str, str] = { diff --git a/tests/test_orders.py b/tests/test_orders.py index 38fef2b..31b9beb 100644 --- a/tests/test_orders.py +++ b/tests/test_orders.py @@ -116,6 +116,7 @@ def test_list_with_all_new_filters(self, orders: OrdersResource) -> None: limit=50, cursor="abc", subaccount=7, + exchange_index=0, ) params = dict(route.calls[0].request.url.params) assert params["ticker"] == "MKT-A" @@ -126,6 +127,7 @@ def test_list_with_all_new_filters(self, orders: OrdersResource) -> None: assert params["limit"] == "50" assert params["cursor"] == "abc" assert params["subaccount"] == "7" + assert params["exchange_index"] == "0" @respx.mock def test_list_accepts_event_ticker_list(self, orders: OrdersResource) -> None: @@ -188,6 +190,7 @@ def test_list_all_with_all_new_filters(self, orders: OrdersResource) -> None: max_ts=1700099999, limit=50, subaccount=7, + exchange_index=1, ) ) params = dict(route.calls[0].request.url.params) @@ -198,6 +201,7 @@ def test_list_all_with_all_new_filters(self, orders: OrdersResource) -> None: assert params["max_ts"] == "1700099999" assert params["limit"] == "50" assert params["subaccount"] == "7" + assert params["exchange_index"] == "1" class TestOrdersFills: @@ -234,6 +238,7 @@ def test_fills_with_all_new_filters(self, orders: OrdersResource) -> None: limit=50, cursor="abc", subaccount=7, + exchange_index=0, ) params = dict(route.calls[0].request.url.params) assert params["ticker"] == "MKT-A" @@ -243,6 +248,7 @@ def test_fills_with_all_new_filters(self, orders: OrdersResource) -> None: assert params["limit"] == "50" assert params["cursor"] == "abc" assert params["subaccount"] == "7" + assert params["exchange_index"] == "0" class TestOrdersFillsAll: @@ -286,6 +292,7 @@ def test_fills_all_with_all_new_filters(self, orders: OrdersResource) -> None: max_ts=1700099999, limit=50, subaccount=7, + exchange_index=2, ) ) params = dict(route.calls[0].request.url.params) @@ -295,6 +302,7 @@ def test_fills_all_with_all_new_filters(self, orders: OrdersResource) -> None: assert params["max_ts"] == "1700099999" assert params["limit"] == "50" assert params["subaccount"] == "7" + assert params["exchange_index"] == "2" class TestOrdersQueuePositions: diff --git a/tests/test_portfolio.py b/tests/test_portfolio.py index d7382b3..4b2831d 100644 --- a/tests/test_portfolio.py +++ b/tests/test_portfolio.py @@ -263,6 +263,7 @@ def test_positions_with_all_new_filters(self, portfolio: PortfolioResource) -> N ticker="MKT-A", event_ticker="EVT-X", subaccount=7, + exchange_index=0, ) params = dict(route.calls[0].request.url.params) assert params["limit"] == "50" @@ -271,6 +272,7 @@ def test_positions_with_all_new_filters(self, portfolio: PortfolioResource) -> N assert params["ticker"] == "MKT-A" assert params["event_ticker"] == "EVT-X" assert params["subaccount"] == "7" + assert params["exchange_index"] == "0" class TestPortfolioPositionsAll: @@ -318,6 +320,7 @@ def test_positions_all_forwards_filters_and_omits_cursor( ticker="MKT-A", event_ticker="EVT-X", subaccount=3, + exchange_index=1, ) ) params = dict(route.calls[0].request.url.params) @@ -326,6 +329,7 @@ def test_positions_all_forwards_filters_and_omits_cursor( assert params["ticker"] == "MKT-A" assert params["event_ticker"] == "EVT-X" assert params["subaccount"] == "3" + assert params["exchange_index"] == "1" assert "cursor" not in params def test_positions_all_requires_auth(self, unauth_portfolio: PortfolioResource) -> None: @@ -506,11 +510,19 @@ def test_returns_value(self, portfolio: PortfolioResource) -> None: ).mock( return_value=httpx.Response( 200, - json={"total_resting_order_value": 12345}, + json={ + "total_resting_order_value": 12345, + "resting_order_value_breakdown": [ + {"exchange_index": 0, "balance": "123.4500"}, + ], + }, ) ) result = portfolio.total_resting_order_value() assert result.total_resting_order_value == 12345 + assert len(result.resting_order_value_breakdown) == 1 + assert result.resting_order_value_breakdown[0].exchange_index == 0 + assert result.resting_order_value_breakdown[0].balance == Decimal("123.4500") @respx.mock def test_unauthorized(self, portfolio: PortfolioResource) -> None: @@ -798,6 +810,7 @@ async def test_positions_with_all_new_filters( ticker="MKT-A", event_ticker="EVT-X", subaccount=7, + exchange_index=0, ) params = dict(route.calls[0].request.url.params) assert params["limit"] == "50" @@ -806,6 +819,7 @@ async def test_positions_with_all_new_filters( assert params["ticker"] == "MKT-A" assert params["event_ticker"] == "EVT-X" assert params["subaccount"] == "7" + assert params["exchange_index"] == "0" class TestAsyncPortfolioSettlements: @@ -947,7 +961,10 @@ async def test_returns_value( ).mock( return_value=httpx.Response( 200, - json={"total_resting_order_value": 99999}, + json={ + "total_resting_order_value": 99999, + "resting_order_value_breakdown": [], + }, ) ) result = await async_portfolio.total_resting_order_value() @@ -1174,6 +1191,7 @@ def test_fills_cursor_and_filter_parity(self, portfolio: PortfolioResource) -> N limit=50, cursor="abc", subaccount=7, + exchange_index=0, ) params = dict(route.calls[0].request.url.params) assert params["ticker"] == "MKT-A" @@ -1183,6 +1201,7 @@ def test_fills_cursor_and_filter_parity(self, portfolio: PortfolioResource) -> N assert params["limit"] == "50" assert params["cursor"] == "abc" assert params["subaccount"] == "7" + assert params["exchange_index"] == "0" def test_fills_requires_auth(self, unauth_portfolio: PortfolioResource) -> None: with pytest.raises(AuthRequiredError): @@ -1260,6 +1279,7 @@ async def test_fills_cursor_and_filter_parity( limit=50, cursor="abc", subaccount=7, + exchange_index=0, ) params = dict(route.calls[0].request.url.params) assert params["ticker"] == "MKT-A" @@ -1269,6 +1289,7 @@ async def test_fills_cursor_and_filter_parity( assert params["limit"] == "50" assert params["cursor"] == "abc" assert params["subaccount"] == "7" + assert params["exchange_index"] == "0" @pytest.mark.asyncio async def test_fills_requires_auth(