kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
653 lines (652 loc) • 44.8 kB
JavaScript
/* 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.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import globalAxios from 'axios';
// URLSearchParams not necessarily used
// @ts-ignore
import { URL } from 'url';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setSearchParams, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, BaseAPI } from '../base';
/**
* HistoricalApi - axios parameter creator
*/
export const HistoricalApiAxiosParamCreator = function (configuration) {
return {
/**
* Endpoint for getting all historical fills for the member. A fill is when a trade you have is matched.
* @summary Get Historical Fills
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFillsHistorical: (ticker_1, maxTs_1, limit_1, cursor_1, ...args_1) => __awaiter(this, [ticker_1, maxTs_1, limit_1, cursor_1, ...args_1], void 0, function* (ticker, maxTs, limit, cursor, options = {}) {
const localVarPath = `/historical/fills`;
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
if (ticker !== undefined) {
localVarQueryParameter['ticker'] = ticker;
}
if (maxTs !== undefined) {
localVarQueryParameter['max_ts'] = maxTs;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Returns the cutoff timestamps that define the boundary between **live** and **historical** data. ## Cutoff fields - `market_settled_ts` : Markets that **settled** before this timestamp, and their candlesticks, must be accessed via `GET /historical/markets` and `GET /historical/markets/{ticker}/candlesticks`. - `trades_created_ts` : Trades that were **filled** before this timestamp must be accessed via `GET /historical/fills`. - `orders_updated_ts` : Orders that were **canceled or fully executed** before this timestamp must be accessed via `GET /historical/orders`. Resting (active) orders are always available in `GET /portfolio/orders`.
* @summary Get Historical Cutoff Timestamps
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalCutoff: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/historical/cutoff`;
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting data about a specific market by its ticker from the historical database.
* @summary Get Historical Market
* @param {string} ticker Market ticker
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarket: (ticker_1, ...args_1) => __awaiter(this, [ticker_1, ...args_1], void 0, function* (ticker, options = {}) {
// verify required parameter 'ticker' is not null or undefined
assertParamExists('getHistoricalMarket', 'ticker', ticker);
const localVarPath = `/historical/markets/{ticker}`
.replace(`{${"ticker"}}`, encodeURIComponent(String(ticker)));
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting markets that have been archived to the historical database. Filters are mutually exclusive.
* @summary Get Historical Markets
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {string} [tickers] Filter by specific market tickers. Comma-separated list of market tickers to retrieve.
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {GetHistoricalMarketsMveFilterEnum} [mveFilter] Filter by multivariate events (combos). By default, MVE markets are included.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarkets: (limit_1, cursor_1, tickers_1, eventTicker_1, mveFilter_1, ...args_1) => __awaiter(this, [limit_1, cursor_1, tickers_1, eventTicker_1, mveFilter_1, ...args_1], void 0, function* (limit, cursor, tickers, eventTicker, mveFilter, options = {}) {
const localVarPath = `/historical/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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (tickers !== undefined) {
localVarQueryParameter['tickers'] = tickers;
}
if (eventTicker !== undefined) {
localVarQueryParameter['event_ticker'] = eventTicker;
}
if (mveFilter !== undefined) {
localVarQueryParameter['mve_filter'] = mveFilter;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting orders that have been archived to the historical database.
* @summary Get Historical Orders
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalOrders: (ticker_1, maxTs_1, limit_1, cursor_1, ...args_1) => __awaiter(this, [ticker_1, maxTs_1, limit_1, cursor_1, ...args_1], void 0, function* (ticker, maxTs, limit, cursor, options = {}) {
const localVarPath = `/historical/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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield setApiKeyToObject(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
if (ticker !== undefined) {
localVarQueryParameter['ticker'] = ticker;
}
if (maxTs !== undefined) {
localVarQueryParameter['max_ts'] = maxTs;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for fetching historical candlestick data for markets that have been archived from the live data set. Time period length of each candlestick in minutes. Valid values: 1 (1 minute), 60 (1 hour), 1440 (1 day).
* @summary Get Historical Market Candlesticks
* @param {string} ticker Market ticker - unique identifier for the specific market
* @param {number} startTs Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time.
* @param {number} endTs End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time.
* @param {GetMarketCandlesticksHistoricalPeriodIntervalEnum} periodInterval Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMarketCandlesticksHistorical: (ticker_1, startTs_1, endTs_1, periodInterval_1, ...args_1) => __awaiter(this, [ticker_1, startTs_1, endTs_1, periodInterval_1, ...args_1], void 0, function* (ticker, startTs, endTs, periodInterval, options = {}) {
// verify required parameter 'ticker' is not null or undefined
assertParamExists('getMarketCandlesticksHistorical', 'ticker', ticker);
// verify required parameter 'startTs' is not null or undefined
assertParamExists('getMarketCandlesticksHistorical', 'startTs', startTs);
// verify required parameter 'endTs' is not null or undefined
assertParamExists('getMarketCandlesticksHistorical', 'endTs', endTs);
// verify required parameter 'periodInterval' is not null or undefined
assertParamExists('getMarketCandlesticksHistorical', 'periodInterval', periodInterval);
const localVarPath = `/historical/markets/{ticker}/candlesticks`
.replace(`{${"ticker"}}`, encodeURIComponent(String(ticker)));
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
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 = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting all historical trades for all markets. Trades that were filled before the historical cutoff are available via this endpoint. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
* @summary Get Historical Trades
* @param {string} [ticker] Filter by market ticker
* @param {number} [minTs] Filter items after this Unix timestamp
* @param {number} [maxTs] Filter items before this Unix timestamp
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTradesHistorical: (ticker_1, minTs_1, maxTs_1, limit_1, cursor_1, ...args_1) => __awaiter(this, [ticker_1, minTs_1, maxTs_1, limit_1, cursor_1, ...args_1], void 0, function* (ticker, minTs, maxTs, limit, cursor, options = {}) {
const localVarPath = `/historical/trades`;
// 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 = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (ticker !== undefined) {
localVarQueryParameter['ticker'] = ticker;
}
if (minTs !== undefined) {
localVarQueryParameter['min_ts'] = minTs;
}
if (maxTs !== undefined) {
localVarQueryParameter['max_ts'] = maxTs;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* HistoricalApi - functional programming interface
*/
export const HistoricalApiFp = function (configuration) {
const localVarAxiosParamCreator = HistoricalApiAxiosParamCreator(configuration);
return {
/**
* Endpoint for getting all historical fills for the member. A fill is when a trade you have is matched.
* @summary Get Historical Fills
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFillsHistorical(ticker, maxTs, limit, cursor, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getFillsHistorical(ticker, maxTs, limit, cursor, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Returns the cutoff timestamps that define the boundary between **live** and **historical** data. ## Cutoff fields - `market_settled_ts` : Markets that **settled** before this timestamp, and their candlesticks, must be accessed via `GET /historical/markets` and `GET /historical/markets/{ticker}/candlesticks`. - `trades_created_ts` : Trades that were **filled** before this timestamp must be accessed via `GET /historical/fills`. - `orders_updated_ts` : Orders that were **canceled or fully executed** before this timestamp must be accessed via `GET /historical/orders`. Resting (active) orders are always available in `GET /portfolio/orders`.
* @summary Get Historical Cutoff Timestamps
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalCutoff(options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getHistoricalCutoff(options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting data about a specific market by its ticker from the historical database.
* @summary Get Historical Market
* @param {string} ticker Market ticker
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarket(ticker, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getHistoricalMarket(ticker, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting markets that have been archived to the historical database. Filters are mutually exclusive.
* @summary Get Historical Markets
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {string} [tickers] Filter by specific market tickers. Comma-separated list of market tickers to retrieve.
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {GetHistoricalMarketsMveFilterEnum} [mveFilter] Filter by multivariate events (combos). By default, MVE markets are included.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarkets(limit, cursor, tickers, eventTicker, mveFilter, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getHistoricalMarkets(limit, cursor, tickers, eventTicker, mveFilter, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting orders that have been archived to the historical database.
* @summary Get Historical Orders
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalOrders(ticker, maxTs, limit, cursor, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getHistoricalOrders(ticker, maxTs, limit, cursor, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for fetching historical candlestick data for markets that have been archived from the live data set. Time period length of each candlestick in minutes. Valid values: 1 (1 minute), 60 (1 hour), 1440 (1 day).
* @summary Get Historical Market Candlesticks
* @param {string} ticker Market ticker - unique identifier for the specific market
* @param {number} startTs Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time.
* @param {number} endTs End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time.
* @param {GetMarketCandlesticksHistoricalPeriodIntervalEnum} periodInterval Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMarketCandlesticksHistorical(ticker, startTs, endTs, periodInterval, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getMarketCandlesticksHistorical(ticker, startTs, endTs, periodInterval, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting all historical trades for all markets. Trades that were filled before the historical cutoff are available via this endpoint. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
* @summary Get Historical Trades
* @param {string} [ticker] Filter by market ticker
* @param {number} [minTs] Filter items after this Unix timestamp
* @param {number} [maxTs] Filter items before this Unix timestamp
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTradesHistorical(ticker, minTs, maxTs, limit, cursor, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getTradesHistorical(ticker, minTs, maxTs, limit, cursor, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = undefined;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
/**
* HistoricalApi - factory interface
*/
export const HistoricalApiFactory = function (configuration, basePath, axios) {
const localVarFp = HistoricalApiFp(configuration);
return {
/**
* Endpoint for getting all historical fills for the member. A fill is when a trade you have is matched.
* @summary Get Historical Fills
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFillsHistorical(ticker, maxTs, limit, cursor, options) {
return localVarFp.getFillsHistorical(ticker, maxTs, limit, cursor, options).then((request) => request(axios, basePath));
},
/**
* Returns the cutoff timestamps that define the boundary between **live** and **historical** data. ## Cutoff fields - `market_settled_ts` : Markets that **settled** before this timestamp, and their candlesticks, must be accessed via `GET /historical/markets` and `GET /historical/markets/{ticker}/candlesticks`. - `trades_created_ts` : Trades that were **filled** before this timestamp must be accessed via `GET /historical/fills`. - `orders_updated_ts` : Orders that were **canceled or fully executed** before this timestamp must be accessed via `GET /historical/orders`. Resting (active) orders are always available in `GET /portfolio/orders`.
* @summary Get Historical Cutoff Timestamps
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalCutoff(options) {
return localVarFp.getHistoricalCutoff(options).then((request) => request(axios, basePath));
},
/**
* Endpoint for getting data about a specific market by its ticker from the historical database.
* @summary Get Historical Market
* @param {string} ticker Market ticker
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarket(ticker, options) {
return localVarFp.getHistoricalMarket(ticker, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for getting markets that have been archived to the historical database. Filters are mutually exclusive.
* @summary Get Historical Markets
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {string} [tickers] Filter by specific market tickers. Comma-separated list of market tickers to retrieve.
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {GetHistoricalMarketsMveFilterEnum} [mveFilter] Filter by multivariate events (combos). By default, MVE markets are included.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarkets(limit, cursor, tickers, eventTicker, mveFilter, options) {
return localVarFp.getHistoricalMarkets(limit, cursor, tickers, eventTicker, mveFilter, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for getting orders that have been archived to the historical database.
* @summary Get Historical Orders
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalOrders(ticker, maxTs, limit, cursor, options) {
return localVarFp.getHistoricalOrders(ticker, maxTs, limit, cursor, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for fetching historical candlestick data for markets that have been archived from the live data set. Time period length of each candlestick in minutes. Valid values: 1 (1 minute), 60 (1 hour), 1440 (1 day).
* @summary Get Historical Market Candlesticks
* @param {string} ticker Market ticker - unique identifier for the specific market
* @param {number} startTs Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time.
* @param {number} endTs End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time.
* @param {GetMarketCandlesticksHistoricalPeriodIntervalEnum} periodInterval Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMarketCandlesticksHistorical(ticker, startTs, endTs, periodInterval, options) {
return localVarFp.getMarketCandlesticksHistorical(ticker, startTs, endTs, periodInterval, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for getting all historical trades for all markets. Trades that were filled before the historical cutoff are available via this endpoint. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
* @summary Get Historical Trades
* @param {string} [ticker] Filter by market ticker
* @param {number} [minTs] Filter items after this Unix timestamp
* @param {number} [maxTs] Filter items before this Unix timestamp
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTradesHistorical(ticker, minTs, maxTs, limit, cursor, options) {
return localVarFp.getTradesHistorical(ticker, minTs, maxTs, limit, cursor, options).then((request) => request(axios, basePath));
},
};
};
/**
* HistoricalApi - object-oriented interface
*/
export class HistoricalApi extends BaseAPI {
/**
* Endpoint for getting all historical fills for the member. A fill is when a trade you have is matched.
* @summary Get Historical Fills
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFillsHistorical(ticker, maxTs, limit, cursor, options) {
return HistoricalApiFp(this.configuration).getFillsHistorical(ticker, maxTs, limit, cursor, options).then((request) => request(this.axios, this.basePath));
}
/**
* Returns the cutoff timestamps that define the boundary between **live** and **historical** data. ## Cutoff fields - `market_settled_ts` : Markets that **settled** before this timestamp, and their candlesticks, must be accessed via `GET /historical/markets` and `GET /historical/markets/{ticker}/candlesticks`. - `trades_created_ts` : Trades that were **filled** before this timestamp must be accessed via `GET /historical/fills`. - `orders_updated_ts` : Orders that were **canceled or fully executed** before this timestamp must be accessed via `GET /historical/orders`. Resting (active) orders are always available in `GET /portfolio/orders`.
* @summary Get Historical Cutoff Timestamps
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalCutoff(options) {
return HistoricalApiFp(this.configuration).getHistoricalCutoff(options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for getting data about a specific market by its ticker from the historical database.
* @summary Get Historical Market
* @param {string} ticker Market ticker
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarket(ticker, options) {
return HistoricalApiFp(this.configuration).getHistoricalMarket(ticker, options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for getting markets that have been archived to the historical database. Filters are mutually exclusive.
* @summary Get Historical Markets
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {string} [tickers] Filter by specific market tickers. Comma-separated list of market tickers to retrieve.
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {GetHistoricalMarketsMveFilterEnum} [mveFilter] Filter by multivariate events (combos). By default, MVE markets are included.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalMarkets(limit, cursor, tickers, eventTicker, mveFilter, options) {
return HistoricalApiFp(this.configuration).getHistoricalMarkets(limit, cursor, tickers, eventTicker, mveFilter, options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for getting orders that have been archived to the historical database.
* @summary Get Historical Orders
* @param {string} [ticker] Filter by market ticker
* @param {number} [maxTs] Filter items before this Unix timestamp
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getHistoricalOrders(ticker, maxTs, limit, cursor, options) {
return HistoricalApiFp(this.configuration).getHistoricalOrders(ticker, maxTs, limit, cursor, options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for fetching historical candlestick data for markets that have been archived from the live data set. Time period length of each candlestick in minutes. Valid values: 1 (1 minute), 60 (1 hour), 1440 (1 day).
* @summary Get Historical Market Candlesticks
* @param {string} ticker Market ticker - unique identifier for the specific market
* @param {number} startTs Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time.
* @param {number} endTs End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time.
* @param {GetMarketCandlesticksHistoricalPeriodIntervalEnum} periodInterval Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getMarketCandlesticksHistorical(ticker, startTs, endTs, periodInterval, options) {
return HistoricalApiFp(this.configuration).getMarketCandlesticksHistorical(ticker, startTs, endTs, periodInterval, options).then((request) => request(this.axios, this.basePath));
}
/**
* Endpoint for getting all historical trades for all markets. Trades that were filled before the historical cutoff are available via this endpoint. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
* @summary Get Historical Trades
* @param {string} [ticker] Filter by market ticker
* @param {number} [minTs] Filter items after this Unix timestamp
* @param {number} [maxTs] Filter items before this Unix timestamp
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTradesHistorical(ticker, minTs, maxTs, limit, cursor, options) {
return HistoricalApiFp(this.configuration).getTradesHistorical(ticker, minTs, maxTs, limit, cursor, options).then((request) => request(this.axios, this.basePath));
}
}
export const GetHistoricalMarketsMveFilterEnum = {
Exclude: 'exclude'
};
export const GetMarketCandlesticksHistoricalPeriodIntervalEnum = {
NUMBER_1: 1,
NUMBER_60: 60,
NUMBER_1440: 1440
};