kalshi-typescript 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +4 -1
- package/.openapi-generator-ignore +9 -2
- package/README.md +200 -29
- package/api/exchange-api.ts +4 -4
- package/api/markets-api.ts +4 -4
- package/api/portfolio-api.ts +75 -1
- package/auth.ts +38 -0
- package/base.ts +51 -17
- package/common.ts +1 -1
- package/configuration.ts +1 -1
- package/dist/api/api-keys-api.d.ts +4 -4
- package/dist/api/communications-api.d.ts +11 -11
- package/dist/api/events-api.d.ts +3 -3
- package/dist/api/exchange-api.d.ts +8 -8
- package/dist/api/exchange-api.js +4 -4
- package/dist/api/markets-api.d.ts +9 -9
- package/dist/api/markets-api.js +4 -4
- package/dist/api/milestones-api.d.ts +2 -2
- package/dist/api/multivariate-collections-api.d.ts +3 -3
- package/dist/api/portfolio-api.d.ts +52 -19
- package/dist/api/portfolio-api.js +69 -1
- package/dist/api/series-api.d.ts +2 -2
- package/dist/api/structured-targets-api.d.ts +2 -2
- package/dist/auth.d.ts +7 -0
- package/dist/auth.js +33 -0
- package/dist/base.d.ts +25 -10
- package/dist/base.js +37 -6
- package/dist/esm/api/api-keys-api.d.ts +4 -4
- package/dist/esm/api/communications-api.d.ts +11 -11
- package/dist/esm/api/events-api.d.ts +3 -3
- package/dist/esm/api/exchange-api.d.ts +8 -8
- package/dist/esm/api/exchange-api.js +4 -4
- package/dist/esm/api/markets-api.d.ts +9 -9
- package/dist/esm/api/markets-api.js +4 -4
- package/dist/esm/api/milestones-api.d.ts +2 -2
- package/dist/esm/api/multivariate-collections-api.d.ts +3 -3
- package/dist/esm/api/portfolio-api.d.ts +52 -19
- package/dist/esm/api/portfolio-api.js +69 -1
- package/dist/esm/api/series-api.d.ts +2 -2
- package/dist/esm/api/structured-targets-api.d.ts +2 -2
- package/dist/esm/auth.d.ts +7 -0
- package/dist/esm/auth.js +29 -0
- package/dist/esm/base.d.ts +25 -10
- package/dist/esm/base.js +36 -5
- package/dist/esm/models/amend-order-request.d.ts +30 -0
- package/dist/esm/models/amend-order-request.js +8 -1
- package/dist/esm/models/create-order-group-request.d.ts +4 -1
- package/dist/esm/models/create-order-group-response.d.ts +4 -2
- package/dist/esm/models/create-order-request.d.ts +8 -0
- package/dist/esm/models/error-response-error.d.ts +1 -1
- package/dist/esm/models/event-position.d.ts +53 -0
- package/dist/esm/models/event-position.js +14 -0
- package/dist/esm/models/get-order-group-response.d.ts +21 -0
- package/dist/esm/models/get-order-group-response.js +14 -0
- package/dist/esm/models/get-order-response.d.ts +1 -1
- package/dist/esm/models/get-positions-response.d.ts +3 -1
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/models/order-group.d.ts +8 -4
- package/dist/esm/models/order.d.ts +16 -0
- package/dist/models/amend-order-request.d.ts +30 -0
- package/dist/models/amend-order-request.js +9 -0
- package/dist/models/create-order-group-request.d.ts +4 -1
- package/dist/models/create-order-group-response.d.ts +4 -2
- package/dist/models/create-order-request.d.ts +8 -0
- package/dist/models/error-response-error.d.ts +1 -1
- package/dist/models/event-position.d.ts +53 -0
- package/dist/models/event-position.js +15 -0
- package/dist/models/get-order-group-response.d.ts +21 -0
- package/dist/models/get-order-group-response.js +15 -0
- package/dist/models/get-order-response.d.ts +1 -1
- package/dist/models/get-positions-response.d.ts +3 -1
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/order-group.d.ts +8 -4
- package/dist/models/order.d.ts +16 -0
- package/docs/AcceptQuoteRequest.md +1 -1
- package/docs/AmendOrderRequest.md +11 -1
- package/docs/AmendOrderResponse.md +1 -1
- package/docs/Announcement.md +1 -1
- package/docs/ApiKey.md +1 -1
- package/docs/ApiKeysApi.md +20 -8
- package/docs/BatchCancelOrdersRequest.md +1 -1
- package/docs/BatchCancelOrdersResponse.md +1 -1
- package/docs/BatchCancelOrdersResponseResponsesInner.md +1 -1
- package/docs/BatchCreateOrdersRequest.md +1 -1
- package/docs/BatchCreateOrdersResponse.md +1 -1
- package/docs/BatchCreateOrdersResponseResponsesInner.md +1 -1
- package/docs/CancelOrderResponse.md +1 -1
- package/docs/Candlestick.md +1 -1
- package/docs/CommunicationsApi.md +55 -22
- package/docs/CreateApiKeyRequest.md +1 -1
- package/docs/CreateApiKeyResponse.md +1 -1
- package/docs/CreateOrderGroupRequest.md +3 -3
- package/docs/CreateOrderGroupResponse.md +3 -3
- package/docs/CreateOrderRequest.md +5 -1
- package/docs/CreateOrderResponse.md +1 -1
- package/docs/CreateQuoteRequest.md +1 -1
- package/docs/CreateQuoteResponse.md +1 -1
- package/docs/CreateRFQRequest.md +1 -1
- package/docs/CreateRFQResponse.md +1 -1
- package/docs/DailySchedule.md +1 -1
- package/docs/DecreaseOrderRequest.md +1 -1
- package/docs/DecreaseOrderResponse.md +1 -1
- package/docs/ErrorResponse.md +1 -1
- package/docs/ErrorResponseError.md +2 -2
- package/docs/Event.md +1 -1
- package/docs/EventPosition.md +38 -0
- package/docs/EventsApi.md +15 -6
- package/docs/ExchangeApi.md +21 -9
- package/docs/ExchangeStatus.md +1 -1
- package/docs/Fill.md +1 -1
- package/docs/GenerateApiKeyRequest.md +1 -1
- package/docs/GenerateApiKeyResponse.md +1 -1
- package/docs/GetApiKeysResponse.md +1 -1
- package/docs/GetBalanceResponse.md +1 -1
- package/docs/GetCommunicationsIDResponse.md +1 -1
- package/docs/GetEventMetadataResponse.md +1 -1
- package/docs/GetEventResponse.md +1 -1
- package/docs/GetEventsResponse.md +1 -1
- package/docs/GetExchangeAnnouncementsResponse.md +1 -1
- package/docs/GetExchangeScheduleResponse.md +1 -1
- package/docs/GetExchangeScheduleResponseSchedule.md +1 -1
- package/docs/GetFillsResponse.md +1 -1
- package/docs/GetMarketCandlesticksResponse.md +1 -1
- package/docs/GetMarketOrderbookResponse.md +1 -1
- package/docs/GetMarketOrderbookResponseOrderbook.md +1 -1
- package/docs/GetMarketResponse.md +1 -1
- package/docs/GetMarketsResponse.md +1 -1
- package/docs/GetMilestoneResponse.md +1 -1
- package/docs/GetMilestonesResponse.md +1 -1
- package/docs/GetMultivariateEventCollectionResponse.md +1 -1
- package/docs/GetMultivariateEventCollectionsResponse.md +1 -1
- package/docs/GetOrderGroupResponse.md +22 -0
- package/docs/GetOrderGroupsResponse.md +1 -1
- package/docs/GetOrderQueuePositionResponse.md +1 -1
- package/docs/GetOrderResponse.md +2 -2
- package/docs/GetOrdersResponse.md +1 -1
- package/docs/GetPositionsResponse.md +5 -3
- package/docs/GetQueuePositionsRequest.md +1 -1
- package/docs/GetQueuePositionsResponse.md +1 -1
- package/docs/GetQuoteResponse.md +1 -1
- package/docs/GetQuotesResponse.md +1 -1
- package/docs/GetRFQResponse.md +1 -1
- package/docs/GetRFQsResponse.md +1 -1
- package/docs/GetSeriesByTickerResponse.md +1 -1
- package/docs/GetSeriesResponse.md +1 -1
- package/docs/GetSettlementsResponse.md +1 -1
- package/docs/GetStructuredTargetResponse.md +1 -1
- package/docs/GetStructuredTargetsResponse.md +1 -1
- package/docs/GetTotalRestingOrderValueResponse.md +1 -1
- package/docs/GetTradesResponse.md +1 -1
- package/docs/GetUserDataTimestampResponse.md +1 -1
- package/docs/LookupBundleRequest.md +1 -1
- package/docs/LookupBundleRequestBundleInner.md +1 -1
- package/docs/LookupBundleResponse.md +1 -1
- package/docs/Market.md +1 -1
- package/docs/MarketsApi.md +26 -11
- package/docs/Milestone.md +1 -1
- package/docs/MilestonesApi.md +10 -4
- package/docs/MultivariateCollectionsApi.md +15 -6
- package/docs/MultivariateEventCollection.md +1 -1
- package/docs/MultivariateEventCollectionEventsInner.md +1 -1
- package/docs/Order.md +9 -1
- package/docs/OrderGroup.md +5 -9
- package/docs/OrderbookLevel.md +1 -1
- package/docs/PortfolioApi.md +154 -39
- package/docs/Position.md +1 -1
- package/docs/Quote.md +1 -1
- package/docs/RFQ.md +1 -1
- package/docs/Series.md +1 -1
- package/docs/SeriesApi.md +10 -4
- package/docs/Settlement.md +1 -1
- package/docs/StructuredTarget.md +1 -1
- package/docs/StructuredTargetsApi.md +10 -4
- package/docs/Trade.md +1 -1
- package/models/amend-order-request.ts +34 -0
- package/models/create-order-group-request.ts +4 -1
- package/models/create-order-group-response.ts +4 -4
- package/models/create-order-request.ts +8 -0
- package/models/error-response-error.ts +1 -1
- package/models/event-position.ts +59 -0
- package/models/get-order-group-response.ts +27 -0
- package/models/get-order-response.ts +1 -1
- package/models/get-positions-response.ts +5 -1
- package/models/index.ts +2 -0
- package/models/order-group.ts +8 -4
- package/models/order.ts +16 -0
- package/package.json +4 -4
|
@@ -416,6 +416,38 @@ export const PortfolioApiAxiosParamCreator = function (configuration) {
|
|
|
416
416
|
options: localVarRequestOptions,
|
|
417
417
|
};
|
|
418
418
|
}),
|
|
419
|
+
/**
|
|
420
|
+
* Get details of a specific order group
|
|
421
|
+
* @summary Get Order Group
|
|
422
|
+
* @param {string} orderGroupId Order group ID
|
|
423
|
+
* @param {*} [options] Override http request option.
|
|
424
|
+
* @throws {RequiredError}
|
|
425
|
+
*/
|
|
426
|
+
getOrderGroup: (orderGroupId_1, ...args_1) => __awaiter(this, [orderGroupId_1, ...args_1], void 0, function* (orderGroupId, options = {}) {
|
|
427
|
+
// verify required parameter 'orderGroupId' is not null or undefined
|
|
428
|
+
assertParamExists('getOrderGroup', 'orderGroupId', orderGroupId);
|
|
429
|
+
const localVarPath = `/portfolio/order_groups/{order_group_id}`
|
|
430
|
+
.replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
|
|
431
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
432
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
433
|
+
let baseOptions;
|
|
434
|
+
if (configuration) {
|
|
435
|
+
baseOptions = configuration.baseOptions;
|
|
436
|
+
}
|
|
437
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
|
|
438
|
+
const localVarHeaderParameter = {};
|
|
439
|
+
const localVarQueryParameter = {};
|
|
440
|
+
// authentication bearerAuth required
|
|
441
|
+
// http bearer authentication required
|
|
442
|
+
yield setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
443
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
444
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
445
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
446
|
+
return {
|
|
447
|
+
url: toPathString(localVarUrlObj),
|
|
448
|
+
options: localVarRequestOptions,
|
|
449
|
+
};
|
|
450
|
+
}),
|
|
419
451
|
/**
|
|
420
452
|
* Get order groups for the logged-in user
|
|
421
453
|
* @summary Get Order Groups
|
|
@@ -711,7 +743,7 @@ export const PortfolioApiAxiosParamCreator = function (configuration) {
|
|
|
711
743
|
if (configuration) {
|
|
712
744
|
baseOptions = configuration.baseOptions;
|
|
713
745
|
}
|
|
714
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: '
|
|
746
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options);
|
|
715
747
|
const localVarHeaderParameter = {};
|
|
716
748
|
const localVarQueryParameter = {};
|
|
717
749
|
// authentication bearerAuth required
|
|
@@ -915,6 +947,22 @@ export const PortfolioApiFp = function (configuration) {
|
|
|
915
947
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
916
948
|
});
|
|
917
949
|
},
|
|
950
|
+
/**
|
|
951
|
+
* Get details of a specific order group
|
|
952
|
+
* @summary Get Order Group
|
|
953
|
+
* @param {string} orderGroupId Order group ID
|
|
954
|
+
* @param {*} [options] Override http request option.
|
|
955
|
+
* @throws {RequiredError}
|
|
956
|
+
*/
|
|
957
|
+
getOrderGroup(orderGroupId, options) {
|
|
958
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
959
|
+
var _a, _b, _c;
|
|
960
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroup(orderGroupId, options);
|
|
961
|
+
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
|
|
962
|
+
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PortfolioApi.getOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
|
|
963
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
964
|
+
});
|
|
965
|
+
},
|
|
918
966
|
/**
|
|
919
967
|
* Get order groups for the logged-in user
|
|
920
968
|
* @summary Get Order Groups
|
|
@@ -1180,6 +1228,16 @@ export const PortfolioApiFactory = function (configuration, basePath, axios) {
|
|
|
1180
1228
|
getOrder(orderId, options) {
|
|
1181
1229
|
return localVarFp.getOrder(orderId, options).then((request) => request(axios, basePath));
|
|
1182
1230
|
},
|
|
1231
|
+
/**
|
|
1232
|
+
* Get details of a specific order group
|
|
1233
|
+
* @summary Get Order Group
|
|
1234
|
+
* @param {string} orderGroupId Order group ID
|
|
1235
|
+
* @param {*} [options] Override http request option.
|
|
1236
|
+
* @throws {RequiredError}
|
|
1237
|
+
*/
|
|
1238
|
+
getOrderGroup(orderGroupId, options) {
|
|
1239
|
+
return localVarFp.getOrderGroup(orderGroupId, options).then((request) => request(axios, basePath));
|
|
1240
|
+
},
|
|
1183
1241
|
/**
|
|
1184
1242
|
* Get order groups for the logged-in user
|
|
1185
1243
|
* @summary Get Order Groups
|
|
@@ -1395,6 +1453,16 @@ export class PortfolioApi extends BaseAPI {
|
|
|
1395
1453
|
getOrder(orderId, options) {
|
|
1396
1454
|
return PortfolioApiFp(this.configuration).getOrder(orderId, options).then((request) => request(this.axios, this.basePath));
|
|
1397
1455
|
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Get details of a specific order group
|
|
1458
|
+
* @summary Get Order Group
|
|
1459
|
+
* @param {string} orderGroupId Order group ID
|
|
1460
|
+
* @param {*} [options] Override http request option.
|
|
1461
|
+
* @throws {RequiredError}
|
|
1462
|
+
*/
|
|
1463
|
+
getOrderGroup(orderGroupId, options) {
|
|
1464
|
+
return PortfolioApiFp(this.configuration).getOrderGroup(orderGroupId, options).then((request) => request(this.axios, this.basePath));
|
|
1465
|
+
}
|
|
1398
1466
|
/**
|
|
1399
1467
|
* Get order groups for the logged-in user
|
|
1400
1468
|
* @summary Get Order Groups
|
|
@@ -88,7 +88,7 @@ export declare class SeriesApi extends BaseAPI {
|
|
|
88
88
|
* @param {*} [options] Override http request option.
|
|
89
89
|
* @throws {RequiredError}
|
|
90
90
|
*/
|
|
91
|
-
getSeries(status?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesResponse, any>>;
|
|
91
|
+
getSeries(status?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesResponse, any, {}>>;
|
|
92
92
|
/**
|
|
93
93
|
* Get a single series by its ticker
|
|
94
94
|
* @summary Get Series by Ticker
|
|
@@ -96,5 +96,5 @@ export declare class SeriesApi extends BaseAPI {
|
|
|
96
96
|
* @param {*} [options] Override http request option.
|
|
97
97
|
* @throws {RequiredError}
|
|
98
98
|
*/
|
|
99
|
-
getSeriesByTicker(ticker: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesByTickerResponse, any>>;
|
|
99
|
+
getSeriesByTicker(ticker: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSeriesByTickerResponse, any, {}>>;
|
|
100
100
|
}
|
|
@@ -91,7 +91,7 @@ export declare class StructuredTargetsApi extends BaseAPI {
|
|
|
91
91
|
* @param {*} [options] Override http request option.
|
|
92
92
|
* @throws {RequiredError}
|
|
93
93
|
*/
|
|
94
|
-
getStructuredTarget(structuredTargetId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetResponse, any>>;
|
|
94
|
+
getStructuredTarget(structuredTargetId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetResponse, any, {}>>;
|
|
95
95
|
/**
|
|
96
96
|
* Get all structured targets
|
|
97
97
|
* @summary Get Structured Targets
|
|
@@ -100,5 +100,5 @@ export declare class StructuredTargetsApi extends BaseAPI {
|
|
|
100
100
|
* @param {*} [options] Override http request option.
|
|
101
101
|
* @throws {RequiredError}
|
|
102
102
|
*/
|
|
103
|
-
getStructuredTargets(status?: string, pageSize?: number, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetsResponse, any>>;
|
|
103
|
+
getStructuredTargets(status?: string, pageSize?: number, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetStructuredTargetsResponse, any, {}>>;
|
|
104
104
|
}
|
package/dist/esm/auth.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as crypto from 'crypto';
|
|
2
|
+
export class KalshiAuth {
|
|
3
|
+
constructor(apiKey, privateKeyPem) {
|
|
4
|
+
this.apiKey = apiKey;
|
|
5
|
+
this.privateKeyPem = privateKeyPem;
|
|
6
|
+
}
|
|
7
|
+
signPssText(text) {
|
|
8
|
+
const sign = crypto.createSign('RSA-SHA256');
|
|
9
|
+
sign.update(text);
|
|
10
|
+
sign.end();
|
|
11
|
+
const signature = sign.sign({
|
|
12
|
+
key: this.privateKeyPem,
|
|
13
|
+
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
|
14
|
+
saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
|
|
15
|
+
});
|
|
16
|
+
return signature.toString('base64');
|
|
17
|
+
}
|
|
18
|
+
generateAuthHeaders(method, path) {
|
|
19
|
+
const currentTimeMilliseconds = Date.now();
|
|
20
|
+
const timestampStr = currentTimeMilliseconds.toString();
|
|
21
|
+
const msgString = timestampStr + method + path;
|
|
22
|
+
const sig = this.signPssText(msgString);
|
|
23
|
+
return {
|
|
24
|
+
'KALSHI-ACCESS-KEY': this.apiKey,
|
|
25
|
+
'KALSHI-ACCESS-SIGNATURE': sig,
|
|
26
|
+
'KALSHI-ACCESS-TIMESTAMP': timestampStr
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
package/dist/esm/base.d.ts
CHANGED
|
@@ -10,33 +10,48 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import type { Configuration } from './configuration';
|
|
13
|
-
import type { AxiosInstance,
|
|
13
|
+
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
14
|
+
import { KalshiAuth } from './auth';
|
|
14
15
|
export declare const BASE_PATH: string;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
*/
|
|
15
20
|
export declare const COLLECTION_FORMATS: {
|
|
16
21
|
csv: string;
|
|
17
22
|
ssv: string;
|
|
18
23
|
tsv: string;
|
|
19
24
|
pipes: string;
|
|
20
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
* @interface RequestArgs
|
|
30
|
+
*/
|
|
21
31
|
export interface RequestArgs {
|
|
22
32
|
url: string;
|
|
23
|
-
options:
|
|
33
|
+
options: AxiosRequestConfig;
|
|
24
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @class BaseAPI
|
|
39
|
+
*/
|
|
25
40
|
export declare class BaseAPI {
|
|
26
41
|
protected basePath: string;
|
|
27
42
|
protected axios: AxiosInstance;
|
|
28
43
|
protected configuration: Configuration | undefined;
|
|
44
|
+
protected auth: KalshiAuth | undefined;
|
|
29
45
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
30
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @export
|
|
50
|
+
* @class RequiredError
|
|
51
|
+
* @extends {Error}
|
|
52
|
+
*/
|
|
31
53
|
export declare class RequiredError extends Error {
|
|
32
54
|
field: string;
|
|
55
|
+
name: "RequiredError";
|
|
33
56
|
constructor(field: string, msg?: string);
|
|
34
57
|
}
|
|
35
|
-
interface ServerMap {
|
|
36
|
-
[key: string]: {
|
|
37
|
-
url: string;
|
|
38
|
-
description: string;
|
|
39
|
-
}[];
|
|
40
|
-
}
|
|
41
|
-
export declare const operationServerMap: ServerMap;
|
|
42
|
-
export {};
|
package/dist/esm/base.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
1
|
/**
|
|
4
2
|
* Kalshi Trading API
|
|
5
3
|
* Complete API for the Kalshi trading platform including all handlers for SDK generation
|
|
@@ -12,25 +10,59 @@
|
|
|
12
10
|
* Do not edit the class manually.
|
|
13
11
|
*/
|
|
14
12
|
import globalAxios from 'axios';
|
|
13
|
+
import { KalshiAuth } from './auth';
|
|
15
14
|
export const BASE_PATH = "https://api.elections.kalshi.com/trade-api/v2".replace(/\/+$/, "");
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
16
19
|
export const COLLECTION_FORMATS = {
|
|
17
20
|
csv: ",",
|
|
18
21
|
ssv: " ",
|
|
19
22
|
tsv: "\t",
|
|
20
23
|
pipes: "|",
|
|
21
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @class BaseAPI
|
|
29
|
+
*/
|
|
22
30
|
export class BaseAPI {
|
|
23
31
|
constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
|
|
24
|
-
var _a;
|
|
25
32
|
this.basePath = basePath;
|
|
26
33
|
this.axios = axios;
|
|
27
34
|
if (configuration) {
|
|
28
35
|
this.configuration = configuration;
|
|
29
|
-
this.basePath =
|
|
36
|
+
this.basePath = configuration.basePath || this.basePath;
|
|
37
|
+
// Initialize auth if credentials are provided
|
|
38
|
+
if (configuration.apiKey && (configuration.privateKeyPath || configuration.privateKeyPem)) {
|
|
39
|
+
const privateKey = configuration.privateKeyPem ||
|
|
40
|
+
(configuration.privateKeyPath ? require('fs').readFileSync(configuration.privateKeyPath, 'utf8') : '');
|
|
41
|
+
this.auth = new KalshiAuth(configuration.apiKey, privateKey);
|
|
42
|
+
}
|
|
30
43
|
}
|
|
44
|
+
// Add request interceptor for authentication
|
|
45
|
+
this.axios.interceptors.request.use((config) => {
|
|
46
|
+
if (this.auth && config.url && config.method) {
|
|
47
|
+
// Extract path from URL
|
|
48
|
+
const url = new URL(config.url, this.basePath);
|
|
49
|
+
const path = url.pathname;
|
|
50
|
+
const method = config.method.toUpperCase();
|
|
51
|
+
// Generate and add auth headers
|
|
52
|
+
const authHeaders = this.auth.generateAuthHeaders(method, path);
|
|
53
|
+
Object.assign(config.headers, authHeaders);
|
|
54
|
+
}
|
|
55
|
+
return config;
|
|
56
|
+
});
|
|
31
57
|
}
|
|
32
58
|
}
|
|
33
59
|
;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @export
|
|
63
|
+
* @class RequiredError
|
|
64
|
+
* @extends {Error}
|
|
65
|
+
*/
|
|
34
66
|
export class RequiredError extends Error {
|
|
35
67
|
constructor(field, msg) {
|
|
36
68
|
super(msg);
|
|
@@ -38,4 +70,3 @@ export class RequiredError extends Error {
|
|
|
38
70
|
this.name = "RequiredError";
|
|
39
71
|
}
|
|
40
72
|
}
|
|
41
|
-
export const operationServerMap = {};
|
|
@@ -10,7 +10,37 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
export interface AmendOrderRequest {
|
|
13
|
+
/**
|
|
14
|
+
* Market ticker
|
|
15
|
+
*/
|
|
16
|
+
'ticker': string;
|
|
17
|
+
/**
|
|
18
|
+
* Side of the order
|
|
19
|
+
*/
|
|
20
|
+
'side': AmendOrderRequestSideEnum;
|
|
21
|
+
/**
|
|
22
|
+
* Buy or sell action
|
|
23
|
+
*/
|
|
24
|
+
'action': AmendOrderRequestActionEnum;
|
|
13
25
|
'yes_price'?: number;
|
|
14
26
|
'no_price'?: number;
|
|
15
27
|
'count'?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Current client order ID
|
|
30
|
+
*/
|
|
31
|
+
'client_order_id': string;
|
|
32
|
+
/**
|
|
33
|
+
* New client order ID after amendment
|
|
34
|
+
*/
|
|
35
|
+
'updated_client_order_id': string;
|
|
16
36
|
}
|
|
37
|
+
export declare const AmendOrderRequestSideEnum: {
|
|
38
|
+
readonly Yes: "yes";
|
|
39
|
+
readonly No: "no";
|
|
40
|
+
};
|
|
41
|
+
export type AmendOrderRequestSideEnum = typeof AmendOrderRequestSideEnum[keyof typeof AmendOrderRequestSideEnum];
|
|
42
|
+
export declare const AmendOrderRequestActionEnum: {
|
|
43
|
+
readonly Buy: "buy";
|
|
44
|
+
readonly Sell: "sell";
|
|
45
|
+
};
|
|
46
|
+
export type AmendOrderRequestActionEnum = typeof AmendOrderRequestActionEnum[keyof typeof AmendOrderRequestActionEnum];
|
|
@@ -11,4 +11,11 @@
|
|
|
11
11
|
* https://openapi-generator.tech
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
|
-
export {
|
|
14
|
+
export const AmendOrderRequestSideEnum = {
|
|
15
|
+
Yes: 'yes',
|
|
16
|
+
No: 'no'
|
|
17
|
+
};
|
|
18
|
+
export const AmendOrderRequestActionEnum = {
|
|
19
|
+
Buy: 'buy',
|
|
20
|
+
Sell: 'sell'
|
|
21
|
+
};
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type { OrderGroup } from './order-group';
|
|
13
12
|
export interface CreateOrderGroupResponse {
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The unique identifier for the created order group
|
|
15
|
+
*/
|
|
16
|
+
'order_group_id'?: string;
|
|
15
17
|
}
|
|
@@ -21,6 +21,14 @@ export interface CreateOrderRequest {
|
|
|
21
21
|
'expiration_ts'?: number;
|
|
22
22
|
'sell_position_floor'?: number;
|
|
23
23
|
'buy_max_cost'?: number;
|
|
24
|
+
/**
|
|
25
|
+
* If set to true, the order will be rejected if it crosses the spread and executes immediately
|
|
26
|
+
*/
|
|
27
|
+
'post_only'?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* OrderGroupId specifies the order group this order is part of
|
|
30
|
+
*/
|
|
31
|
+
'order_group_id'?: string;
|
|
24
32
|
}
|
|
25
33
|
export declare const CreateOrderRequestSideEnum: {
|
|
26
34
|
readonly Yes: "yes";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kalshi Trading API
|
|
3
|
+
* Complete API for the Kalshi trading platform including all handlers for SDK generation
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 2.0.0
|
|
6
|
+
* Contact: support@kalshi.com
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export interface EventPosition {
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier for events.
|
|
15
|
+
*/
|
|
16
|
+
'event_ticker'?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Total spent on this event in cents.
|
|
19
|
+
*/
|
|
20
|
+
'total_cost'?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Total spent on this event in dollars.
|
|
23
|
+
*/
|
|
24
|
+
'total_cost_dollars'?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Cost of the aggregate event position in cents.
|
|
27
|
+
*/
|
|
28
|
+
'event_exposure'?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Cost of the aggregate event position in dollars.
|
|
31
|
+
*/
|
|
32
|
+
'event_exposure_dollars'?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Locked in profit and loss, in cents.
|
|
35
|
+
*/
|
|
36
|
+
'realized_pnl'?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Locked in profit and loss, in dollars.
|
|
39
|
+
*/
|
|
40
|
+
'realized_pnl_dollars'?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Aggregate size of resting orders in contract units.
|
|
43
|
+
*/
|
|
44
|
+
'resting_order_count'?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Fees paid on fill orders, in cents.
|
|
47
|
+
*/
|
|
48
|
+
'fees_paid'?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Fees paid on fill orders, in dollars.
|
|
51
|
+
*/
|
|
52
|
+
'fees_paid_dollars'?: string;
|
|
53
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Kalshi Trading API
|
|
5
|
+
* Complete API for the Kalshi trading platform including all handlers for SDK generation
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2.0.0
|
|
8
|
+
* Contact: support@kalshi.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kalshi Trading API
|
|
3
|
+
* Complete API for the Kalshi trading platform including all handlers for SDK generation
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 2.0.0
|
|
6
|
+
* Contact: support@kalshi.com
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export interface GetOrderGroupResponse {
|
|
13
|
+
/**
|
|
14
|
+
* Whether auto-cancel is enabled for this order group
|
|
15
|
+
*/
|
|
16
|
+
'is_auto_cancel_enabled'?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* List of order IDs that belong to this order group
|
|
19
|
+
*/
|
|
20
|
+
'orders'?: Array<string>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Kalshi Trading API
|
|
5
|
+
* Complete API for the Kalshi trading platform including all handlers for SDK generation
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 2.0.0
|
|
8
|
+
* Contact: support@kalshi.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
+
import type { EventPosition } from './event-position';
|
|
12
13
|
import type { Position } from './position';
|
|
13
14
|
export interface GetPositionsResponse {
|
|
14
|
-
'
|
|
15
|
+
'market_positions'?: Array<Position>;
|
|
16
|
+
'event_positions'?: Array<EventPosition>;
|
|
15
17
|
'cursor'?: string;
|
|
16
18
|
}
|
|
@@ -27,6 +27,7 @@ export * from './decrease-order-response';
|
|
|
27
27
|
export * from './error-response';
|
|
28
28
|
export * from './error-response-error';
|
|
29
29
|
export * from './event';
|
|
30
|
+
export * from './event-position';
|
|
30
31
|
export * from './exchange-status';
|
|
31
32
|
export * from './fill';
|
|
32
33
|
export * from './generate-api-key-request';
|
|
@@ -50,6 +51,7 @@ export * from './get-milestone-response';
|
|
|
50
51
|
export * from './get-milestones-response';
|
|
51
52
|
export * from './get-multivariate-event-collection-response';
|
|
52
53
|
export * from './get-multivariate-event-collections-response';
|
|
54
|
+
export * from './get-order-group-response';
|
|
53
55
|
export * from './get-order-groups-response';
|
|
54
56
|
export * from './get-order-queue-position-response';
|
|
55
57
|
export * from './get-order-response';
|
package/dist/esm/models/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export * from './decrease-order-response';
|
|
|
27
27
|
export * from './error-response';
|
|
28
28
|
export * from './error-response-error';
|
|
29
29
|
export * from './event';
|
|
30
|
+
export * from './event-position';
|
|
30
31
|
export * from './exchange-status';
|
|
31
32
|
export * from './fill';
|
|
32
33
|
export * from './generate-api-key-request';
|
|
@@ -50,6 +51,7 @@ export * from './get-milestone-response';
|
|
|
50
51
|
export * from './get-milestones-response';
|
|
51
52
|
export * from './get-multivariate-event-collection-response';
|
|
52
53
|
export * from './get-multivariate-event-collections-response';
|
|
54
|
+
export * from './get-order-group-response';
|
|
53
55
|
export * from './get-order-groups-response';
|
|
54
56
|
export * from './get-order-queue-position-response';
|
|
55
57
|
export * from './get-order-response';
|
|
@@ -10,8 +10,12 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
export interface OrderGroup {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier for the order group
|
|
15
|
+
*/
|
|
16
|
+
'id': string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether auto-cancel is enabled for this order group
|
|
19
|
+
*/
|
|
20
|
+
'is_auto_cancel_enabled'?: boolean;
|
|
17
21
|
}
|
|
@@ -20,7 +20,23 @@ export interface Order {
|
|
|
20
20
|
'yes_price'?: number;
|
|
21
21
|
'no_price'?: number;
|
|
22
22
|
'count'?: number;
|
|
23
|
+
/**
|
|
24
|
+
* The number of contracts that have been filled
|
|
25
|
+
*/
|
|
26
|
+
'fill_count'?: number;
|
|
23
27
|
'remaining_count'?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The initial size of the order (contract units)
|
|
30
|
+
*/
|
|
31
|
+
'initial_count'?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Fees paid on filled taker contracts, in cents
|
|
34
|
+
*/
|
|
35
|
+
'taker_fees'?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Fees paid on filled maker contracts, in cents
|
|
38
|
+
*/
|
|
39
|
+
'maker_fees'?: number;
|
|
24
40
|
'expiration_time'?: string;
|
|
25
41
|
'created_time'?: string;
|
|
26
42
|
'updated_time'?: string;
|
|
@@ -10,7 +10,37 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
export interface AmendOrderRequest {
|
|
13
|
+
/**
|
|
14
|
+
* Market ticker
|
|
15
|
+
*/
|
|
16
|
+
'ticker': string;
|
|
17
|
+
/**
|
|
18
|
+
* Side of the order
|
|
19
|
+
*/
|
|
20
|
+
'side': AmendOrderRequestSideEnum;
|
|
21
|
+
/**
|
|
22
|
+
* Buy or sell action
|
|
23
|
+
*/
|
|
24
|
+
'action': AmendOrderRequestActionEnum;
|
|
13
25
|
'yes_price'?: number;
|
|
14
26
|
'no_price'?: number;
|
|
15
27
|
'count'?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Current client order ID
|
|
30
|
+
*/
|
|
31
|
+
'client_order_id': string;
|
|
32
|
+
/**
|
|
33
|
+
* New client order ID after amendment
|
|
34
|
+
*/
|
|
35
|
+
'updated_client_order_id': string;
|
|
16
36
|
}
|
|
37
|
+
export declare const AmendOrderRequestSideEnum: {
|
|
38
|
+
readonly Yes: "yes";
|
|
39
|
+
readonly No: "no";
|
|
40
|
+
};
|
|
41
|
+
export type AmendOrderRequestSideEnum = typeof AmendOrderRequestSideEnum[keyof typeof AmendOrderRequestSideEnum];
|
|
42
|
+
export declare const AmendOrderRequestActionEnum: {
|
|
43
|
+
readonly Buy: "buy";
|
|
44
|
+
readonly Sell: "sell";
|
|
45
|
+
};
|
|
46
|
+
export type AmendOrderRequestActionEnum = typeof AmendOrderRequestActionEnum[keyof typeof AmendOrderRequestActionEnum];
|
|
@@ -13,3 +13,12 @@
|
|
|
13
13
|
* Do not edit the class manually.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AmendOrderRequestActionEnum = exports.AmendOrderRequestSideEnum = void 0;
|
|
17
|
+
exports.AmendOrderRequestSideEnum = {
|
|
18
|
+
Yes: 'yes',
|
|
19
|
+
No: 'no'
|
|
20
|
+
};
|
|
21
|
+
exports.AmendOrderRequestActionEnum = {
|
|
22
|
+
Buy: 'buy',
|
|
23
|
+
Sell: 'sell'
|
|
24
|
+
};
|