/* 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 { GetEventCandlesticksResponse } from '../models'; // @ts-ignore import type { GetEventForecastPercentilesHistoryResponse } from '../models'; // @ts-ignore import type { GetEventMetadataResponse } from '../models'; // @ts-ignore import type { GetEventResponse } from '../models'; // @ts-ignore import type { GetEventsResponse } from '../models'; // @ts-ignore import type { GetMultivariateEventsResponse } from '../models'; /** * EventsApi - axios parameter creator */ export const EventsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Endpoint for getting data about an event by its ticker. An event represents a real-world occurrence that can be traded on, such as an election, sports game, or economic indicator release. Events contain one or more markets where users can place trades on different outcomes. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Event * @param {string} eventTicker Event ticker * @param {boolean} [withNestedMarkets] If true, markets are included within the event object. If false (default), markets are returned as a separate top-level field in the response. Historical markets settled before the historical cutoff will not be included. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEvent: async (eventTicker: string, withNestedMarkets?: boolean, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'eventTicker' is not null or undefined assertParamExists('getEvent', 'eventTicker', eventTicker) const localVarPath = `/events/{event_ticker}` .replace(`{${"event_ticker"}}`, encodeURIComponent(String(eventTicker))); // 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; if (withNestedMarkets !== undefined) { localVarQueryParameter['with_nested_markets'] = withNestedMarkets; } 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 the historical raw and formatted forecast numbers for an event at specific percentiles. * @summary Get Event Forecast Percentile History * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {Array} percentiles Array of percentile values to retrieve (0-10000, max 10 values) * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetEventForecastPercentilesHistoryPeriodIntervalEnum} periodInterval Specifies the length of each forecast period, in minutes. 0 for 5-second intervals, or 1, 60, or 1440 for minute-based intervals. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEventForecastPercentilesHistory: async (ticker: string, seriesTicker: string, percentiles: Array, startTs: number, endTs: number, periodInterval: GetEventForecastPercentilesHistoryPeriodIntervalEnum, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'ticker' is not null or undefined assertParamExists('getEventForecastPercentilesHistory', 'ticker', ticker) // verify required parameter 'seriesTicker' is not null or undefined assertParamExists('getEventForecastPercentilesHistory', 'seriesTicker', seriesTicker) // verify required parameter 'percentiles' is not null or undefined assertParamExists('getEventForecastPercentilesHistory', 'percentiles', percentiles) // verify required parameter 'startTs' is not null or undefined assertParamExists('getEventForecastPercentilesHistory', 'startTs', startTs) // verify required parameter 'endTs' is not null or undefined assertParamExists('getEventForecastPercentilesHistory', 'endTs', endTs) // verify required parameter 'periodInterval' is not null or undefined assertParamExists('getEventForecastPercentilesHistory', 'periodInterval', periodInterval) const localVarPath = `/series/{series_ticker}/events/{ticker}/forecast_percentile_history` .replace(`{${"ticker"}}`, encodeURIComponent(String(ticker))) .replace(`{${"series_ticker"}}`, encodeURIComponent(String(seriesTicker))); // 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 (percentiles) { localVarQueryParameter['percentiles'] = percentiles; } if (startTs !== undefined) { localVarQueryParameter['start_ts'] = startTs; } if (endTs !== undefined) { localVarQueryParameter['end_ts'] = endTs; } if (periodInterval !== undefined) { localVarQueryParameter['period_interval'] = periodInterval; } 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 metadata about an event by its ticker. Returns only the metadata information for an event. * @summary Get Event Metadata * @param {string} eventTicker Event ticker * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEventMetadata: async (eventTicker: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'eventTicker' is not null or undefined assertParamExists('getEventMetadata', 'eventTicker', eventTicker) const localVarPath = `/events/{event_ticker}/metadata` .replace(`{${"event_ticker"}}`, encodeURIComponent(String(eventTicker))); // 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, }; }, /** * Get all events. This endpoint excludes multivariate events. To retrieve multivariate events, use the GET /events/multivariate endpoint. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Events * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 200. Maximum value is 200. * @param {string} [cursor] Parameter to specify the pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. Historical markets settled before the historical cutoff will not be included. * @param {boolean} [withMilestones] If true, includes related milestones as a field alongside events. * @param {GetEventsStatusEnum} [status] Filter by event status. Possible values are \'unopened\', \'open\', \'closed\', \'settled\'. Leave empty to return events with any status. * @param {string} [seriesTicker] Filter by series ticker * @param {number} [minCloseTs] Filter events with at least one market with close timestamp greater than this Unix timestamp (in seconds). * @param {number} [minUpdatedTs] Filter events with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEvents: async (limit?: number, cursor?: string, withNestedMarkets?: boolean, withMilestones?: boolean, status?: GetEventsStatusEnum, seriesTicker?: string, minCloseTs?: number, minUpdatedTs?: number, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/events`; // 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; if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } if (withNestedMarkets !== undefined) { localVarQueryParameter['with_nested_markets'] = withNestedMarkets; } if (withMilestones !== undefined) { localVarQueryParameter['with_milestones'] = withMilestones; } if (status !== undefined) { localVarQueryParameter['status'] = status; } if (seriesTicker !== undefined) { localVarQueryParameter['series_ticker'] = seriesTicker; } if (minCloseTs !== undefined) { localVarQueryParameter['min_close_ts'] = minCloseTs; } if (minUpdatedTs !== undefined) { localVarQueryParameter['min_updated_ts'] = minUpdatedTs; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * End-point for returning aggregated data across all markets corresponding to an event. * @summary Get Event Candlesticks * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetMarketCandlesticksByEventPeriodIntervalEnum} periodInterval Specifies the length of each candlestick period, in minutes. Must be one minute, one hour, or one day. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getMarketCandlesticksByEvent: async (ticker: string, seriesTicker: string, startTs: number, endTs: number, periodInterval: GetMarketCandlesticksByEventPeriodIntervalEnum, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'ticker' is not null or undefined assertParamExists('getMarketCandlesticksByEvent', 'ticker', ticker) // verify required parameter 'seriesTicker' is not null or undefined assertParamExists('getMarketCandlesticksByEvent', 'seriesTicker', seriesTicker) // verify required parameter 'startTs' is not null or undefined assertParamExists('getMarketCandlesticksByEvent', 'startTs', startTs) // verify required parameter 'endTs' is not null or undefined assertParamExists('getMarketCandlesticksByEvent', 'endTs', endTs) // verify required parameter 'periodInterval' is not null or undefined assertParamExists('getMarketCandlesticksByEvent', 'periodInterval', periodInterval) const localVarPath = `/series/{series_ticker}/events/{ticker}/candlesticks` .replace(`{${"ticker"}}`, encodeURIComponent(String(ticker))) .replace(`{${"series_ticker"}}`, encodeURIComponent(String(seriesTicker))); // 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; if (startTs !== undefined) { localVarQueryParameter['start_ts'] = startTs; } if (endTs !== undefined) { localVarQueryParameter['end_ts'] = endTs; } if (periodInterval !== undefined) { localVarQueryParameter['period_interval'] = periodInterval; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Retrieve multivariate (combo) events. These are dynamically created events from multivariate event collections. Supports filtering by series and collection ticker. * @summary Get Multivariate Events * @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. * @param {string} [seriesTicker] Filter by series ticker * @param {string} [collectionTicker] Filter events by collection ticker. Returns only multivariate events belonging to the specified collection. Cannot be used together with series_ticker. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getMultivariateEvents: async (limit?: number, cursor?: string, seriesTicker?: string, collectionTicker?: string, withNestedMarkets?: boolean, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/events/multivariate`; // 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; if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } if (seriesTicker !== undefined) { localVarQueryParameter['series_ticker'] = seriesTicker; } if (collectionTicker !== undefined) { localVarQueryParameter['collection_ticker'] = collectionTicker; } if (withNestedMarkets !== undefined) { localVarQueryParameter['with_nested_markets'] = withNestedMarkets; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * EventsApi - functional programming interface */ export const EventsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = EventsApiAxiosParamCreator(configuration) return { /** * Endpoint for getting data about an event by its ticker. An event represents a real-world occurrence that can be traded on, such as an election, sports game, or economic indicator release. Events contain one or more markets where users can place trades on different outcomes. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Event * @param {string} eventTicker Event ticker * @param {boolean} [withNestedMarkets] If true, markets are included within the event object. If false (default), markets are returned as a separate top-level field in the response. Historical markets settled before the historical cutoff will not be included. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEvent(eventTicker: string, withNestedMarkets?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEvent(eventTicker, withNestedMarkets, 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 the historical raw and formatted forecast numbers for an event at specific percentiles. * @summary Get Event Forecast Percentile History * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {Array} percentiles Array of percentile values to retrieve (0-10000, max 10 values) * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetEventForecastPercentilesHistoryPeriodIntervalEnum} periodInterval Specifies the length of each forecast period, in minutes. 0 for 5-second intervals, or 1, 60, or 1440 for minute-based intervals. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEventForecastPercentilesHistory(ticker: string, seriesTicker: string, percentiles: Array, startTs: number, endTs: number, periodInterval: GetEventForecastPercentilesHistoryPeriodIntervalEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEventForecastPercentilesHistory(ticker, seriesTicker, percentiles, startTs, endTs, periodInterval, 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 metadata about an event by its ticker. Returns only the metadata information for an event. * @summary Get Event Metadata * @param {string} eventTicker Event ticker * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEventMetadata(eventTicker: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEventMetadata(eventTicker, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Get all events. This endpoint excludes multivariate events. To retrieve multivariate events, use the GET /events/multivariate endpoint. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Events * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 200. Maximum value is 200. * @param {string} [cursor] Parameter to specify the pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. Historical markets settled before the historical cutoff will not be included. * @param {boolean} [withMilestones] If true, includes related milestones as a field alongside events. * @param {GetEventsStatusEnum} [status] Filter by event status. Possible values are \'unopened\', \'open\', \'closed\', \'settled\'. Leave empty to return events with any status. * @param {string} [seriesTicker] Filter by series ticker * @param {number} [minCloseTs] Filter events with at least one market with close timestamp greater than this Unix timestamp (in seconds). * @param {number} [minUpdatedTs] Filter events with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEvents(limit?: number, cursor?: string, withNestedMarkets?: boolean, withMilestones?: boolean, status?: GetEventsStatusEnum, seriesTicker?: string, minCloseTs?: number, minUpdatedTs?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEvents(limit, cursor, withNestedMarkets, withMilestones, status, seriesTicker, minCloseTs, minUpdatedTs, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * End-point for returning aggregated data across all markets corresponding to an event. * @summary Get Event Candlesticks * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetMarketCandlesticksByEventPeriodIntervalEnum} periodInterval Specifies the length of each candlestick period, in minutes. Must be one minute, one hour, or one day. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getMarketCandlesticksByEvent(ticker: string, seriesTicker: string, startTs: number, endTs: number, periodInterval: GetMarketCandlesticksByEventPeriodIntervalEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getMarketCandlesticksByEvent(ticker, seriesTicker, startTs, endTs, periodInterval, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Retrieve multivariate (combo) events. These are dynamically created events from multivariate event collections. Supports filtering by series and collection ticker. * @summary Get Multivariate Events * @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. * @param {string} [seriesTicker] Filter by series ticker * @param {string} [collectionTicker] Filter events by collection ticker. Returns only multivariate events belonging to the specified collection. Cannot be used together with series_ticker. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getMultivariateEvents(limit?: number, cursor?: string, seriesTicker?: string, collectionTicker?: string, withNestedMarkets?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getMultivariateEvents(limit, cursor, seriesTicker, collectionTicker, withNestedMarkets, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath: string | undefined = undefined; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * EventsApi - factory interface */ export const EventsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = EventsApiFp(configuration) return { /** * Endpoint for getting data about an event by its ticker. An event represents a real-world occurrence that can be traded on, such as an election, sports game, or economic indicator release. Events contain one or more markets where users can place trades on different outcomes. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Event * @param {string} eventTicker Event ticker * @param {boolean} [withNestedMarkets] If true, markets are included within the event object. If false (default), markets are returned as a separate top-level field in the response. Historical markets settled before the historical cutoff will not be included. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEvent(eventTicker: string, withNestedMarkets?: boolean, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEvent(eventTicker, withNestedMarkets, options).then((request) => request(axios, basePath)); }, /** * Endpoint for getting the historical raw and formatted forecast numbers for an event at specific percentiles. * @summary Get Event Forecast Percentile History * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {Array} percentiles Array of percentile values to retrieve (0-10000, max 10 values) * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetEventForecastPercentilesHistoryPeriodIntervalEnum} periodInterval Specifies the length of each forecast period, in minutes. 0 for 5-second intervals, or 1, 60, or 1440 for minute-based intervals. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEventForecastPercentilesHistory(ticker: string, seriesTicker: string, percentiles: Array, startTs: number, endTs: number, periodInterval: GetEventForecastPercentilesHistoryPeriodIntervalEnum, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEventForecastPercentilesHistory(ticker, seriesTicker, percentiles, startTs, endTs, periodInterval, options).then((request) => request(axios, basePath)); }, /** * Endpoint for getting metadata about an event by its ticker. Returns only the metadata information for an event. * @summary Get Event Metadata * @param {string} eventTicker Event ticker * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEventMetadata(eventTicker: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEventMetadata(eventTicker, options).then((request) => request(axios, basePath)); }, /** * Get all events. This endpoint excludes multivariate events. To retrieve multivariate events, use the GET /events/multivariate endpoint. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Events * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 200. Maximum value is 200. * @param {string} [cursor] Parameter to specify the pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. Historical markets settled before the historical cutoff will not be included. * @param {boolean} [withMilestones] If true, includes related milestones as a field alongside events. * @param {GetEventsStatusEnum} [status] Filter by event status. Possible values are \'unopened\', \'open\', \'closed\', \'settled\'. Leave empty to return events with any status. * @param {string} [seriesTicker] Filter by series ticker * @param {number} [minCloseTs] Filter events with at least one market with close timestamp greater than this Unix timestamp (in seconds). * @param {number} [minUpdatedTs] Filter events with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEvents(limit?: number, cursor?: string, withNestedMarkets?: boolean, withMilestones?: boolean, status?: GetEventsStatusEnum, seriesTicker?: string, minCloseTs?: number, minUpdatedTs?: number, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEvents(limit, cursor, withNestedMarkets, withMilestones, status, seriesTicker, minCloseTs, minUpdatedTs, options).then((request) => request(axios, basePath)); }, /** * End-point for returning aggregated data across all markets corresponding to an event. * @summary Get Event Candlesticks * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetMarketCandlesticksByEventPeriodIntervalEnum} periodInterval Specifies the length of each candlestick period, in minutes. Must be one minute, one hour, or one day. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getMarketCandlesticksByEvent(ticker: string, seriesTicker: string, startTs: number, endTs: number, periodInterval: GetMarketCandlesticksByEventPeriodIntervalEnum, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getMarketCandlesticksByEvent(ticker, seriesTicker, startTs, endTs, periodInterval, options).then((request) => request(axios, basePath)); }, /** * Retrieve multivariate (combo) events. These are dynamically created events from multivariate event collections. Supports filtering by series and collection ticker. * @summary Get Multivariate Events * @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. * @param {string} [seriesTicker] Filter by series ticker * @param {string} [collectionTicker] Filter events by collection ticker. Returns only multivariate events belonging to the specified collection. Cannot be used together with series_ticker. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getMultivariateEvents(limit?: number, cursor?: string, seriesTicker?: string, collectionTicker?: string, withNestedMarkets?: boolean, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getMultivariateEvents(limit, cursor, seriesTicker, collectionTicker, withNestedMarkets, options).then((request) => request(axios, basePath)); }, }; }; /** * EventsApi - object-oriented interface */ export class EventsApi extends BaseAPI { /** * Endpoint for getting data about an event by its ticker. An event represents a real-world occurrence that can be traded on, such as an election, sports game, or economic indicator release. Events contain one or more markets where users can place trades on different outcomes. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Event * @param {string} eventTicker Event ticker * @param {boolean} [withNestedMarkets] If true, markets are included within the event object. If false (default), markets are returned as a separate top-level field in the response. Historical markets settled before the historical cutoff will not be included. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getEvent(eventTicker: string, withNestedMarkets?: boolean, options?: RawAxiosRequestConfig) { return EventsApiFp(this.configuration).getEvent(eventTicker, withNestedMarkets, options).then((request) => request(this.axios, this.basePath)); } /** * Endpoint for getting the historical raw and formatted forecast numbers for an event at specific percentiles. * @summary Get Event Forecast Percentile History * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {Array} percentiles Array of percentile values to retrieve (0-10000, max 10 values) * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetEventForecastPercentilesHistoryPeriodIntervalEnum} periodInterval Specifies the length of each forecast period, in minutes. 0 for 5-second intervals, or 1, 60, or 1440 for minute-based intervals. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getEventForecastPercentilesHistory(ticker: string, seriesTicker: string, percentiles: Array, startTs: number, endTs: number, periodInterval: GetEventForecastPercentilesHistoryPeriodIntervalEnum, options?: RawAxiosRequestConfig) { return EventsApiFp(this.configuration).getEventForecastPercentilesHistory(ticker, seriesTicker, percentiles, startTs, endTs, periodInterval, options).then((request) => request(this.axios, this.basePath)); } /** * Endpoint for getting metadata about an event by its ticker. Returns only the metadata information for an event. * @summary Get Event Metadata * @param {string} eventTicker Event ticker * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getEventMetadata(eventTicker: string, options?: RawAxiosRequestConfig) { return EventsApiFp(this.configuration).getEventMetadata(eventTicker, options).then((request) => request(this.axios, this.basePath)); } /** * Get all events. This endpoint excludes multivariate events. To retrieve multivariate events, use the GET /events/multivariate endpoint. All events are accessible through this endpoint, even if their associated markets are older than the historical cutoff. * @summary Get Events * @param {number} [limit] Parameter to specify the number of results per page. Defaults to 200. Maximum value is 200. * @param {string} [cursor] Parameter to specify the pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. Historical markets settled before the historical cutoff will not be included. * @param {boolean} [withMilestones] If true, includes related milestones as a field alongside events. * @param {GetEventsStatusEnum} [status] Filter by event status. Possible values are \'unopened\', \'open\', \'closed\', \'settled\'. Leave empty to return events with any status. * @param {string} [seriesTicker] Filter by series ticker * @param {number} [minCloseTs] Filter events with at least one market with close timestamp greater than this Unix timestamp (in seconds). * @param {number} [minUpdatedTs] Filter events with metadata updated after this Unix timestamp (in seconds). Use this to efficiently poll for changes. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getEvents(limit?: number, cursor?: string, withNestedMarkets?: boolean, withMilestones?: boolean, status?: GetEventsStatusEnum, seriesTicker?: string, minCloseTs?: number, minUpdatedTs?: number, options?: RawAxiosRequestConfig) { return EventsApiFp(this.configuration).getEvents(limit, cursor, withNestedMarkets, withMilestones, status, seriesTicker, minCloseTs, minUpdatedTs, options).then((request) => request(this.axios, this.basePath)); } /** * End-point for returning aggregated data across all markets corresponding to an event. * @summary Get Event Candlesticks * @param {string} ticker The event ticker * @param {string} seriesTicker The series ticker * @param {number} startTs Start timestamp for the range * @param {number} endTs End timestamp for the range * @param {GetMarketCandlesticksByEventPeriodIntervalEnum} periodInterval Specifies the length of each candlestick period, in minutes. Must be one minute, one hour, or one day. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getMarketCandlesticksByEvent(ticker: string, seriesTicker: string, startTs: number, endTs: number, periodInterval: GetMarketCandlesticksByEventPeriodIntervalEnum, options?: RawAxiosRequestConfig) { return EventsApiFp(this.configuration).getMarketCandlesticksByEvent(ticker, seriesTicker, startTs, endTs, periodInterval, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieve multivariate (combo) events. These are dynamically created events from multivariate event collections. Supports filtering by series and collection ticker. * @summary Get Multivariate Events * @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. * @param {string} [seriesTicker] Filter by series ticker * @param {string} [collectionTicker] Filter events by collection ticker. Returns only multivariate events belonging to the specified collection. Cannot be used together with series_ticker. * @param {boolean} [withNestedMarkets] Parameter to specify if nested markets should be included in the response. When true, each event will include a \'markets\' field containing a list of Market objects associated with that event. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getMultivariateEvents(limit?: number, cursor?: string, seriesTicker?: string, collectionTicker?: string, withNestedMarkets?: boolean, options?: RawAxiosRequestConfig) { return EventsApiFp(this.configuration).getMultivariateEvents(limit, cursor, seriesTicker, collectionTicker, withNestedMarkets, options).then((request) => request(this.axios, this.basePath)); } } export const GetEventForecastPercentilesHistoryPeriodIntervalEnum = { NUMBER_0: 0, NUMBER_1: 1, NUMBER_60: 60, NUMBER_1440: 1440 } as const; export type GetEventForecastPercentilesHistoryPeriodIntervalEnum = typeof GetEventForecastPercentilesHistoryPeriodIntervalEnum[keyof typeof GetEventForecastPercentilesHistoryPeriodIntervalEnum]; export const GetEventsStatusEnum = { Unopened: 'unopened', Open: 'open', Closed: 'closed', Settled: 'settled' } as const; export type GetEventsStatusEnum = typeof GetEventsStatusEnum[keyof typeof GetEventsStatusEnum]; export const GetMarketCandlesticksByEventPeriodIntervalEnum = { NUMBER_1: 1, NUMBER_60: 60, NUMBER_1440: 1440 } as const; export type GetMarketCandlesticksByEventPeriodIntervalEnum = typeof GetMarketCandlesticksByEventPeriodIntervalEnum[keyof typeof GetMarketCandlesticksByEventPeriodIntervalEnum];