kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
746 lines • 63.2 kB
JavaScript
"use strict";
/* 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PortfolioApi = exports.PortfolioApiFactory = exports.PortfolioApiFp = exports.PortfolioApiAxiosParamCreator = void 0;
const axios_1 = require("axios");
// URLSearchParams not necessarily used
// @ts-ignore
const url_1 = require("url");
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("../common");
// @ts-ignore
const base_1 = require("../base");
/**
* PortfolioApi - axios parameter creator
*/
const PortfolioApiAxiosParamCreator = function (configuration) {
return {
/**
* Transfers funds between the authenticated user\'s subaccounts. Use 0 for the primary account, or 1-32 for numbered subaccounts.
* @summary Transfer Between Subaccounts
* @param {ApplySubaccountTransferRequest} applySubaccountTransferRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
applySubaccountTransfer: (applySubaccountTransferRequest_1, ...args_1) => __awaiter(this, [applySubaccountTransferRequest_1, ...args_1], void 0, function* (applySubaccountTransferRequest, options = {}) {
// verify required parameter 'applySubaccountTransferRequest' is not null or undefined
(0, common_1.assertParamExists)('applySubaccountTransfer', 'applySubaccountTransferRequest', applySubaccountTransferRequest);
const localVarPath = `/portfolio/subaccounts/transfer`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(applySubaccountTransferRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Creates a new subaccount for the authenticated user. Subaccounts are numbered sequentially starting from 1. Maximum 32 subaccounts per user.
* @summary Create Subaccount
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createSubaccount: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/portfolio/subaccounts`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting the balance and portfolio value of a member. Both values are returned in cents.
* @summary Get Balance
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBalance: (subaccount_1, ...args_1) => __awaiter(this, [subaccount_1, ...args_1], void 0, function* (subaccount, options = {}) {
const localVarPath = `/portfolio/balance`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
if (subaccount !== undefined) {
localVarQueryParameter['subaccount'] = subaccount;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting all fills for the member. A fill is when a trade you have is matched. Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
* @summary Get Fills
* @param {string} [ticker] Filter by market ticker
* @param {string} [orderId] Filter by order ID
* @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 200.
* @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFills: (ticker_1, orderId_1, minTs_1, maxTs_1, limit_1, cursor_1, subaccount_1, ...args_1) => __awaiter(this, [ticker_1, orderId_1, minTs_1, maxTs_1, limit_1, cursor_1, subaccount_1, ...args_1], void 0, function* (ticker, orderId, minTs, maxTs, limit, cursor, subaccount, options = {}) {
const localVarPath = `/portfolio/fills`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
if (ticker !== undefined) {
localVarQueryParameter['ticker'] = ticker;
}
if (orderId !== undefined) {
localVarQueryParameter['order_id'] = orderId;
}
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;
}
if (subaccount !== undefined) {
localVarQueryParameter['subaccount'] = subaccount;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you\'re uncertain about this endpoint, it likely does not apply to you.
* @summary Get Total Resting Order Value
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPortfolioRestingOrderTotalValue: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/portfolio/summary/total_resting_order_value`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded
* @summary Get Positions
* @param {string} [cursor] The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.
* @param {number} [limit] Parameter to specify the number of results per page. Defaults to 100.
* @param {string} [countFilter] Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted - position, total_traded
* @param {string} [ticker] Filter by market ticker
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPositions: (cursor_1, limit_1, countFilter_1, ticker_1, eventTicker_1, subaccount_1, ...args_1) => __awaiter(this, [cursor_1, limit_1, countFilter_1, ticker_1, eventTicker_1, subaccount_1, ...args_1], void 0, function* (cursor, limit, countFilter, ticker, eventTicker, subaccount, options = {}) {
const localVarPath = `/portfolio/positions`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (countFilter !== undefined) {
localVarQueryParameter['count_filter'] = countFilter;
}
if (ticker !== undefined) {
localVarQueryParameter['ticker'] = ticker;
}
if (eventTicker !== undefined) {
localVarQueryParameter['event_ticker'] = eventTicker;
}
if (subaccount !== undefined) {
localVarQueryParameter['subaccount'] = subaccount;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Endpoint for getting the member\'s settlements historical track.
* @summary Get Settlements
* @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 {string} [ticker] Filter by market ticker
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {number} [minTs] Filter items after this Unix timestamp
* @param {number} [maxTs] Filter items before this Unix timestamp
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getSettlements: (limit_1, cursor_1, ticker_1, eventTicker_1, minTs_1, maxTs_1, subaccount_1, ...args_1) => __awaiter(this, [limit_1, cursor_1, ticker_1, eventTicker_1, minTs_1, maxTs_1, subaccount_1, ...args_1], void 0, function* (limit, cursor, ticker, eventTicker, minTs, maxTs, subaccount, options = {}) {
const localVarPath = `/portfolio/settlements`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (ticker !== undefined) {
localVarQueryParameter['ticker'] = ticker;
}
if (eventTicker !== undefined) {
localVarQueryParameter['event_ticker'] = eventTicker;
}
if (minTs !== undefined) {
localVarQueryParameter['min_ts'] = minTs;
}
if (maxTs !== undefined) {
localVarQueryParameter['max_ts'] = maxTs;
}
if (subaccount !== undefined) {
localVarQueryParameter['subaccount'] = subaccount;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Gets balances for all subaccounts including the primary account.
* @summary Get All Subaccount Balances
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getSubaccountBalances: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/portfolio/subaccounts/balances`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Gets the netting enabled settings for all subaccounts.
* @summary Get Subaccount Netting
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getSubaccountNetting: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/portfolio/subaccounts/netting`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Gets a paginated list of all transfers between subaccounts for the authenticated user.
* @summary Get Subaccount Transfers
* @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}
*/
getSubaccountTransfers: (limit_1, cursor_1, ...args_1) => __awaiter(this, [limit_1, cursor_1, ...args_1], void 0, function* (limit, cursor, options = {}) {
const localVarPath = `/portfolio/subaccounts/transfers`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.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 (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Updates the netting enabled setting for a specific subaccount. Use 0 for the primary account, or 1-32 for numbered subaccounts.
* @summary Update Subaccount Netting
* @param {UpdateSubaccountNettingRequest} updateSubaccountNettingRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateSubaccountNetting: (updateSubaccountNettingRequest_1, ...args_1) => __awaiter(this, [updateSubaccountNettingRequest_1, ...args_1], void 0, function* (updateSubaccountNettingRequest, options = {}) {
// verify required parameter 'updateSubaccountNettingRequest' is not null or undefined
(0, common_1.assertParamExists)('updateSubaccountNetting', 'updateSubaccountNettingRequest', updateSubaccountNettingRequest);
const localVarPath = `/portfolio/subaccounts/netting`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication kalshiAccessSignature required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-SIGNATURE", configuration);
// authentication kalshiAccessKey required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-KEY", configuration);
// authentication kalshiAccessTimestamp required
yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "KALSHI-ACCESS-TIMESTAMP", configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(updateSubaccountNettingRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
exports.PortfolioApiAxiosParamCreator = PortfolioApiAxiosParamCreator;
/**
* PortfolioApi - functional programming interface
*/
const PortfolioApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.PortfolioApiAxiosParamCreator)(configuration);
return {
/**
* Transfers funds between the authenticated user\'s subaccounts. Use 0 for the primary account, or 1-32 for numbered subaccounts.
* @summary Transfer Between Subaccounts
* @param {ApplySubaccountTransferRequest} applySubaccountTransferRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
applySubaccountTransfer(applySubaccountTransferRequest, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.applySubaccountTransfer(applySubaccountTransferRequest, 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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Creates a new subaccount for the authenticated user. Subaccounts are numbered sequentially starting from 1. Maximum 32 subaccounts per user.
* @summary Create Subaccount
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createSubaccount(options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.createSubaccount(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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting the balance and portfolio value of a member. Both values are returned in cents.
* @summary Get Balance
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBalance(subaccount, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBalance(subaccount, 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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting all fills for the member. A fill is when a trade you have is matched. Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
* @summary Get Fills
* @param {string} [ticker] Filter by market ticker
* @param {string} [orderId] Filter by order ID
* @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 200.
* @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFills(ticker, orderId, minTs, maxTs, limit, cursor, subaccount, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getFills(ticker, orderId, minTs, maxTs, limit, cursor, subaccount, 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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you\'re uncertain about this endpoint, it likely does not apply to you.
* @summary Get Total Resting Order Value
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPortfolioRestingOrderTotalValue(options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getPortfolioRestingOrderTotalValue(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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded
* @summary Get Positions
* @param {string} [cursor] The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.
* @param {number} [limit] Parameter to specify the number of results per page. Defaults to 100.
* @param {string} [countFilter] Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted - position, total_traded
* @param {string} [ticker] Filter by market ticker
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPositions(cursor, limit, countFilter, ticker, eventTicker, subaccount, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getPositions(cursor, limit, countFilter, ticker, eventTicker, subaccount, 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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Endpoint for getting the member\'s settlements historical track.
* @summary Get Settlements
* @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 {string} [ticker] Filter by market ticker
* @param {string} [eventTicker] Event ticker to filter by. Only a single event ticker is supported.
* @param {number} [minTs] Filter items after this Unix timestamp
* @param {number} [maxTs] Filter items before this Unix timestamp
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getSettlements(limit, cursor, ticker, eventTicker, minTs, maxTs, subaccount, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getSettlements(limit, cursor, ticker, eventTicker, minTs, maxTs, subaccount, 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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Gets balances for all subaccounts including the primary account.
* @summary Get All Subaccount Balances
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getSubaccountBalances(options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getSubaccountBalances(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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Gets the netting enabled settings for all subaccounts.
* @summary Get Subaccount Netting
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getSubaccountNetting(options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getSubaccountNetting(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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Gets a paginated list of all transfers between subaccounts for the authenticated user.
* @summary Get Subaccount Transfers
* @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}
*/
getSubaccountTransfers(limit, cursor, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getSubaccountTransfers(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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Updates the netting enabled setting for a specific subaccount. Use 0 for the primary account, or 1-32 for numbered subaccounts.
* @summary Update Subaccount Netting
* @param {UpdateSubaccountNettingRequest} updateSubaccountNettingRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateSubaccountNetting(updateSubaccountNettingRequest, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.updateSubaccountNetting(updateSubaccountNettingRequest, 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) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
exports.PortfolioApiFp = PortfolioApiFp;
/**
* PortfolioApi - factory interface
*/
const PortfolioApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.PortfolioApiFp)(configuration);
return {
/**
* Transfers funds between the authenticated user\'s subaccounts. Use 0 for the primary account, or 1-32 for numbered subaccounts.
* @summary Transfer Between Subaccounts
* @param {ApplySubaccountTransferRequest} applySubaccountTransferRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
applySubaccountTransfer(applySubaccountTransferRequest, options) {
return localVarFp.applySubaccountTransfer(applySubaccountTransferRequest, options).then((request) => request(axios, basePath));
},
/**
* Creates a new subaccount for the authenticated user. Subaccounts are numbered sequentially starting from 1. Maximum 32 subaccounts per user.
* @summary Create Subaccount
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createSubaccount(options) {
return localVarFp.createSubaccount(options).then((request) => request(axios, basePath));
},
/**
* Endpoint for getting the balance and portfolio value of a member. Both values are returned in cents.
* @summary Get Balance
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBalance(subaccount, options) {
return localVarFp.getBalance(subaccount, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for getting all fills for the member. A fill is when a trade you have is matched. Fills that occurred before the historical cutoff are only available via `GET /historical/fills`. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
* @summary Get Fills
* @param {string} [ticker] Filter by market ticker
* @param {string} [orderId] Filter by order ID
* @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 200.
* @param {string} [cursor] Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). If omitted, defaults to all subaccounts.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFills(ticker, orderId, minTs, maxTs, limit, cursor, subaccount, options) {
return localVarFp.getFills(ticker, orderId, minTs, maxTs, limit, cursor, subaccount, options).then((request) => request(axios, basePath));
},
/**
* Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you\'re uncertain about this endpoint, it likely does not apply to you.
* @summary Get Total Resting Order Value
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPortfolioRestingOrderTotalValue(options) {
return localVarFp.getPortfolioRestingOrderTotalValue(options).then((request) => request(axios, basePath));
},
/**
* Restricts the positions to those with any of