UNPKG

kalshi-typescript

Version:
831 lines (730 loc) 58.6 kB
/* 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.11.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 { AmendOrderRequest } from '../models'; // @ts-ignore import type { AmendOrderResponse } from '../models'; // @ts-ignore import type { BatchCancelOrdersRequest } from '../models'; // @ts-ignore import type { BatchCancelOrdersResponse } from '../models'; // @ts-ignore import type { BatchCreateOrdersRequest } from '../models'; // @ts-ignore import type { BatchCreateOrdersResponse } from '../models'; // @ts-ignore import type { CancelOrderResponse } from '../models'; // @ts-ignore import type { CreateOrderRequest } from '../models'; // @ts-ignore import type { CreateOrderResponse } from '../models'; // @ts-ignore import type { DecreaseOrderRequest } from '../models'; // @ts-ignore import type { DecreaseOrderResponse } 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 max number of fillable contracts and/or price in an existing order. Max fillable contracts is `remaining_count` + `fill_count`. * @summary Amend Order * @param {string} orderId Order ID * @param {AmendOrderRequest} amendOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ amendOrder: async (orderId: string, amendOrderRequest: AmendOrderRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'orderId' is not null or undefined assertParamExists('amendOrder', 'orderId', orderId) // verify required parameter 'amendOrderRequest' is not null or undefined assertParamExists('amendOrder', 'amendOrderRequest', amendOrderRequest) const localVarPath = `/portfolio/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) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(amendOrderRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for cancelling up to 20 orders at once. * @summary Batch Cancel Orders * @param {BatchCancelOrdersRequest} batchCancelOrdersRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCancelOrders: async (batchCancelOrdersRequest: BatchCancelOrdersRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'batchCancelOrdersRequest' is not null or undefined assertParamExists('batchCancelOrders', 'batchCancelOrdersRequest', batchCancelOrdersRequest) const localVarPath = `/portfolio/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(batchCancelOrdersRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per-second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch. * @summary Batch Create Orders * @param {BatchCreateOrdersRequest} batchCreateOrdersRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCreateOrders: async (batchCreateOrdersRequest: BatchCreateOrdersRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'batchCreateOrdersRequest' is not null or undefined assertParamExists('batchCreateOrders', 'batchCreateOrdersRequest', batchCreateOrdersRequest) const localVarPath = `/portfolio/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(batchCreateOrdersRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can\'t completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client. * @summary Cancel Order * @param {string} orderId Order ID * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0. * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancelOrder: async (orderId: string, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'orderId' is not null or undefined assertParamExists('cancelOrder', '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: '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 submitting orders in a market. Each user is limited to 200 000 open orders at a time. * @summary Create Order * @param {CreateOrderRequest} createOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ createOrder: async (createOrderRequest: CreateOrderRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'createOrderRequest' is not null or undefined assertParamExists('createOrder', 'createOrderRequest', createOrderRequest) 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: '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(createOrderRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero. * @summary Decrease Order * @param {string} orderId Order ID * @param {DecreaseOrderRequest} decreaseOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ decreaseOrder: async (orderId: string, decreaseOrderRequest: DecreaseOrderRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'orderId' is not null or undefined assertParamExists('decreaseOrder', 'orderId', orderId) // verify required parameter 'decreaseOrderRequest' is not null or undefined assertParamExists('decreaseOrder', 'decreaseOrderRequest', decreaseOrderRequest) const localVarPath = `/portfolio/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) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(decreaseOrderRequest, 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<RequestArgs> => { // 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<RequestArgs> => { // 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-32 for subaccounts). Defaults to 0. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrderQueuePositions: async (marketTickers?: string, eventTicker?: string, subaccount?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { 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://kalshi.com/docs/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 10). * @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. Maximum value is 200. * @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-32 for subaccounts). If omitted, defaults to all subaccounts. * @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, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { 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; } 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 max number of fillable contracts and/or price in an existing order. Max fillable contracts is `remaining_count` + `fill_count`. * @summary Amend Order * @param {string} orderId Order ID * @param {AmendOrderRequest} amendOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async amendOrder(orderId: string, amendOrderRequest: AmendOrderRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AmendOrderResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.amendOrder(orderId, amendOrderRequest, 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 up to 20 orders at once. * @summary Batch Cancel Orders * @param {BatchCancelOrdersRequest} batchCancelOrdersRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async batchCancelOrders(batchCancelOrdersRequest: BatchCancelOrdersRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BatchCancelOrdersResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.batchCancelOrders(batchCancelOrdersRequest, 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 orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per-second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch. * @summary Batch Create Orders * @param {BatchCreateOrdersRequest} batchCreateOrdersRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async batchCreateOrders(batchCreateOrdersRequest: BatchCreateOrdersRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BatchCreateOrdersResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.batchCreateOrders(batchCreateOrdersRequest, 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 canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can\'t completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client. * @summary Cancel Order * @param {string} orderId Order ID * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async cancelOrder(orderId: string, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CancelOrderResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.cancelOrder(orderId, 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 submitting orders in a market. Each user is limited to 200 000 open orders at a time. * @summary Create Order * @param {CreateOrderRequest} createOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createOrder(createOrderRequest: CreateOrderRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateOrderResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.createOrder(createOrderRequest, 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 number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero. * @summary Decrease Order * @param {string} orderId Order ID * @param {DecreaseOrderRequest} decreaseOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async decreaseOrder(orderId: string, decreaseOrderRequest: DecreaseOrderRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DecreaseOrderResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.decreaseOrder(orderId, decreaseOrderRequest, 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<GetOrderResponse>> { 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<GetOrderQueuePositionResponse>> { 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-32 for subaccounts). Defaults to 0. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOrderQueuePositions(marketTickers?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetOrderQueuePositionsResponse>> { 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://kalshi.com/docs/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 10). * @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. Maximum value is 200. * @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-32 for subaccounts). If omitted, defaults to all subaccounts. * @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, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetOrdersResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getOrders(ticker, eventTicker, minTs, maxTs, status, limit, cursor, subaccount, 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 max number of fillable contracts and/or price in an existing order. Max fillable contracts is `remaining_count` + `fill_count`. * @summary Amend Order * @param {string} orderId Order ID * @param {AmendOrderRequest} amendOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ amendOrder(orderId: string, amendOrderRequest: AmendOrderRequest, options?: RawAxiosRequestConfig): AxiosPromise<AmendOrderResponse> { return localVarFp.amendOrder(orderId, amendOrderRequest, options).then((request) => request(axios, basePath)); }, /** * Endpoint for cancelling up to 20 orders at once. * @summary Batch Cancel Orders * @param {BatchCancelOrdersRequest} batchCancelOrdersRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCancelOrders(batchCancelOrdersRequest: BatchCancelOrdersRequest, options?: RawAxiosRequestConfig): AxiosPromise<BatchCancelOrdersResponse> { return localVarFp.batchCancelOrders(batchCancelOrdersRequest, options).then((request) => request(axios, basePath)); }, /** * Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per-second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch. * @summary Batch Create Orders * @param {BatchCreateOrdersRequest} batchCreateOrdersRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ batchCreateOrders(batchCreateOrdersRequest: BatchCreateOrdersRequest, options?: RawAxiosRequestConfig): AxiosPromise<BatchCreateOrdersResponse> { return localVarFp.batchCreateOrders(batchCreateOrdersRequest, options).then((request) => request(axios, basePath)); }, /** * Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can\'t completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client. * @summary Cancel Order * @param {string} orderId Order ID * @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0. * @param {*} [options] Override http request option. * @throws {RequiredError} */ cancelOrder(orderId: string, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise<CancelOrderResponse> { return localVarFp.cancelOrder(orderId, subaccount, options).then((request) => request(axios, basePath)); }, /** * Endpoint for submitting orders in a market. Each user is limited to 200 000 open orders at a time. * @summary Create Order * @param {CreateOrderRequest} createOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ createOrder(createOrderRequest: CreateOrderRequest, options?: RawAxiosRequestConfig): AxiosPromise<CreateOrderResponse> { return localVarFp.createOrder(createOrderRequest, options).then((request) => request(axios, basePath)); }, /** * Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero. * @summary Decrease Order * @param {string} orderId Order ID * @param {DecreaseOrderRequest} decreaseOrderRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ decreaseOrder(orderId: string, decreaseOrderRequest: DecreaseOrderRequest, options?: RawAxiosRequestConfig): AxiosPromise<DecreaseOrderResponse> { return localVarFp.decreaseOrder(orderId, decreaseOrderRequest, 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<GetOrderResponse> { 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<GetOrderQueuePositionResponse> { 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-32 for subaccounts). Defaults to 0. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOrderQueuePositions(marketTickers?: string, eventTicker?: string, subaccount?: number, options?: RawAxiosRequestConfig): AxiosPromise<GetOrderQueuePositionsResponse> { 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://kalshi.com/docs/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 10). * @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. Maximum value is 200. * @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-32 for subaccounts). If omitted, defaults to all subaccounts. * @param {*} [options] Override http request option. * @throws {