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
package/.openapi-generator/FILES
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.gitignore
|
|
2
2
|
.npmignore
|
|
3
|
-
.openapi-generator-ignore
|
|
4
3
|
README.md
|
|
5
4
|
api.ts
|
|
6
5
|
api/api-keys-api.ts
|
|
@@ -47,6 +46,7 @@ docs/DecreaseOrderResponse.md
|
|
|
47
46
|
docs/ErrorResponse.md
|
|
48
47
|
docs/ErrorResponseError.md
|
|
49
48
|
docs/Event.md
|
|
49
|
+
docs/EventPosition.md
|
|
50
50
|
docs/EventsApi.md
|
|
51
51
|
docs/ExchangeApi.md
|
|
52
52
|
docs/ExchangeStatus.md
|
|
@@ -72,6 +72,7 @@ docs/GetMilestoneResponse.md
|
|
|
72
72
|
docs/GetMilestonesResponse.md
|
|
73
73
|
docs/GetMultivariateEventCollectionResponse.md
|
|
74
74
|
docs/GetMultivariateEventCollectionsResponse.md
|
|
75
|
+
docs/GetOrderGroupResponse.md
|
|
75
76
|
docs/GetOrderGroupsResponse.md
|
|
76
77
|
docs/GetOrderQueuePositionResponse.md
|
|
77
78
|
docs/GetOrderResponse.md
|
|
@@ -144,6 +145,7 @@ models/decrease-order-request.ts
|
|
|
144
145
|
models/decrease-order-response.ts
|
|
145
146
|
models/error-response-error.ts
|
|
146
147
|
models/error-response.ts
|
|
148
|
+
models/event-position.ts
|
|
147
149
|
models/event.ts
|
|
148
150
|
models/exchange-status.ts
|
|
149
151
|
models/fill.ts
|
|
@@ -168,6 +170,7 @@ models/get-milestone-response.ts
|
|
|
168
170
|
models/get-milestones-response.ts
|
|
169
171
|
models/get-multivariate-event-collection-response.ts
|
|
170
172
|
models/get-multivariate-event-collections-response.ts
|
|
173
|
+
models/get-order-group-response.ts
|
|
171
174
|
models/get-order-groups-response.ts
|
|
172
175
|
models/get-order-queue-position-response.ts
|
|
173
176
|
models/get-order-response.ts
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# IMPORTANT: this file is generated with the option `openapiGeneratorIgnoreList` enabled
|
|
2
|
+
# (--openapi-generator-ignore-list in CLI for example) so the entries below are pre-populated based
|
|
3
|
+
# on the input provided by the users and this file will be overwritten every time when the option is
|
|
4
|
+
# enabled (which is the exact opposite of the default behaviour to not overwrite
|
|
5
|
+
# .openapi-generator-ignore if the file exists).
|
|
6
|
+
|
|
1
7
|
# OpenAPI Generator Ignore
|
|
2
8
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
3
9
|
|
|
@@ -22,5 +28,6 @@
|
|
|
22
28
|
# Then explicitly reverse the ignore rule for a single file:
|
|
23
29
|
#!docs/README.md
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
# The following entries are pre-populated based on the input obtained via
|
|
32
|
+
# the option `openapiGeneratorIgnoreList` (--openapi-generator-ignore-list in CLI for example).
|
|
33
|
+
auth.ts
|
package/README.md
CHANGED
|
@@ -1,44 +1,215 @@
|
|
|
1
|
-
|
|
1
|
+
## kalshi-typescript@2.1.2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Environment
|
|
6
|
+
* Node.js
|
|
7
|
+
* Webpack
|
|
8
|
+
* Browserify
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
- Build package: org.openapitools.codegen.languages.TypeScriptAxiosClientCodegen
|
|
10
|
+
Language level
|
|
11
|
+
* ES5 - you must have a Promises/A+ library installed
|
|
12
|
+
* ES6
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
Module system
|
|
15
|
+
* CommonJS
|
|
16
|
+
* ES6 module system
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
### Building
|
|
21
|
+
|
|
22
|
+
To build and compile the typescript sources to javascript use:
|
|
23
|
+
```
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
19
26
|
```
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
### Publishing
|
|
29
|
+
|
|
30
|
+
First build the package then run `npm publish`
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
import { Configuration, PortfolioApi } from 'kalshi-typescript';
|
|
32
|
+
### Consuming
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
const config = new Configuration({
|
|
28
|
-
basePath: 'https://api.elections.kalshi.com/trade-api/v2',
|
|
29
|
-
apiKey: 'your-api-key-id',
|
|
30
|
-
privateKeyPath: 'path/to/private_key.pem'
|
|
31
|
-
// or privateKeyPem: 'your-private-key-string'
|
|
32
|
-
});
|
|
34
|
+
navigate to the folder of your consuming project and run one of the following commands.
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
const portfolioApi = new PortfolioApi(config);
|
|
36
|
+
_published:_
|
|
36
37
|
|
|
37
|
-
// Make API calls
|
|
38
|
-
const balance = await portfolioApi.getBalance();
|
|
39
|
-
console.log(`Balance: $${balance.data.balance / 100}`);
|
|
40
38
|
```
|
|
39
|
+
npm install kalshi-typescript@2.1.2 --save
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
_unPublished (not recommended):_
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
npm install PATH_TO_GENERATED_PACKAGE --save
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Documentation for API Endpoints
|
|
49
|
+
|
|
50
|
+
All URIs are relative to *https://api.elections.kalshi.com/trade-api/v2*
|
|
51
|
+
|
|
52
|
+
Class | Method | HTTP request | Description
|
|
53
|
+
------------ | ------------- | ------------- | -------------
|
|
54
|
+
*ApiKeysApi* | [**createApiKey**](docs/ApiKeysApi.md#createapikey) | **POST** /api_keys | Create API Key
|
|
55
|
+
*ApiKeysApi* | [**deleteApiKey**](docs/ApiKeysApi.md#deleteapikey) | **DELETE** /api_keys/{api_key} | Delete API Key
|
|
56
|
+
*ApiKeysApi* | [**generateApiKey**](docs/ApiKeysApi.md#generateapikey) | **POST** /api_keys/generate | Generate API Key
|
|
57
|
+
*ApiKeysApi* | [**getApiKeys**](docs/ApiKeysApi.md#getapikeys) | **GET** /api_keys | Get API Keys
|
|
58
|
+
*CommunicationsApi* | [**acceptQuote**](docs/CommunicationsApi.md#acceptquote) | **PUT** /communications/quotes/{quote_id}/accept | Accept Quote
|
|
59
|
+
*CommunicationsApi* | [**confirmQuote**](docs/CommunicationsApi.md#confirmquote) | **PUT** /communications/quotes/{quote_id}/confirm | Confirm Quote
|
|
60
|
+
*CommunicationsApi* | [**createQuote**](docs/CommunicationsApi.md#createquote) | **POST** /communications/quotes | Create Quote
|
|
61
|
+
*CommunicationsApi* | [**createRFQ**](docs/CommunicationsApi.md#createrfq) | **POST** /communications/rfqs | Create RFQ
|
|
62
|
+
*CommunicationsApi* | [**deleteQuote**](docs/CommunicationsApi.md#deletequote) | **DELETE** /communications/quotes/{quote_id} | Delete Quote
|
|
63
|
+
*CommunicationsApi* | [**deleteRFQ**](docs/CommunicationsApi.md#deleterfq) | **DELETE** /communications/rfqs/{rfq_id} | Delete RFQ
|
|
64
|
+
*CommunicationsApi* | [**getCommunicationsID**](docs/CommunicationsApi.md#getcommunicationsid) | **GET** /communications/id | Get Communications ID
|
|
65
|
+
*CommunicationsApi* | [**getQuote**](docs/CommunicationsApi.md#getquote) | **GET** /communications/quotes/{quote_id} | Get Quote
|
|
66
|
+
*CommunicationsApi* | [**getQuotes**](docs/CommunicationsApi.md#getquotes) | **GET** /communications/quotes | Get Quotes
|
|
67
|
+
*CommunicationsApi* | [**getRFQ**](docs/CommunicationsApi.md#getrfq) | **GET** /communications/rfqs/{rfq_id} | Get RFQ
|
|
68
|
+
*CommunicationsApi* | [**getRFQs**](docs/CommunicationsApi.md#getrfqs) | **GET** /communications/rfqs | Get RFQs
|
|
69
|
+
*EventsApi* | [**getEvent**](docs/EventsApi.md#getevent) | **GET** /events/{event_ticker} | Get Event
|
|
70
|
+
*EventsApi* | [**getEventMetadata**](docs/EventsApi.md#geteventmetadata) | **GET** /events/{event_ticker}/metadata | Get Event Metadata
|
|
71
|
+
*EventsApi* | [**getEvents**](docs/EventsApi.md#getevents) | **GET** /events | Get Events
|
|
72
|
+
*ExchangeApi* | [**getExchangeAnnouncements**](docs/ExchangeApi.md#getexchangeannouncements) | **GET** /exchange/announcements | Get Exchange Announcements
|
|
73
|
+
*ExchangeApi* | [**getExchangeSchedule**](docs/ExchangeApi.md#getexchangeschedule) | **GET** /exchange/schedule | Get Exchange Schedule
|
|
74
|
+
*ExchangeApi* | [**getExchangeStatus**](docs/ExchangeApi.md#getexchangestatus) | **GET** /exchange/status | Get Exchange Status
|
|
75
|
+
*ExchangeApi* | [**getUserDataTimestamp**](docs/ExchangeApi.md#getuserdatatimestamp) | **GET** /exchange/user_data_timestamp | Get User Data Timestamp
|
|
76
|
+
*MarketsApi* | [**getMarket**](docs/MarketsApi.md#getmarket) | **GET** /markets/{ticker} | Get Market
|
|
77
|
+
*MarketsApi* | [**getMarketCandlesticks**](docs/MarketsApi.md#getmarketcandlesticks) | **GET** /series/{ticker}/markets/{market_ticker}/candlesticks | Get Market Candlesticks
|
|
78
|
+
*MarketsApi* | [**getMarketOrderbook**](docs/MarketsApi.md#getmarketorderbook) | **GET** /markets/{ticker}/orderbook | Get Market Orderbook
|
|
79
|
+
*MarketsApi* | [**getMarkets**](docs/MarketsApi.md#getmarkets) | **GET** /markets | Get Markets
|
|
80
|
+
*MarketsApi* | [**getTrades**](docs/MarketsApi.md#gettrades) | **GET** /markets/trades | Get Trades
|
|
81
|
+
*MilestonesApi* | [**getMilestone**](docs/MilestonesApi.md#getmilestone) | **GET** /milestones/{milestone_id} | Get Milestone
|
|
82
|
+
*MilestonesApi* | [**getMilestones**](docs/MilestonesApi.md#getmilestones) | **GET** /milestones | Get Milestones
|
|
83
|
+
*MultivariateCollectionsApi* | [**getMultivariateEventCollection**](docs/MultivariateCollectionsApi.md#getmultivariateeventcollection) | **GET** /multivariate_event_collections/{collection_ticker} | Get Multivariate Event Collection
|
|
84
|
+
*MultivariateCollectionsApi* | [**getMultivariateEventCollections**](docs/MultivariateCollectionsApi.md#getmultivariateeventcollections) | **GET** /multivariate_event_collections | Get Multivariate Event Collections
|
|
85
|
+
*MultivariateCollectionsApi* | [**lookupMultivariateEventCollectionBundle**](docs/MultivariateCollectionsApi.md#lookupmultivariateeventcollectionbundle) | **POST** /multivariate_event_collections/{collection_ticker}/lookup | Lookup Multivariate Event Collection Bundle
|
|
86
|
+
*PortfolioApi* | [**amendOrder**](docs/PortfolioApi.md#amendorder) | **POST** /portfolio/orders/{order_id}/amend | Amend Order
|
|
87
|
+
*PortfolioApi* | [**batchCancelOrders**](docs/PortfolioApi.md#batchcancelorders) | **DELETE** /portfolio/orders/batched | Batch Cancel Orders
|
|
88
|
+
*PortfolioApi* | [**batchCreateOrders**](docs/PortfolioApi.md#batchcreateorders) | **POST** /portfolio/orders/batched | Batch Create Orders
|
|
89
|
+
*PortfolioApi* | [**cancelOrder**](docs/PortfolioApi.md#cancelorder) | **DELETE** /portfolio/orders/{order_id} | Cancel Order
|
|
90
|
+
*PortfolioApi* | [**createOrder**](docs/PortfolioApi.md#createorder) | **POST** /portfolio/orders | Create Order
|
|
91
|
+
*PortfolioApi* | [**createOrderGroup**](docs/PortfolioApi.md#createordergroup) | **POST** /portfolio/order_groups/create | Create Order Group
|
|
92
|
+
*PortfolioApi* | [**decreaseOrder**](docs/PortfolioApi.md#decreaseorder) | **POST** /portfolio/orders/{order_id}/decrease | Decrease Order
|
|
93
|
+
*PortfolioApi* | [**deleteOrderGroup**](docs/PortfolioApi.md#deleteordergroup) | **DELETE** /portfolio/order_groups/{order_group_id} | Delete Order Group
|
|
94
|
+
*PortfolioApi* | [**getBalance**](docs/PortfolioApi.md#getbalance) | **GET** /portfolio/balance | Get Balance
|
|
95
|
+
*PortfolioApi* | [**getFills**](docs/PortfolioApi.md#getfills) | **GET** /portfolio/fills | Get Fills
|
|
96
|
+
*PortfolioApi* | [**getOrder**](docs/PortfolioApi.md#getorder) | **GET** /portfolio/orders/{order_id} | Get Order
|
|
97
|
+
*PortfolioApi* | [**getOrderGroup**](docs/PortfolioApi.md#getordergroup) | **GET** /portfolio/order_groups/{order_group_id} | Get Order Group
|
|
98
|
+
*PortfolioApi* | [**getOrderGroups**](docs/PortfolioApi.md#getordergroups) | **GET** /portfolio/order_groups | Get Order Groups
|
|
99
|
+
*PortfolioApi* | [**getOrderQueuePosition**](docs/PortfolioApi.md#getorderqueueposition) | **GET** /portfolio/orders/{order_id}/queue_position | Get Order Queue Position
|
|
100
|
+
*PortfolioApi* | [**getOrders**](docs/PortfolioApi.md#getorders) | **GET** /portfolio/orders | Get Orders
|
|
101
|
+
*PortfolioApi* | [**getPositions**](docs/PortfolioApi.md#getpositions) | **GET** /portfolio/positions | Get Positions
|
|
102
|
+
*PortfolioApi* | [**getQueuePositions**](docs/PortfolioApi.md#getqueuepositions) | **POST** /portfolio/orders/queue_positions | Get Queue Positions
|
|
103
|
+
*PortfolioApi* | [**getSettlements**](docs/PortfolioApi.md#getsettlements) | **GET** /portfolio/settlements | Get Settlements
|
|
104
|
+
*PortfolioApi* | [**getTotalRestingOrderValue**](docs/PortfolioApi.md#gettotalrestingordervalue) | **GET** /portfolio/summary/total_resting_order_value | Get Total Resting Order Value
|
|
105
|
+
*PortfolioApi* | [**resetOrderGroup**](docs/PortfolioApi.md#resetordergroup) | **PUT** /portfolio/order_groups/{order_group_id}/reset | Reset Order Group
|
|
106
|
+
*SeriesApi* | [**getSeries**](docs/SeriesApi.md#getseries) | **GET** /series | Get Series
|
|
107
|
+
*SeriesApi* | [**getSeriesByTicker**](docs/SeriesApi.md#getseriesbyticker) | **GET** /series/{ticker} | Get Series by Ticker
|
|
108
|
+
*StructuredTargetsApi* | [**getStructuredTarget**](docs/StructuredTargetsApi.md#getstructuredtarget) | **GET** /structured_targets/{structured_target_id} | Get Structured Target
|
|
109
|
+
*StructuredTargetsApi* | [**getStructuredTargets**](docs/StructuredTargetsApi.md#getstructuredtargets) | **GET** /structured_targets | Get Structured Targets
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Documentation For Models
|
|
113
|
+
|
|
114
|
+
- [AcceptQuoteRequest](docs/AcceptQuoteRequest.md)
|
|
115
|
+
- [AmendOrderRequest](docs/AmendOrderRequest.md)
|
|
116
|
+
- [AmendOrderResponse](docs/AmendOrderResponse.md)
|
|
117
|
+
- [Announcement](docs/Announcement.md)
|
|
118
|
+
- [ApiKey](docs/ApiKey.md)
|
|
119
|
+
- [BatchCancelOrdersRequest](docs/BatchCancelOrdersRequest.md)
|
|
120
|
+
- [BatchCancelOrdersResponse](docs/BatchCancelOrdersResponse.md)
|
|
121
|
+
- [BatchCancelOrdersResponseResponsesInner](docs/BatchCancelOrdersResponseResponsesInner.md)
|
|
122
|
+
- [BatchCreateOrdersRequest](docs/BatchCreateOrdersRequest.md)
|
|
123
|
+
- [BatchCreateOrdersResponse](docs/BatchCreateOrdersResponse.md)
|
|
124
|
+
- [BatchCreateOrdersResponseResponsesInner](docs/BatchCreateOrdersResponseResponsesInner.md)
|
|
125
|
+
- [CancelOrderResponse](docs/CancelOrderResponse.md)
|
|
126
|
+
- [Candlestick](docs/Candlestick.md)
|
|
127
|
+
- [CreateApiKeyRequest](docs/CreateApiKeyRequest.md)
|
|
128
|
+
- [CreateApiKeyResponse](docs/CreateApiKeyResponse.md)
|
|
129
|
+
- [CreateOrderGroupRequest](docs/CreateOrderGroupRequest.md)
|
|
130
|
+
- [CreateOrderGroupResponse](docs/CreateOrderGroupResponse.md)
|
|
131
|
+
- [CreateOrderRequest](docs/CreateOrderRequest.md)
|
|
132
|
+
- [CreateOrderResponse](docs/CreateOrderResponse.md)
|
|
133
|
+
- [CreateQuoteRequest](docs/CreateQuoteRequest.md)
|
|
134
|
+
- [CreateQuoteResponse](docs/CreateQuoteResponse.md)
|
|
135
|
+
- [CreateRFQRequest](docs/CreateRFQRequest.md)
|
|
136
|
+
- [CreateRFQResponse](docs/CreateRFQResponse.md)
|
|
137
|
+
- [DailySchedule](docs/DailySchedule.md)
|
|
138
|
+
- [DecreaseOrderRequest](docs/DecreaseOrderRequest.md)
|
|
139
|
+
- [DecreaseOrderResponse](docs/DecreaseOrderResponse.md)
|
|
140
|
+
- [ErrorResponse](docs/ErrorResponse.md)
|
|
141
|
+
- [ErrorResponseError](docs/ErrorResponseError.md)
|
|
142
|
+
- [Event](docs/Event.md)
|
|
143
|
+
- [EventPosition](docs/EventPosition.md)
|
|
144
|
+
- [ExchangeStatus](docs/ExchangeStatus.md)
|
|
145
|
+
- [Fill](docs/Fill.md)
|
|
146
|
+
- [GenerateApiKeyRequest](docs/GenerateApiKeyRequest.md)
|
|
147
|
+
- [GenerateApiKeyResponse](docs/GenerateApiKeyResponse.md)
|
|
148
|
+
- [GetApiKeysResponse](docs/GetApiKeysResponse.md)
|
|
149
|
+
- [GetBalanceResponse](docs/GetBalanceResponse.md)
|
|
150
|
+
- [GetCommunicationsIDResponse](docs/GetCommunicationsIDResponse.md)
|
|
151
|
+
- [GetEventMetadataResponse](docs/GetEventMetadataResponse.md)
|
|
152
|
+
- [GetEventResponse](docs/GetEventResponse.md)
|
|
153
|
+
- [GetEventsResponse](docs/GetEventsResponse.md)
|
|
154
|
+
- [GetExchangeAnnouncementsResponse](docs/GetExchangeAnnouncementsResponse.md)
|
|
155
|
+
- [GetExchangeScheduleResponse](docs/GetExchangeScheduleResponse.md)
|
|
156
|
+
- [GetExchangeScheduleResponseSchedule](docs/GetExchangeScheduleResponseSchedule.md)
|
|
157
|
+
- [GetFillsResponse](docs/GetFillsResponse.md)
|
|
158
|
+
- [GetMarketCandlesticksResponse](docs/GetMarketCandlesticksResponse.md)
|
|
159
|
+
- [GetMarketOrderbookResponse](docs/GetMarketOrderbookResponse.md)
|
|
160
|
+
- [GetMarketOrderbookResponseOrderbook](docs/GetMarketOrderbookResponseOrderbook.md)
|
|
161
|
+
- [GetMarketResponse](docs/GetMarketResponse.md)
|
|
162
|
+
- [GetMarketsResponse](docs/GetMarketsResponse.md)
|
|
163
|
+
- [GetMilestoneResponse](docs/GetMilestoneResponse.md)
|
|
164
|
+
- [GetMilestonesResponse](docs/GetMilestonesResponse.md)
|
|
165
|
+
- [GetMultivariateEventCollectionResponse](docs/GetMultivariateEventCollectionResponse.md)
|
|
166
|
+
- [GetMultivariateEventCollectionsResponse](docs/GetMultivariateEventCollectionsResponse.md)
|
|
167
|
+
- [GetOrderGroupResponse](docs/GetOrderGroupResponse.md)
|
|
168
|
+
- [GetOrderGroupsResponse](docs/GetOrderGroupsResponse.md)
|
|
169
|
+
- [GetOrderQueuePositionResponse](docs/GetOrderQueuePositionResponse.md)
|
|
170
|
+
- [GetOrderResponse](docs/GetOrderResponse.md)
|
|
171
|
+
- [GetOrdersResponse](docs/GetOrdersResponse.md)
|
|
172
|
+
- [GetPositionsResponse](docs/GetPositionsResponse.md)
|
|
173
|
+
- [GetQueuePositionsRequest](docs/GetQueuePositionsRequest.md)
|
|
174
|
+
- [GetQueuePositionsResponse](docs/GetQueuePositionsResponse.md)
|
|
175
|
+
- [GetQuoteResponse](docs/GetQuoteResponse.md)
|
|
176
|
+
- [GetQuotesResponse](docs/GetQuotesResponse.md)
|
|
177
|
+
- [GetRFQResponse](docs/GetRFQResponse.md)
|
|
178
|
+
- [GetRFQsResponse](docs/GetRFQsResponse.md)
|
|
179
|
+
- [GetSeriesByTickerResponse](docs/GetSeriesByTickerResponse.md)
|
|
180
|
+
- [GetSeriesResponse](docs/GetSeriesResponse.md)
|
|
181
|
+
- [GetSettlementsResponse](docs/GetSettlementsResponse.md)
|
|
182
|
+
- [GetStructuredTargetResponse](docs/GetStructuredTargetResponse.md)
|
|
183
|
+
- [GetStructuredTargetsResponse](docs/GetStructuredTargetsResponse.md)
|
|
184
|
+
- [GetTotalRestingOrderValueResponse](docs/GetTotalRestingOrderValueResponse.md)
|
|
185
|
+
- [GetTradesResponse](docs/GetTradesResponse.md)
|
|
186
|
+
- [GetUserDataTimestampResponse](docs/GetUserDataTimestampResponse.md)
|
|
187
|
+
- [LookupBundleRequest](docs/LookupBundleRequest.md)
|
|
188
|
+
- [LookupBundleRequestBundleInner](docs/LookupBundleRequestBundleInner.md)
|
|
189
|
+
- [LookupBundleResponse](docs/LookupBundleResponse.md)
|
|
190
|
+
- [Market](docs/Market.md)
|
|
191
|
+
- [Milestone](docs/Milestone.md)
|
|
192
|
+
- [MultivariateEventCollection](docs/MultivariateEventCollection.md)
|
|
193
|
+
- [MultivariateEventCollectionEventsInner](docs/MultivariateEventCollectionEventsInner.md)
|
|
194
|
+
- [Order](docs/Order.md)
|
|
195
|
+
- [OrderGroup](docs/OrderGroup.md)
|
|
196
|
+
- [OrderbookLevel](docs/OrderbookLevel.md)
|
|
197
|
+
- [Position](docs/Position.md)
|
|
198
|
+
- [Quote](docs/Quote.md)
|
|
199
|
+
- [RFQ](docs/RFQ.md)
|
|
200
|
+
- [Series](docs/Series.md)
|
|
201
|
+
- [Settlement](docs/Settlement.md)
|
|
202
|
+
- [StructuredTarget](docs/StructuredTarget.md)
|
|
203
|
+
- [Trade](docs/Trade.md)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<a id="documentation-for-authorization"></a>
|
|
207
|
+
## Documentation For Authorization
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
Authentication schemes defined for the API:
|
|
211
|
+
<a id="bearerAuth"></a>
|
|
212
|
+
### bearerAuth
|
|
41
213
|
|
|
42
|
-
|
|
214
|
+
- **Type**: Bearer authentication (JWT)
|
|
43
215
|
|
|
44
|
-
Full documentation is available at [docs.kalshi.com](https://docs.kalshi.com)
|
package/api/exchange-api.ts
CHANGED
|
@@ -130,7 +130,7 @@ export const ExchangeApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
130
130
|
};
|
|
131
131
|
},
|
|
132
132
|
/**
|
|
133
|
-
* There is typically a short delay before exchange events are reflected in the API endpoints.
|
|
133
|
+
* There is typically a short delay before exchange events are reflected in the API endpoints. Whenever possible, combine API responses to PUT/POST/DELETE requests with websocket data to obtain the most accurate view of the exchange state. This endpoint provides an approximate indication of when the data from the following endpoints was last validated: GetBalance, GetOrder(s), GetFills, GetPositions
|
|
134
134
|
* @summary Get User Data Timestamp
|
|
135
135
|
* @param {*} [options] Override http request option.
|
|
136
136
|
* @throws {RequiredError}
|
|
@@ -209,7 +209,7 @@ export const ExchangeApiFp = function(configuration?: Configuration) {
|
|
|
209
209
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
210
210
|
},
|
|
211
211
|
/**
|
|
212
|
-
* There is typically a short delay before exchange events are reflected in the API endpoints.
|
|
212
|
+
* There is typically a short delay before exchange events are reflected in the API endpoints. Whenever possible, combine API responses to PUT/POST/DELETE requests with websocket data to obtain the most accurate view of the exchange state. This endpoint provides an approximate indication of when the data from the following endpoints was last validated: GetBalance, GetOrder(s), GetFills, GetPositions
|
|
213
213
|
* @summary Get User Data Timestamp
|
|
214
214
|
* @param {*} [options] Override http request option.
|
|
215
215
|
* @throws {RequiredError}
|
|
@@ -257,7 +257,7 @@ export const ExchangeApiFactory = function (configuration?: Configuration, baseP
|
|
|
257
257
|
return localVarFp.getExchangeStatus(options).then((request) => request(axios, basePath));
|
|
258
258
|
},
|
|
259
259
|
/**
|
|
260
|
-
* There is typically a short delay before exchange events are reflected in the API endpoints.
|
|
260
|
+
* There is typically a short delay before exchange events are reflected in the API endpoints. Whenever possible, combine API responses to PUT/POST/DELETE requests with websocket data to obtain the most accurate view of the exchange state. This endpoint provides an approximate indication of when the data from the following endpoints was last validated: GetBalance, GetOrder(s), GetFills, GetPositions
|
|
261
261
|
* @summary Get User Data Timestamp
|
|
262
262
|
* @param {*} [options] Override http request option.
|
|
263
263
|
* @throws {RequiredError}
|
|
@@ -303,7 +303,7 @@ export class ExchangeApi extends BaseAPI {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
/**
|
|
306
|
-
* There is typically a short delay before exchange events are reflected in the API endpoints.
|
|
306
|
+
* There is typically a short delay before exchange events are reflected in the API endpoints. Whenever possible, combine API responses to PUT/POST/DELETE requests with websocket data to obtain the most accurate view of the exchange state. This endpoint provides an approximate indication of when the data from the following endpoints was last validated: GetBalance, GetOrder(s), GetFills, GetPositions
|
|
307
307
|
* @summary Get User Data Timestamp
|
|
308
308
|
* @param {*} [options] Override http request option.
|
|
309
309
|
* @throws {RequiredError}
|
package/api/markets-api.ts
CHANGED
|
@@ -180,7 +180,7 @@ export const MarketsApiAxiosParamCreator = function (configuration?: Configurati
|
|
|
180
180
|
};
|
|
181
181
|
},
|
|
182
182
|
/**
|
|
183
|
-
* List and discover markets on Kalshi.
|
|
183
|
+
* List and discover markets on Kalshi. A market represents a specific binary outcome within an event that users can trade on (e.g., \"Will candidate X win?\"). Markets have yes/no positions, current prices, volume, and settlement rules. This endpoint returns a paginated response. Use the \'limit\' parameter to control page size (1-1000, defaults to 100). The response includes a \'cursor\' field - pass this value in the \'cursor\' parameter of your next request to get the next page. An empty cursor indicates no more pages are available.
|
|
184
184
|
* @summary Get Markets
|
|
185
185
|
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
|
|
186
186
|
* @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.
|
|
@@ -362,7 +362,7 @@ export const MarketsApiFp = function(configuration?: Configuration) {
|
|
|
362
362
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
363
363
|
},
|
|
364
364
|
/**
|
|
365
|
-
* List and discover markets on Kalshi.
|
|
365
|
+
* List and discover markets on Kalshi. A market represents a specific binary outcome within an event that users can trade on (e.g., \"Will candidate X win?\"). Markets have yes/no positions, current prices, volume, and settlement rules. This endpoint returns a paginated response. Use the \'limit\' parameter to control page size (1-1000, defaults to 100). The response includes a \'cursor\' field - pass this value in the \'cursor\' parameter of your next request to get the next page. An empty cursor indicates no more pages are available.
|
|
366
366
|
* @summary Get Markets
|
|
367
367
|
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
|
|
368
368
|
* @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.
|
|
@@ -443,7 +443,7 @@ export const MarketsApiFactory = function (configuration?: Configuration, basePa
|
|
|
443
443
|
return localVarFp.getMarketOrderbook(ticker, depth, options).then((request) => request(axios, basePath));
|
|
444
444
|
},
|
|
445
445
|
/**
|
|
446
|
-
* List and discover markets on Kalshi.
|
|
446
|
+
* List and discover markets on Kalshi. A market represents a specific binary outcome within an event that users can trade on (e.g., \"Will candidate X win?\"). Markets have yes/no positions, current prices, volume, and settlement rules. This endpoint returns a paginated response. Use the \'limit\' parameter to control page size (1-1000, defaults to 100). The response includes a \'cursor\' field - pass this value in the \'cursor\' parameter of your next request to get the next page. An empty cursor indicates no more pages are available.
|
|
447
447
|
* @summary Get Markets
|
|
448
448
|
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
|
|
449
449
|
* @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.
|
|
@@ -519,7 +519,7 @@ export class MarketsApi extends BaseAPI {
|
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
/**
|
|
522
|
-
* List and discover markets on Kalshi.
|
|
522
|
+
* List and discover markets on Kalshi. A market represents a specific binary outcome within an event that users can trade on (e.g., \"Will candidate X win?\"). Markets have yes/no positions, current prices, volume, and settlement rules. This endpoint returns a paginated response. Use the \'limit\' parameter to control page size (1-1000, defaults to 100). The response includes a \'cursor\' field - pass this value in the \'cursor\' parameter of your next request to get the next page. An empty cursor indicates no more pages are available.
|
|
523
523
|
* @summary Get Markets
|
|
524
524
|
* @param {number} [limit] Number of results per page. Defaults to 100. Maximum value is 1000.
|
|
525
525
|
* @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.
|
package/api/portfolio-api.ts
CHANGED
|
@@ -57,6 +57,8 @@ import type { GetBalanceResponse } from '../models';
|
|
|
57
57
|
// @ts-ignore
|
|
58
58
|
import type { GetFillsResponse } from '../models';
|
|
59
59
|
// @ts-ignore
|
|
60
|
+
import type { GetOrderGroupResponse } from '../models';
|
|
61
|
+
// @ts-ignore
|
|
60
62
|
import type { GetOrderGroupsResponse } from '../models';
|
|
61
63
|
// @ts-ignore
|
|
62
64
|
import type { GetOrderQueuePositionResponse } from '../models';
|
|
@@ -530,6 +532,44 @@ export const PortfolioApiAxiosParamCreator = function (configuration?: Configura
|
|
|
530
532
|
|
|
531
533
|
|
|
532
534
|
|
|
535
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
536
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
537
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
538
|
+
|
|
539
|
+
return {
|
|
540
|
+
url: toPathString(localVarUrlObj),
|
|
541
|
+
options: localVarRequestOptions,
|
|
542
|
+
};
|
|
543
|
+
},
|
|
544
|
+
/**
|
|
545
|
+
* Get details of a specific order group
|
|
546
|
+
* @summary Get Order Group
|
|
547
|
+
* @param {string} orderGroupId Order group ID
|
|
548
|
+
* @param {*} [options] Override http request option.
|
|
549
|
+
* @throws {RequiredError}
|
|
550
|
+
*/
|
|
551
|
+
getOrderGroup: async (orderGroupId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
552
|
+
// verify required parameter 'orderGroupId' is not null or undefined
|
|
553
|
+
assertParamExists('getOrderGroup', 'orderGroupId', orderGroupId)
|
|
554
|
+
const localVarPath = `/portfolio/order_groups/{order_group_id}`
|
|
555
|
+
.replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
|
|
556
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
557
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
558
|
+
let baseOptions;
|
|
559
|
+
if (configuration) {
|
|
560
|
+
baseOptions = configuration.baseOptions;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
|
564
|
+
const localVarHeaderParameter = {} as any;
|
|
565
|
+
const localVarQueryParameter = {} as any;
|
|
566
|
+
|
|
567
|
+
// authentication bearerAuth required
|
|
568
|
+
// http bearer authentication required
|
|
569
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
533
573
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
534
574
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
535
575
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
@@ -896,7 +936,7 @@ export const PortfolioApiAxiosParamCreator = function (configuration?: Configura
|
|
|
896
936
|
baseOptions = configuration.baseOptions;
|
|
897
937
|
}
|
|
898
938
|
|
|
899
|
-
const localVarRequestOptions = { method: '
|
|
939
|
+
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
|
|
900
940
|
const localVarHeaderParameter = {} as any;
|
|
901
941
|
const localVarQueryParameter = {} as any;
|
|
902
942
|
|
|
@@ -1073,6 +1113,19 @@ export const PortfolioApiFp = function(configuration?: Configuration) {
|
|
|
1073
1113
|
const localVarOperationServerBasePath = operationServerMap['PortfolioApi.getOrder']?.[localVarOperationServerIndex]?.url;
|
|
1074
1114
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
1075
1115
|
},
|
|
1116
|
+
/**
|
|
1117
|
+
* Get details of a specific order group
|
|
1118
|
+
* @summary Get Order Group
|
|
1119
|
+
* @param {string} orderGroupId Order group ID
|
|
1120
|
+
* @param {*} [options] Override http request option.
|
|
1121
|
+
* @throws {RequiredError}
|
|
1122
|
+
*/
|
|
1123
|
+
async getOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetOrderGroupResponse>> {
|
|
1124
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderGroup(orderGroupId, options);
|
|
1125
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
1126
|
+
const localVarOperationServerBasePath = operationServerMap['PortfolioApi.getOrderGroup']?.[localVarOperationServerIndex]?.url;
|
|
1127
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
1128
|
+
},
|
|
1076
1129
|
/**
|
|
1077
1130
|
* Get order groups for the logged-in user
|
|
1078
1131
|
* @summary Get Order Groups
|
|
@@ -1315,6 +1368,16 @@ export const PortfolioApiFactory = function (configuration?: Configuration, base
|
|
|
1315
1368
|
getOrder(orderId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetOrderResponse> {
|
|
1316
1369
|
return localVarFp.getOrder(orderId, options).then((request) => request(axios, basePath));
|
|
1317
1370
|
},
|
|
1371
|
+
/**
|
|
1372
|
+
* Get details of a specific order group
|
|
1373
|
+
* @summary Get Order Group
|
|
1374
|
+
* @param {string} orderGroupId Order group ID
|
|
1375
|
+
* @param {*} [options] Override http request option.
|
|
1376
|
+
* @throws {RequiredError}
|
|
1377
|
+
*/
|
|
1378
|
+
getOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetOrderGroupResponse> {
|
|
1379
|
+
return localVarFp.getOrderGroup(orderGroupId, options).then((request) => request(axios, basePath));
|
|
1380
|
+
},
|
|
1318
1381
|
/**
|
|
1319
1382
|
* Get order groups for the logged-in user
|
|
1320
1383
|
* @summary Get Order Groups
|
|
@@ -1542,6 +1605,17 @@ export class PortfolioApi extends BaseAPI {
|
|
|
1542
1605
|
return PortfolioApiFp(this.configuration).getOrder(orderId, options).then((request) => request(this.axios, this.basePath));
|
|
1543
1606
|
}
|
|
1544
1607
|
|
|
1608
|
+
/**
|
|
1609
|
+
* Get details of a specific order group
|
|
1610
|
+
* @summary Get Order Group
|
|
1611
|
+
* @param {string} orderGroupId Order group ID
|
|
1612
|
+
* @param {*} [options] Override http request option.
|
|
1613
|
+
* @throws {RequiredError}
|
|
1614
|
+
*/
|
|
1615
|
+
public getOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig) {
|
|
1616
|
+
return PortfolioApiFp(this.configuration).getOrderGroup(orderGroupId, options).then((request) => request(this.axios, this.basePath));
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1545
1619
|
/**
|
|
1546
1620
|
* Get order groups for the logged-in user
|
|
1547
1621
|
* @summary Get Order Groups
|
package/auth.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as crypto from 'crypto';
|
|
2
|
+
|
|
3
|
+
export class KalshiAuth {
|
|
4
|
+
private apiKey: string;
|
|
5
|
+
private privateKeyPem: string;
|
|
6
|
+
|
|
7
|
+
constructor(apiKey: string, privateKeyPem: string) {
|
|
8
|
+
this.apiKey = apiKey;
|
|
9
|
+
this.privateKeyPem = privateKeyPem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
private signPssText(text: string): string {
|
|
13
|
+
const sign = crypto.createSign('RSA-SHA256');
|
|
14
|
+
sign.update(text);
|
|
15
|
+
sign.end();
|
|
16
|
+
|
|
17
|
+
const signature = sign.sign({
|
|
18
|
+
key: this.privateKeyPem,
|
|
19
|
+
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
|
20
|
+
saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return signature.toString('base64');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public generateAuthHeaders(method: string, path: string): Record<string, string> {
|
|
27
|
+
const currentTimeMilliseconds = Date.now();
|
|
28
|
+
const timestampStr = currentTimeMilliseconds.toString();
|
|
29
|
+
const msgString = timestampStr + method + path;
|
|
30
|
+
const sig = this.signPssText(msgString);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
'KALSHI-ACCESS-KEY': this.apiKey,
|
|
34
|
+
'KALSHI-ACCESS-SIGNATURE': sig,
|
|
35
|
+
'KALSHI-ACCESS-TIMESTAMP': timestampStr
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
package/base.ts
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,15 +10,22 @@
|
|
|
12
10
|
* Do not edit the class manually.
|
|
13
11
|
*/
|
|
14
12
|
|
|
13
|
+
/* tslint:disable */
|
|
14
|
+
/* eslint-disable */
|
|
15
15
|
|
|
16
16
|
import type { Configuration } from './configuration';
|
|
17
17
|
// Some imports not used depending on template conditions
|
|
18
18
|
// @ts-ignore
|
|
19
|
-
import type { AxiosPromise, AxiosInstance,
|
|
19
|
+
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig, Method } from 'axios';
|
|
20
20
|
import globalAxios from 'axios';
|
|
21
|
+
import { KalshiAuth } from './auth';
|
|
21
22
|
|
|
22
23
|
export const BASE_PATH = "https://api.elections.kalshi.com/trade-api/v2".replace(/\/+$/, "");
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
*/
|
|
24
29
|
export const COLLECTION_FORMATS = {
|
|
25
30
|
csv: ",",
|
|
26
31
|
ssv: " ",
|
|
@@ -28,35 +33,64 @@ export const COLLECTION_FORMATS = {
|
|
|
28
33
|
pipes: "|",
|
|
29
34
|
};
|
|
30
35
|
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
* @interface RequestArgs
|
|
40
|
+
*/
|
|
31
41
|
export interface RequestArgs {
|
|
32
42
|
url: string;
|
|
33
|
-
options:
|
|
43
|
+
options: AxiosRequestConfig;
|
|
34
44
|
}
|
|
35
45
|
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
* @class BaseAPI
|
|
50
|
+
*/
|
|
36
51
|
export class BaseAPI {
|
|
37
52
|
protected configuration: Configuration | undefined;
|
|
53
|
+
protected auth: KalshiAuth | undefined;
|
|
38
54
|
|
|
39
55
|
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
40
56
|
if (configuration) {
|
|
41
57
|
this.configuration = configuration;
|
|
42
|
-
this.basePath = configuration.basePath
|
|
58
|
+
this.basePath = configuration.basePath || this.basePath;
|
|
59
|
+
|
|
60
|
+
// Initialize auth if credentials are provided
|
|
61
|
+
if (configuration.apiKey && (configuration.privateKeyPath || configuration.privateKeyPem)) {
|
|
62
|
+
const privateKey = configuration.privateKeyPem ||
|
|
63
|
+
(configuration.privateKeyPath ? require('fs').readFileSync(configuration.privateKeyPath, 'utf8') : '');
|
|
64
|
+
this.auth = new KalshiAuth(configuration.apiKey, privateKey);
|
|
65
|
+
}
|
|
43
66
|
}
|
|
67
|
+
|
|
68
|
+
// Add request interceptor for authentication
|
|
69
|
+
this.axios.interceptors.request.use((config) => {
|
|
70
|
+
if (this.auth && config.url && config.method) {
|
|
71
|
+
// Extract path from URL
|
|
72
|
+
const url = new URL(config.url, this.basePath);
|
|
73
|
+
const path = url.pathname;
|
|
74
|
+
const method = config.method.toUpperCase();
|
|
75
|
+
|
|
76
|
+
// Generate and add auth headers
|
|
77
|
+
const authHeaders = this.auth.generateAuthHeaders(method, path);
|
|
78
|
+
Object.assign(config.headers, authHeaders);
|
|
79
|
+
}
|
|
80
|
+
return config;
|
|
81
|
+
});
|
|
44
82
|
}
|
|
45
83
|
};
|
|
46
84
|
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @export
|
|
88
|
+
* @class RequiredError
|
|
89
|
+
* @extends {Error}
|
|
90
|
+
*/
|
|
47
91
|
export class RequiredError extends Error {
|
|
92
|
+
name: "RequiredError" = "RequiredError";
|
|
48
93
|
constructor(public field: string, msg?: string) {
|
|
49
94
|
super(msg);
|
|
50
|
-
this.name = "RequiredError"
|
|
51
95
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
interface ServerMap {
|
|
55
|
-
[key: string]: {
|
|
56
|
-
url: string,
|
|
57
|
-
description: string,
|
|
58
|
-
}[];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const operationServerMap: ServerMap = {
|
|
62
|
-
}
|
|
96
|
+
}
|
package/common.ts
CHANGED
|
@@ -95,4 +95,4 @@ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxi
|
|
|
95
95
|
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
|
|
96
96
|
return axios.request<T, R>(axiosRequestArgs);
|
|
97
97
|
};
|
|
98
|
-
}
|
|
98
|
+
}
|