kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
613 lines (612 loc) • 39.5 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrderGroupsApi = exports.OrderGroupsApiFactory = exports.OrderGroupsApiFp = exports.OrderGroupsApiAxiosParamCreator = 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");
/**
* OrderGroupsApi - axios parameter creator
*/
const OrderGroupsApiAxiosParamCreator = function (configuration) {
return {
/**
* Creates a new order group with a contracts limit measured over a rolling 15-second window. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.
* @summary Create Order Group
* @param {CreateOrderGroupRequest} createOrderGroupRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createOrderGroup: (createOrderGroupRequest_1, ...args_1) => __awaiter(this, [createOrderGroupRequest_1, ...args_1], void 0, function* (createOrderGroupRequest, options = {}) {
// verify required parameter 'createOrderGroupRequest' is not null or undefined
(0, common_1.assertParamExists)('createOrderGroup', 'createOrderGroupRequest', createOrderGroupRequest);
const localVarPath = `/portfolio/order_groups/create`;
// 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)(createOrderGroupRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Deletes an order group and cancels all orders within it. This permanently removes the group.
* @summary Delete Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrderGroup: (orderGroupId_1, subaccount_1, ...args_1) => __awaiter(this, [orderGroupId_1, subaccount_1, ...args_1], void 0, function* (orderGroupId, subaccount, options = {}) {
// verify required parameter 'orderGroupId' is not null or undefined
(0, common_1.assertParamExists)('deleteOrderGroup', 'orderGroupId', orderGroupId);
const localVarPath = `/portfolio/order_groups/{order_group_id}`
.replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
// 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: 'DELETE' }, 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,
};
}),
/**
* Retrieves details for a single order group including all order IDs and auto-cancel status.
* @summary Get Order Group
* @param {string} orderGroupId Order group ID
* @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}
*/
getOrderGroup: (orderGroupId_1, subaccount_1, ...args_1) => __awaiter(this, [orderGroupId_1, subaccount_1, ...args_1], void 0, function* (orderGroupId, subaccount, options = {}) {
// verify required parameter 'orderGroupId' is not null or undefined
(0, common_1.assertParamExists)('getOrderGroup', 'orderGroupId', orderGroupId);
const localVarPath = `/portfolio/order_groups/{order_group_id}`
.replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
// 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,
};
}),
/**
* Retrieves all order groups for the authenticated user.
* @summary Get Order Groups
* @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}
*/
getOrderGroups: (subaccount_1, ...args_1) => __awaiter(this, [subaccount_1, ...args_1], void 0, function* (subaccount, options = {}) {
const localVarPath = `/portfolio/order_groups`;
// 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,
};
}),
/**
* Resets the order group\'s matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.
* @summary Reset Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resetOrderGroup: (orderGroupId_1, subaccount_1, body_1, ...args_1) => __awaiter(this, [orderGroupId_1, subaccount_1, body_1, ...args_1], void 0, function* (orderGroupId, subaccount, body, options = {}) {
// verify required parameter 'orderGroupId' is not null or undefined
(0, common_1.assertParamExists)('resetOrderGroup', 'orderGroupId', orderGroupId);
const localVarPath = `/portfolio/order_groups/{order_group_id}/reset`
.replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
// 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);
if (subaccount !== undefined) {
localVarQueryParameter['subaccount'] = subaccount;
}
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)(body, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Triggers the order group, canceling all orders in the group and preventing new orders until the group is reset.
* @summary Trigger Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
triggerOrderGroup: (orderGroupId_1, subaccount_1, body_1, ...args_1) => __awaiter(this, [orderGroupId_1, subaccount_1, body_1, ...args_1], void 0, function* (orderGroupId, subaccount, body, options = {}) {
// verify required parameter 'orderGroupId' is not null or undefined
(0, common_1.assertParamExists)('triggerOrderGroup', 'orderGroupId', orderGroupId);
const localVarPath = `/portfolio/order_groups/{order_group_id}/trigger`
.replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
// 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);
if (subaccount !== undefined) {
localVarQueryParameter['subaccount'] = subaccount;
}
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)(body, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Updates the order group contracts limit (rolling 15-second window). If the updated limit would immediately trigger the group, all orders in the group are canceled and the group is triggered.
* @summary Update Order Group Limit
* @param {string} orderGroupId Order group ID
* @param {UpdateOrderGroupLimitRequest} updateOrderGroupLimitRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateOrderGroupLimit: (orderGroupId_1, updateOrderGroupLimitRequest_1, ...args_1) => __awaiter(this, [orderGroupId_1, updateOrderGroupLimitRequest_1, ...args_1], void 0, function* (orderGroupId, updateOrderGroupLimitRequest, options = {}) {
// verify required parameter 'orderGroupId' is not null or undefined
(0, common_1.assertParamExists)('updateOrderGroupLimit', 'orderGroupId', orderGroupId);
// verify required parameter 'updateOrderGroupLimitRequest' is not null or undefined
(0, common_1.assertParamExists)('updateOrderGroupLimit', 'updateOrderGroupLimitRequest', updateOrderGroupLimitRequest);
const localVarPath = `/portfolio/order_groups/{order_group_id}/limit`
.replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
// 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)(updateOrderGroupLimitRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
exports.OrderGroupsApiAxiosParamCreator = OrderGroupsApiAxiosParamCreator;
/**
* OrderGroupsApi - functional programming interface
*/
const OrderGroupsApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.OrderGroupsApiAxiosParamCreator)(configuration);
return {
/**
* Creates a new order group with a contracts limit measured over a rolling 15-second window. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.
* @summary Create Order Group
* @param {CreateOrderGroupRequest} createOrderGroupRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createOrderGroup(createOrderGroupRequest, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.createOrderGroup(createOrderGroupRequest, 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);
});
},
/**
* Deletes an order group and cancels all orders within it. This permanently removes the group.
* @summary Delete Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrderGroup(orderGroupId, subaccount, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteOrderGroup(orderGroupId, 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);
});
},
/**
* Retrieves details for a single order group including all order IDs and auto-cancel status.
* @summary Get Order Group
* @param {string} orderGroupId Order group ID
* @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}
*/
getOrderGroup(orderGroupId, subaccount, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroup(orderGroupId, 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);
});
},
/**
* Retrieves all order groups for the authenticated user.
* @summary Get Order Groups
* @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}
*/
getOrderGroups(subaccount, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroups(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);
});
},
/**
* Resets the order group\'s matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.
* @summary Reset Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resetOrderGroup(orderGroupId, subaccount, body, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.resetOrderGroup(orderGroupId, subaccount, body, 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);
});
},
/**
* Triggers the order group, canceling all orders in the group and preventing new orders until the group is reset.
* @summary Trigger Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
triggerOrderGroup(orderGroupId, subaccount, body, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.triggerOrderGroup(orderGroupId, subaccount, body, 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 order group contracts limit (rolling 15-second window). If the updated limit would immediately trigger the group, all orders in the group are canceled and the group is triggered.
* @summary Update Order Group Limit
* @param {string} orderGroupId Order group ID
* @param {UpdateOrderGroupLimitRequest} updateOrderGroupLimitRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateOrderGroupLimit(orderGroupId, updateOrderGroupLimitRequest, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
const localVarAxiosArgs = yield localVarAxiosParamCreator.updateOrderGroupLimit(orderGroupId, updateOrderGroupLimitRequest, 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.OrderGroupsApiFp = OrderGroupsApiFp;
/**
* OrderGroupsApi - factory interface
*/
const OrderGroupsApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.OrderGroupsApiFp)(configuration);
return {
/**
* Creates a new order group with a contracts limit measured over a rolling 15-second window. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.
* @summary Create Order Group
* @param {CreateOrderGroupRequest} createOrderGroupRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createOrderGroup(createOrderGroupRequest, options) {
return localVarFp.createOrderGroup(createOrderGroupRequest, options).then((request) => request(axios, basePath));
},
/**
* Deletes an order group and cancels all orders within it. This permanently removes the group.
* @summary Delete Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrderGroup(orderGroupId, subaccount, options) {
return localVarFp.deleteOrderGroup(orderGroupId, subaccount, options).then((request) => request(axios, basePath));
},
/**
* Retrieves details for a single order group including all order IDs and auto-cancel status.
* @summary Get Order Group
* @param {string} orderGroupId Order group ID
* @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}
*/
getOrderGroup(orderGroupId, subaccount, options) {
return localVarFp.getOrderGroup(orderGroupId, subaccount, options).then((request) => request(axios, basePath));
},
/**
* Retrieves all order groups for the authenticated user.
* @summary Get Order Groups
* @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}
*/
getOrderGroups(subaccount, options) {
return localVarFp.getOrderGroups(subaccount, options).then((request) => request(axios, basePath));
},
/**
* Resets the order group\'s matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.
* @summary Reset Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resetOrderGroup(orderGroupId, subaccount, body, options) {
return localVarFp.resetOrderGroup(orderGroupId, subaccount, body, options).then((request) => request(axios, basePath));
},
/**
* Triggers the order group, canceling all orders in the group and preventing new orders until the group is reset.
* @summary Trigger Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
triggerOrderGroup(orderGroupId, subaccount, body, options) {
return localVarFp.triggerOrderGroup(orderGroupId, subaccount, body, options).then((request) => request(axios, basePath));
},
/**
* Updates the order group contracts limit (rolling 15-second window). If the updated limit would immediately trigger the group, all orders in the group are canceled and the group is triggered.
* @summary Update Order Group Limit
* @param {string} orderGroupId Order group ID
* @param {UpdateOrderGroupLimitRequest} updateOrderGroupLimitRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateOrderGroupLimit(orderGroupId, updateOrderGroupLimitRequest, options) {
return localVarFp.updateOrderGroupLimit(orderGroupId, updateOrderGroupLimitRequest, options).then((request) => request(axios, basePath));
},
};
};
exports.OrderGroupsApiFactory = OrderGroupsApiFactory;
/**
* OrderGroupsApi - object-oriented interface
*/
class OrderGroupsApi extends base_1.BaseAPI {
/**
* Creates a new order group with a contracts limit measured over a rolling 15-second window. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.
* @summary Create Order Group
* @param {CreateOrderGroupRequest} createOrderGroupRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createOrderGroup(createOrderGroupRequest, options) {
return (0, exports.OrderGroupsApiFp)(this.configuration).createOrderGroup(createOrderGroupRequest, options).then((request) => request(this.axios, this.basePath));
}
/**
* Deletes an order group and cancels all orders within it. This permanently removes the group.
* @summary Delete Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrderGroup(orderGroupId, subaccount, options) {
return (0, exports.OrderGroupsApiFp)(this.configuration).deleteOrderGroup(orderGroupId, subaccount, options).then((request) => request(this.axios, this.basePath));
}
/**
* Retrieves details for a single order group including all order IDs and auto-cancel status.
* @summary Get Order Group
* @param {string} orderGroupId Order group ID
* @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}
*/
getOrderGroup(orderGroupId, subaccount, options) {
return (0, exports.OrderGroupsApiFp)(this.configuration).getOrderGroup(orderGroupId, subaccount, options).then((request) => request(this.axios, this.basePath));
}
/**
* Retrieves all order groups for the authenticated user.
* @summary Get Order Groups
* @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}
*/
getOrderGroups(subaccount, options) {
return (0, exports.OrderGroupsApiFp)(this.configuration).getOrderGroups(subaccount, options).then((request) => request(this.axios, this.basePath));
}
/**
* Resets the order group\'s matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.
* @summary Reset Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resetOrderGroup(orderGroupId, subaccount, body, options) {
return (0, exports.OrderGroupsApiFp)(this.configuration).resetOrderGroup(orderGroupId, subaccount, body, options).then((request) => request(this.axios, this.basePath));
}
/**
* Triggers the order group, canceling all orders in the group and preventing new orders until the group is reset.
* @summary Trigger Order Group
* @param {string} orderGroupId Order group ID
* @param {number} [subaccount] Subaccount number (0 for primary, 1-32 for subaccounts). Defaults to 0.
* @param {object} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
triggerOrderGroup(orderGroupId, subaccount, body, options) {
return (0, exports.OrderGroupsApiFp)(this.configuration).triggerOrderGroup(orderGroupId, subaccount, body, options).then((request) => request(this.axios, this.basePath));
}
/**
* Updates the order group contracts limit (rolling 15-second window). If the updated limit would immediately trigger the group, all orders in the group are canceled and the group is triggered.
* @summary Update Order Group Limit
* @param {string} orderGroupId Order group ID
* @param {UpdateOrderGroupLimitRequest} updateOrderGroupLimitRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateOrderGroupLimit(orderGroupId, updateOrderGroupLimitRequest, options) {
return (0, exports.OrderGroupsApiFp)(this.configuration).updateOrderGroupLimit(orderGroupId, updateOrderGroupLimitRequest, options).then((request) => request(this.axios, this.basePath));
}
}
exports.OrderGroupsApi = OrderGroupsApi;