/* tslint:disable */ /* eslint-disable */ /** * Kalshi Trade API Manual Endpoints * Manually defined OpenAPI spec for endpoints being migrated to spec-first approach * * The version of the OpenAPI document: 3.36.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; // URLSearchParams not necessarily used // @ts-ignore import { URL, URLSearchParams } from 'url'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import type { AmendOrderV2Request } from '../models'; // @ts-ignore import type { AmendOrderV2Response } from '../models'; // @ts-ignore import type { BatchCancelOrdersV2Request } from '../models'; // @ts-ignore import type { BatchCancelOrdersV2Response } from '../models'; // @ts-ignore import type { BatchCreateOrdersV2Request } from '../models'; // @ts-ignore import type { BatchCreateOrdersV2Response } from '../models'; // @ts-ignore import type { CancelOrderV2Response } from '../models'; // @ts-ignore import type { CreateOrderV2Request } from '../models'; // @ts-ignore import type { CreateOrderV2Response } from '../models'; // @ts-ignore import type { DecreaseOrderV2Request } from '../models'; // @ts-ignore import type { DecreaseOrderV2Response } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; // @ts-ignore import type { GetOrderQueuePositionResponse } from '../models'; // @ts-ignore import type { GetOrderQueuePositionsResponse } from '../models'; // @ts-ignore import type { GetOrderResponse } from '../models'; // @ts-ignore import type { GetOrdersResponse } from '../models'; /** * OrdersApi - axios parameter creator */ export const OrdersApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Endpoint for amending the price, max fillable count, and/or expiration time of an existing event-market order. 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. * @summary Amend Order (V2) * @param {string} orderId Order ID * @param {AmendOrderV2Request} amendOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ amendOrderV2: async (orderId: string, amendOrderV2Request: AmendOrderV2Request, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('amendOrderV2', 'orderId', orderId) // verify required parameter 'amendOrderV2Request' is not null or undefined assertParamExists('amendOrderV2', 'amendOrderV2Request', amendOrderV2Request) const localVarPath = `/portfolio/events/orders/{order_id}/amend` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) if (subaccount !== undefined) { localVarQueryParameter['subaccount'] = subaccount; } localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(amendOrderV2Request, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for cancelling a batch of event-market orders using the V2 response shape. To auto-route a cancellation, provide its `market_ticker` and omit `exchange_index` or set it to `-1`. The maximum batch size scales with your tier\'s write budget — see [Rate Limits and Tiers](/getting_started/rate_limits). * @summary Batch Cancel Orders (V2) * @param {BatchCancelOrdersV2Request} batchCancelOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCancelOrdersV2: async (batchCancelOrdersV2Request: BatchCancelOrdersV2Request, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'batchCancelOrdersV2Request' is not null or undefined assertParamExists('batchCancelOrdersV2', 'batchCancelOrdersV2Request', batchCancelOrdersV2Request) const localVarPath = `/portfolio/events/orders/batched`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(batchCancelOrdersV2Request, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * 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). * @summary Batch Create Orders (V2) * @param {BatchCreateOrdersV2Request} batchCreateOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCreateOrdersV2: async (batchCreateOrdersV2Request: BatchCreateOrdersV2Request, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'batchCreateOrdersV2Request' is not null or undefined assertParamExists('batchCreateOrdersV2', 'batchCreateOrdersV2Request', batchCreateOrdersV2Request) const localVarPath = `/portfolio/events/orders/batched`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(batchCreateOrdersV2Request, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Cancels all resting event-market orders for the authenticated Direct member across every exchange shard. If `subaccount` is omitted, matching orders may come from any subaccount. If it is provided, only orders for that subaccount are eligible. Newly placed orders may also be cancelled during the minute after the request. * @summary Cancel All Orders * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancelAllOrders: async (subaccount?: number, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/portfolio/events/orders`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) if (subaccount !== undefined) { localVarQueryParameter['subaccount'] = subaccount; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for cancelling event-market orders using the V2 response shape. To auto-route the cancellation, provide `market_ticker` and omit `exchange_index` or set it to `-1`. Returns `{order_id, client_order_id, reduced_by}` rather than a full order object. * @summary Cancel Order (V2) * @param {string} orderId Order ID * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {number} [exchangeIndex] Exchange shard index. If omitted, auto-routes when market_ticker is provided; otherwise defaults to 0. Use -1 to require auto-routing. The market_ticker parameter is required for auto-routing. * @param {string} [marketTicker] Market ticker. Required for auto-routing when exchange_index is omitted or -1. * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancelOrderV2: async (orderId: string, subaccount?: number, exchangeIndex?: number, marketTicker?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('cancelOrderV2', 'orderId', orderId) const localVarPath = `/portfolio/events/orders/{order_id}` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) if (subaccount !== undefined) { localVarQueryParameter['subaccount'] = subaccount; } if (exchangeIndex !== undefined) { localVarQueryParameter['exchange_index'] = exchangeIndex; } if (marketTicker !== undefined) { localVarQueryParameter['market_ticker'] = marketTicker; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * 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. * @summary Create Order (V2) * @param {CreateOrderV2Request} createOrderV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ createOrderV2: async (createOrderV2Request: CreateOrderV2Request, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'createOrderV2Request' is not null or undefined assertParamExists('createOrderV2', 'createOrderV2Request', createOrderV2Request) const localVarPath = `/portfolio/events/orders`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(createOrderV2Request, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * 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. * @summary Decrease Order (V2) * @param {string} orderId Order ID * @param {DecreaseOrderV2Request} decreaseOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ decreaseOrderV2: async (orderId: string, decreaseOrderV2Request: DecreaseOrderV2Request, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('decreaseOrderV2', 'orderId', orderId) // verify required parameter 'decreaseOrderV2Request' is not null or undefined assertParamExists('decreaseOrderV2', 'decreaseOrderV2Request', decreaseOrderV2Request) const localVarPath = `/portfolio/events/orders/{order_id}/decrease` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) if (subaccount !== undefined) { localVarQueryParameter['subaccount'] = subaccount; } localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(decreaseOrderV2Request, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for getting a single order. * @summary Get Order * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrder: async (orderId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('getOrder', 'orderId', orderId) const localVarPath = `/portfolio/orders/{order_id}` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for getting an order\'s queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority. * @summary Get Order Queue Position * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrderQueuePosition: async (orderId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'orderId' is not null or undefined assertParamExists('getOrderQueuePosition', 'orderId', orderId) const localVarPath = `/portfolio/orders/{order_id}/queue_position` .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority. * @summary Get Queue Positions for Orders * @param {string} [marketTickers] Comma-separated list of market tickers to filter by * @param {string} [eventTicker] Event ticker to filter by * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrderQueuePositions: async (marketTickers?: string, eventTicker?: string, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/portfolio/orders/queue_positions`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) if (marketTickers !== undefined) { localVarQueryParameter['market_tickers'] = marketTickers; } if (eventTicker !== undefined) { localVarQueryParameter['event_ticker'] = eventTicker; } if (subaccount !== undefined) { localVarQueryParameter['subaccount'] = subaccount; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * 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. * @summary Get Orders * @param {string} [ticker] Filter by market ticker * @param {string} [eventTicker] Event tickers to filter by, as a comma-separated list (maximum 100). Events with no markets return no orders. * @param {number} [minTs] Filter items after this Unix timestamp * @param {number} [maxTs] Filter items before this Unix timestamp * @param {string} [status] Filter by status. Possible values depend on the endpoint. * @param {number} [limit] Number of results per page. Defaults to 100. * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {number} [exchangeIndex] Filter results by exchange shard. Omit to return results from all exchange shards. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrders: async (ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, status?: string, limit?: number, cursor?: string, subaccount?: number, exchangeIndex?: number, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/portfolio/orders`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication kalshiAccessSignature required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration) // authentication kalshiAccessKey required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration) // authentication kalshiAccessTimestamp required await setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration) if (ticker !== undefined) { localVarQueryParameter['ticker'] = ticker; } if (eventTicker !== undefined) { localVarQueryParameter['event_ticker'] = eventTicker; } if (minTs !== undefined) { localVarQueryParameter['min_ts'] = minTs; } if (maxTs !== undefined) { localVarQueryParameter['max_ts'] = maxTs; } if (status !== undefined) { localVarQueryParameter['status'] = status; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } if (subaccount !== undefined) { localVarQueryParameter['subaccount'] = subaccount; } if (exchangeIndex !== undefined) { localVarQueryParameter['exchange_index'] = exchangeIndex; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * OrdersApi - functional programming interface */ export const OrdersApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = OrdersApiAxiosParamCreator(configuration) return { /** * Endpoint for amending the price, max fillable count, and/or expiration time of an existing event-market order. 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. * @summary Amend Order (V2) * @param {string} orderId Order ID * @param {AmendOrderV2Request} amendOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async amendOrderV2(orderId: string, amendOrderV2Request: AmendOrderV2Request, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.amendOrderV2(orderId, amendOrderV2Request, subaccount, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Endpoint for cancelling a batch of event-market orders using the V2 response shape. To auto-route a cancellation, provide its `market_ticker` and omit `exchange_index` or set it to `-1`. The maximum batch size scales with your tier\'s write budget — see [Rate Limits and Tiers](/getting_started/rate_limits). * @summary Batch Cancel Orders (V2) * @param {BatchCancelOrdersV2Request} batchCancelOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ async batchCancelOrdersV2(batchCancelOrdersV2Request: BatchCancelOrdersV2Request, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.batchCancelOrdersV2(batchCancelOrdersV2Request, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * 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). * @summary Batch Create Orders (V2) * @param {BatchCreateOrdersV2Request} batchCreateOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ async batchCreateOrdersV2(batchCreateOrdersV2Request: BatchCreateOrdersV2Request, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.batchCreateOrdersV2(batchCreateOrdersV2Request, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Cancels all resting event-market orders for the authenticated Direct member across every exchange shard. If `subaccount` is omitted, matching orders may come from any subaccount. If it is provided, only orders for that subaccount are eligible. Newly placed orders may also be cancelled during the minute after the request. * @summary Cancel All Orders * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async cancelAllOrders(subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.cancelAllOrders(subaccount, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Endpoint for cancelling event-market orders using the V2 response shape. To auto-route the cancellation, provide `market_ticker` and omit `exchange_index` or set it to `-1`. Returns `{order_id, client_order_id, reduced_by}` rather than a full order object. * @summary Cancel Order (V2) * @param {string} orderId Order ID * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {number} [exchangeIndex] Exchange shard index. If omitted, auto-routes when market_ticker is provided; otherwise defaults to 0. Use -1 to require auto-routing. The market_ticker parameter is required for auto-routing. * @param {string} [marketTicker] Market ticker. Required for auto-routing when exchange_index is omitted or -1. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async cancelOrderV2(orderId: string, subaccount?: number, exchangeIndex?: number, marketTicker?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.cancelOrderV2(orderId, subaccount, exchangeIndex, marketTicker, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * 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. * @summary Create Order (V2) * @param {CreateOrderV2Request} createOrderV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createOrderV2(createOrderV2Request: CreateOrderV2Request, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createOrderV2(createOrderV2Request, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * 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. * @summary Decrease Order (V2) * @param {string} orderId Order ID * @param {DecreaseOrderV2Request} decreaseOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async decreaseOrderV2(orderId: string, decreaseOrderV2Request: DecreaseOrderV2Request, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.decreaseOrderV2(orderId, decreaseOrderV2Request, subaccount, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Endpoint for getting a single order. * @summary Get Order * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOrder(orderId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getOrder(orderId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Endpoint for getting an order\'s queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority. * @summary Get Order Queue Position * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOrderQueuePosition(orderId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderQueuePosition(orderId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority. * @summary Get Queue Positions for Orders * @param {string} [marketTickers] Comma-separated list of market tickers to filter by * @param {string} [eventTicker] Event ticker to filter by * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOrderQueuePositions(marketTickers?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderQueuePositions(marketTickers, eventTicker, subaccount, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * 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. * @summary Get Orders * @param {string} [ticker] Filter by market ticker * @param {string} [eventTicker] Event tickers to filter by, as a comma-separated list (maximum 100). Events with no markets return no orders. * @param {number} [minTs] Filter items after this Unix timestamp * @param {number} [maxTs] Filter items before this Unix timestamp * @param {string} [status] Filter by status. Possible values depend on the endpoint. * @param {number} [limit] Number of results per page. Defaults to 100. * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {number} [exchangeIndex] Filter results by exchange shard. Omit to return results from all exchange shards. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOrders(ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, status?: string, limit?: number, cursor?: string, subaccount?: number, exchangeIndex?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, subaccount, exchangeIndex, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * OrdersApi - factory interface */ export const OrdersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = OrdersApiFp(configuration) return { /** * Endpoint for amending the price, max fillable count, and/or expiration time of an existing event-market order. 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. * @summary Amend Order (V2) * @param {string} orderId Order ID * @param {AmendOrderV2Request} amendOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ amendOrderV2(orderId: string, amendOrderV2Request: AmendOrderV2Request, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.amendOrderV2(orderId, amendOrderV2Request, subaccount, options).then((request) => request(axios, basePath)); }, /** * Endpoint for cancelling a batch of event-market orders using the V2 response shape. To auto-route a cancellation, provide its `market_ticker` and omit `exchange_index` or set it to `-1`. The maximum batch size scales with your tier\'s write budget — see [Rate Limits and Tiers](/getting_started/rate_limits). * @summary Batch Cancel Orders (V2) * @param {BatchCancelOrdersV2Request} batchCancelOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCancelOrdersV2(batchCancelOrdersV2Request: BatchCancelOrdersV2Request, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.batchCancelOrdersV2(batchCancelOrdersV2Request, options).then((request) => request(axios, basePath)); }, /** * 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). * @summary Batch Create Orders (V2) * @param {BatchCreateOrdersV2Request} batchCreateOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCreateOrdersV2(batchCreateOrdersV2Request: BatchCreateOrdersV2Request, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.batchCreateOrdersV2(batchCreateOrdersV2Request, options).then((request) => request(axios, basePath)); }, /** * Cancels all resting event-market orders for the authenticated Direct member across every exchange shard. If `subaccount` is omitted, matching orders may come from any subaccount. If it is provided, only orders for that subaccount are eligible. Newly placed orders may also be cancelled during the minute after the request. * @summary Cancel All Orders * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancelAllOrders(subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.cancelAllOrders(subaccount, options).then((request) => request(axios, basePath)); }, /** * Endpoint for cancelling event-market orders using the V2 response shape. To auto-route the cancellation, provide `market_ticker` and omit `exchange_index` or set it to `-1`. Returns `{order_id, client_order_id, reduced_by}` rather than a full order object. * @summary Cancel Order (V2) * @param {string} orderId Order ID * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {number} [exchangeIndex] Exchange shard index. If omitted, auto-routes when market_ticker is provided; otherwise defaults to 0. Use -1 to require auto-routing. The market_ticker parameter is required for auto-routing. * @param {string} [marketTicker] Market ticker. Required for auto-routing when exchange_index is omitted or -1. * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancelOrderV2(orderId: string, subaccount?: number, exchangeIndex?: number, marketTicker?: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.cancelOrderV2(orderId, subaccount, exchangeIndex, marketTicker, options).then((request) => request(axios, basePath)); }, /** * 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. * @summary Create Order (V2) * @param {CreateOrderV2Request} createOrderV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ createOrderV2(createOrderV2Request: CreateOrderV2Request, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createOrderV2(createOrderV2Request, options).then((request) => request(axios, basePath)); }, /** * 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. * @summary Decrease Order (V2) * @param {string} orderId Order ID * @param {DecreaseOrderV2Request} decreaseOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ decreaseOrderV2(orderId: string, decreaseOrderV2Request: DecreaseOrderV2Request, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.decreaseOrderV2(orderId, decreaseOrderV2Request, subaccount, options).then((request) => request(axios, basePath)); }, /** * Endpoint for getting a single order. * @summary Get Order * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrder(orderId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getOrder(orderId, options).then((request) => request(axios, basePath)); }, /** * Endpoint for getting an order\'s queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority. * @summary Get Order Queue Position * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrderQueuePosition(orderId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getOrderQueuePosition(orderId, options).then((request) => request(axios, basePath)); }, /** * Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority. * @summary Get Queue Positions for Orders * @param {string} [marketTickers] Comma-separated list of market tickers to filter by * @param {string} [eventTicker] Event ticker to filter by * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrderQueuePositions(marketTickers?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getOrderQueuePositions(marketTickers, eventTicker, subaccount, options).then((request) => request(axios, basePath)); }, /** * 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. * @summary Get Orders * @param {string} [ticker] Filter by market ticker * @param {string} [eventTicker] Event tickers to filter by, as a comma-separated list (maximum 100). Events with no markets return no orders. * @param {number} [minTs] Filter items after this Unix timestamp * @param {number} [maxTs] Filter items before this Unix timestamp * @param {string} [status] Filter by status. Possible values depend on the endpoint. * @param {number} [limit] Number of results per page. Defaults to 100. * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {number} [exchangeIndex] Filter results by exchange shard. Omit to return results from all exchange shards. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrders(ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, status?: string, limit?: number, cursor?: string, subaccount?: number, exchangeIndex?: number, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, subaccount, exchangeIndex, options).then((request) => request(axios, basePath)); }, }; }; /** * OrdersApi - object-oriented interface */ export class OrdersApi extends BaseAPI { /** * Endpoint for amending the price, max fillable count, and/or expiration time of an existing event-market order. 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. * @summary Amend Order (V2) * @param {string} orderId Order ID * @param {AmendOrderV2Request} amendOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public amendOrderV2(orderId: string, amendOrderV2Request: AmendOrderV2Request, subaccount?: number, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).amendOrderV2(orderId, amendOrderV2Request, subaccount, options).then((request) => request(this.axios, this.basePath)); } /** * Endpoint for cancelling a batch of event-market orders using the V2 response shape. To auto-route a cancellation, provide its `market_ticker` and omit `exchange_index` or set it to `-1`. The maximum batch size scales with your tier\'s write budget — see [Rate Limits and Tiers](/getting_started/rate_limits). * @summary Batch Cancel Orders (V2) * @param {BatchCancelOrdersV2Request} batchCancelOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ public batchCancelOrdersV2(batchCancelOrdersV2Request: BatchCancelOrdersV2Request, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).batchCancelOrdersV2(batchCancelOrdersV2Request, options).then((request) => request(this.axios, this.basePath)); } /** * 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). * @summary Batch Create Orders (V2) * @param {BatchCreateOrdersV2Request} batchCreateOrdersV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ public batchCreateOrdersV2(batchCreateOrdersV2Request: BatchCreateOrdersV2Request, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).batchCreateOrdersV2(batchCreateOrdersV2Request, options).then((request) => request(this.axios, this.basePath)); } /** * Cancels all resting event-market orders for the authenticated Direct member across every exchange shard. If `subaccount` is omitted, matching orders may come from any subaccount. If it is provided, only orders for that subaccount are eligible. Newly placed orders may also be cancelled during the minute after the request. * @summary Cancel All Orders * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public cancelAllOrders(subaccount?: number, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).cancelAllOrders(subaccount, options).then((request) => request(this.axios, this.basePath)); } /** * Endpoint for cancelling event-market orders using the V2 response shape. To auto-route the cancellation, provide `market_ticker` and omit `exchange_index` or set it to `-1`. Returns `{order_id, client_order_id, reduced_by}` rather than a full order object. * @summary Cancel Order (V2) * @param {string} orderId Order ID * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {number} [exchangeIndex] Exchange shard index. If omitted, auto-routes when market_ticker is provided; otherwise defaults to 0. Use -1 to require auto-routing. The market_ticker parameter is required for auto-routing. * @param {string} [marketTicker] Market ticker. Required for auto-routing when exchange_index is omitted or -1. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public cancelOrderV2(orderId: string, subaccount?: number, exchangeIndex?: number, marketTicker?: string, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).cancelOrderV2(orderId, subaccount, exchangeIndex, marketTicker, options).then((request) => request(this.axios, this.basePath)); } /** * 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. * @summary Create Order (V2) * @param {CreateOrderV2Request} createOrderV2Request * @param {*} [options] Override http request option. * @throws {RequiredError} */ public createOrderV2(createOrderV2Request: CreateOrderV2Request, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).createOrderV2(createOrderV2Request, options).then((request) => request(this.axios, this.basePath)); } /** * 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. * @summary Decrease Order (V2) * @param {string} orderId Order ID * @param {DecreaseOrderV2Request} decreaseOrderV2Request * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public decreaseOrderV2(orderId: string, decreaseOrderV2Request: DecreaseOrderV2Request, subaccount?: number, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).decreaseOrderV2(orderId, decreaseOrderV2Request, subaccount, options).then((request) => request(this.axios, this.basePath)); } /** * Endpoint for getting a single order. * @summary Get Order * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getOrder(orderId: string, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).getOrder(orderId, options).then((request) => request(this.axios, this.basePath)); } /** * Endpoint for getting an order\'s queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority. * @summary Get Order Queue Position * @param {string} orderId Order ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getOrderQueuePosition(orderId: string, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).getOrderQueuePosition(orderId, options).then((request) => request(this.axios, this.basePath)); } /** * Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority. * @summary Get Queue Positions for Orders * @param {string} [marketTickers] Comma-separated list of market tickers to filter by * @param {string} [eventTicker] Event ticker to filter by * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getOrderQueuePositions(marketTickers?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).getOrderQueuePositions(marketTickers, eventTicker, subaccount, options).then((request) => request(this.axios, this.basePath)); } /** * 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. * @summary Get Orders * @param {string} [ticker] Filter by market ticker * @param {string} [eventTicker] Event tickers to filter by, as a comma-separated list (maximum 100). Events with no markets return no orders. * @param {number} [minTs] Filter items after this Unix timestamp * @param {number} [maxTs] Filter items before this Unix timestamp * @param {string} [status] Filter by status. Possible values depend on the endpoint. * @param {number} [limit] Number of results per page. Defaults to 100. * @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {number} [subaccount] Subaccount number (0 for primary, 1-63 for subaccounts). If omitted, defaults to all subaccounts. * @param {number} [exchangeIndex] Filter results by exchange shard. Omit to return results from all exchange shards. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getOrders(ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, status?: string, limit?: number, cursor?: string, subaccount?: number, exchangeIndex?: number, options?: RawAxiosRequestConfig) { return OrdersApiFp(this.configuration).getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, subaccount, exchangeIndex, options).then((request) => request(this.axios, this.basePath)); } }