/* 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 { CreateWeatherPointMarketRequest } from '../models'; // @ts-ignore import type { CreateWeatherPointMarketResponse } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; // @ts-ignore import type { GetWeatherPointAvailabilityResponse } from '../models'; /** * MarketsApi - axios parameter creator */ export const MarketsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Returns the on-request weather market for a location, time window and threshold, creating it if it doesn\'t exist yet. The same request always returns the same market, so call this before sending an RFQ for a market you haven\'t seen. `created` tells you whether the market is new. An existing market is returned until its window ends, even where new markets like it are no longer offered. The exception is when weather markets are switched off (`enabled` is false in the availability response) or the variable has been withdrawn entirely: the request is then refused whether or not the market exists. The location snaps to the center of the NOAA MRMS grid cell containing it; the response carries the snapped coordinates. Markets are only offered where `GET /weather_point_markets/availability` says so, and not over open water. The window is whole local hours on one calendar day. A new market\'s window must start at least 15 minutes from now and within 365 days. A market is traded through RFQs: pass the returned `market_ticker` to `POST /communications/rfqs`. These markets are in series starting with `KXRFQ` and are left out of unscoped market listings. A market created a moment ago may not be readable yet: if `GET /markets/{ticker}` returns 404 right after creation, retry. Errors carry the specific reason in `details`: | Status | `code` | When | | --- | --- | --- | | 400 | `bad_request` | The body isn\'t valid JSON, or a field has the wrong type. | | 400 | `missing_parameters` | A required field is missing or empty. | | 400 | `invalid_parameters` | A field is present but unusable, or the request can\'t define a market: a latitude or hour out of range, an `end_hour` not after `start_hour`, an unknown variable or strike type, thresholds that don\'t fit the strike type or the variable\'s range, a location outside NOAA MRMS coverage, an unknown time zone, a window that doesn\'t start and end on whole UTC hours, has already ended or starts more than 365 days out, or an hour that a clock change skips or repeats. | | 409 | `weather_point_market_unavailable` | The request is valid but the market isn\'t offered: the variable isn\'t offered at that location, the location is over open water, or the window starts in less than 15 minutes. | | 429 | `weather_point_market_limit_exceeded` | A creation limit was reached: the daily limit on new weather markets across all users, or 40 markets for one variable, location and window. Retrying at once doesn\'t help. | | 429 | `too_many_requests` | Your API rate limit. This endpoint is charged against your write budget. | * @summary Create Weather Point Market * @param {CreateWeatherPointMarketRequest} createWeatherPointMarketRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ createWeatherPointMarket: async (createWeatherPointMarketRequest: CreateWeatherPointMarketRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'createWeatherPointMarketRequest' is not null or undefined assertParamExists('createWeatherPointMarket', 'createWeatherPointMarketRequest', createWeatherPointMarketRequest) const localVarPath = `/weather_point_markets`; // 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(createWeatherPointMarketRequest, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns which on-request weather markets can be created: whether creation is on, the NOAA MRMS domains a location may lie in, and the domains each offered variable may use. A variable missing from `variables` can\'t be created. Existing markets are unaffected. A location inside an offered domain can still be refused at creation when it is over open water. * @summary Get Weather Point Market Availability * @param {*} [options] Override http request option. * @throws {RequiredError} */ getWeatherPointAvailability: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/weather_point_markets/availability`; // 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; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * MarketsApi - functional programming interface */ export const MarketsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = MarketsApiAxiosParamCreator(configuration) return { /** * Returns the on-request weather market for a location, time window and threshold, creating it if it doesn\'t exist yet. The same request always returns the same market, so call this before sending an RFQ for a market you haven\'t seen. `created` tells you whether the market is new. An existing market is returned until its window ends, even where new markets like it are no longer offered. The exception is when weather markets are switched off (`enabled` is false in the availability response) or the variable has been withdrawn entirely: the request is then refused whether or not the market exists. The location snaps to the center of the NOAA MRMS grid cell containing it; the response carries the snapped coordinates. Markets are only offered where `GET /weather_point_markets/availability` says so, and not over open water. The window is whole local hours on one calendar day. A new market\'s window must start at least 15 minutes from now and within 365 days. A market is traded through RFQs: pass the returned `market_ticker` to `POST /communications/rfqs`. These markets are in series starting with `KXRFQ` and are left out of unscoped market listings. A market created a moment ago may not be readable yet: if `GET /markets/{ticker}` returns 404 right after creation, retry. Errors carry the specific reason in `details`: | Status | `code` | When | | --- | --- | --- | | 400 | `bad_request` | The body isn\'t valid JSON, or a field has the wrong type. | | 400 | `missing_parameters` | A required field is missing or empty. | | 400 | `invalid_parameters` | A field is present but unusable, or the request can\'t define a market: a latitude or hour out of range, an `end_hour` not after `start_hour`, an unknown variable or strike type, thresholds that don\'t fit the strike type or the variable\'s range, a location outside NOAA MRMS coverage, an unknown time zone, a window that doesn\'t start and end on whole UTC hours, has already ended or starts more than 365 days out, or an hour that a clock change skips or repeats. | | 409 | `weather_point_market_unavailable` | The request is valid but the market isn\'t offered: the variable isn\'t offered at that location, the location is over open water, or the window starts in less than 15 minutes. | | 429 | `weather_point_market_limit_exceeded` | A creation limit was reached: the daily limit on new weather markets across all users, or 40 markets for one variable, location and window. Retrying at once doesn\'t help. | | 429 | `too_many_requests` | Your API rate limit. This endpoint is charged against your write budget. | * @summary Create Weather Point Market * @param {CreateWeatherPointMarketRequest} createWeatherPointMarketRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createWeatherPointMarket(createWeatherPointMarketRequest: CreateWeatherPointMarketRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createWeatherPointMarket(createWeatherPointMarketRequest, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Returns which on-request weather markets can be created: whether creation is on, the NOAA MRMS domains a location may lie in, and the domains each offered variable may use. A variable missing from `variables` can\'t be created. Existing markets are unaffected. A location inside an offered domain can still be refused at creation when it is over open water. * @summary Get Weather Point Market Availability * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getWeatherPointAvailability(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getWeatherPointAvailability(options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * MarketsApi - factory interface */ export const MarketsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = MarketsApiFp(configuration) return { /** * Returns the on-request weather market for a location, time window and threshold, creating it if it doesn\'t exist yet. The same request always returns the same market, so call this before sending an RFQ for a market you haven\'t seen. `created` tells you whether the market is new. An existing market is returned until its window ends, even where new markets like it are no longer offered. The exception is when weather markets are switched off (`enabled` is false in the availability response) or the variable has been withdrawn entirely: the request is then refused whether or not the market exists. The location snaps to the center of the NOAA MRMS grid cell containing it; the response carries the snapped coordinates. Markets are only offered where `GET /weather_point_markets/availability` says so, and not over open water. The window is whole local hours on one calendar day. A new market\'s window must start at least 15 minutes from now and within 365 days. A market is traded through RFQs: pass the returned `market_ticker` to `POST /communications/rfqs`. These markets are in series starting with `KXRFQ` and are left out of unscoped market listings. A market created a moment ago may not be readable yet: if `GET /markets/{ticker}` returns 404 right after creation, retry. Errors carry the specific reason in `details`: | Status | `code` | When | | --- | --- | --- | | 400 | `bad_request` | The body isn\'t valid JSON, or a field has the wrong type. | | 400 | `missing_parameters` | A required field is missing or empty. | | 400 | `invalid_parameters` | A field is present but unusable, or the request can\'t define a market: a latitude or hour out of range, an `end_hour` not after `start_hour`, an unknown variable or strike type, thresholds that don\'t fit the strike type or the variable\'s range, a location outside NOAA MRMS coverage, an unknown time zone, a window that doesn\'t start and end on whole UTC hours, has already ended or starts more than 365 days out, or an hour that a clock change skips or repeats. | | 409 | `weather_point_market_unavailable` | The request is valid but the market isn\'t offered: the variable isn\'t offered at that location, the location is over open water, or the window starts in less than 15 minutes. | | 429 | `weather_point_market_limit_exceeded` | A creation limit was reached: the daily limit on new weather markets across all users, or 40 markets for one variable, location and window. Retrying at once doesn\'t help. | | 429 | `too_many_requests` | Your API rate limit. This endpoint is charged against your write budget. | * @summary Create Weather Point Market * @param {CreateWeatherPointMarketRequest} createWeatherPointMarketRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ createWeatherPointMarket(createWeatherPointMarketRequest: CreateWeatherPointMarketRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createWeatherPointMarket(createWeatherPointMarketRequest, options).then((request) => request(axios, basePath)); }, /** * Returns which on-request weather markets can be created: whether creation is on, the NOAA MRMS domains a location may lie in, and the domains each offered variable may use. A variable missing from `variables` can\'t be created. Existing markets are unaffected. A location inside an offered domain can still be refused at creation when it is over open water. * @summary Get Weather Point Market Availability * @param {*} [options] Override http request option. * @throws {RequiredError} */ getWeatherPointAvailability(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getWeatherPointAvailability(options).then((request) => request(axios, basePath)); }, }; }; /** * MarketsApi - object-oriented interface */ export class MarketsApi extends BaseAPI { /** * Returns the on-request weather market for a location, time window and threshold, creating it if it doesn\'t exist yet. The same request always returns the same market, so call this before sending an RFQ for a market you haven\'t seen. `created` tells you whether the market is new. An existing market is returned until its window ends, even where new markets like it are no longer offered. The exception is when weather markets are switched off (`enabled` is false in the availability response) or the variable has been withdrawn entirely: the request is then refused whether or not the market exists. The location snaps to the center of the NOAA MRMS grid cell containing it; the response carries the snapped coordinates. Markets are only offered where `GET /weather_point_markets/availability` says so, and not over open water. The window is whole local hours on one calendar day. A new market\'s window must start at least 15 minutes from now and within 365 days. A market is traded through RFQs: pass the returned `market_ticker` to `POST /communications/rfqs`. These markets are in series starting with `KXRFQ` and are left out of unscoped market listings. A market created a moment ago may not be readable yet: if `GET /markets/{ticker}` returns 404 right after creation, retry. Errors carry the specific reason in `details`: | Status | `code` | When | | --- | --- | --- | | 400 | `bad_request` | The body isn\'t valid JSON, or a field has the wrong type. | | 400 | `missing_parameters` | A required field is missing or empty. | | 400 | `invalid_parameters` | A field is present but unusable, or the request can\'t define a market: a latitude or hour out of range, an `end_hour` not after `start_hour`, an unknown variable or strike type, thresholds that don\'t fit the strike type or the variable\'s range, a location outside NOAA MRMS coverage, an unknown time zone, a window that doesn\'t start and end on whole UTC hours, has already ended or starts more than 365 days out, or an hour that a clock change skips or repeats. | | 409 | `weather_point_market_unavailable` | The request is valid but the market isn\'t offered: the variable isn\'t offered at that location, the location is over open water, or the window starts in less than 15 minutes. | | 429 | `weather_point_market_limit_exceeded` | A creation limit was reached: the daily limit on new weather markets across all users, or 40 markets for one variable, location and window. Retrying at once doesn\'t help. | | 429 | `too_many_requests` | Your API rate limit. This endpoint is charged against your write budget. | * @summary Create Weather Point Market * @param {CreateWeatherPointMarketRequest} createWeatherPointMarketRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ public createWeatherPointMarket(createWeatherPointMarketRequest: CreateWeatherPointMarketRequest, options?: RawAxiosRequestConfig) { return MarketsApiFp(this.configuration).createWeatherPointMarket(createWeatherPointMarketRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Returns which on-request weather markets can be created: whether creation is on, the NOAA MRMS domains a location may lie in, and the domains each offered variable may use. A variable missing from `variables` can\'t be created. Existing markets are unaffected. A location inside an offered domain can still be refused at creation when it is over open water. * @summary Get Weather Point Market Availability * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getWeatherPointAvailability(options?: RawAxiosRequestConfig) { return MarketsApiFp(this.configuration).getWeatherPointAvailability(options).then((request) => request(this.axios, this.basePath)); } }