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.
Files changed (189) hide show
  1. package/.openapi-generator/FILES +4 -1
  2. package/.openapi-generator-ignore +9 -2
  3. package/README.md +200 -29
  4. package/api/exchange-api.ts +4 -4
  5. package/api/markets-api.ts +4 -4
  6. package/api/portfolio-api.ts +75 -1
  7. package/auth.ts +38 -0
  8. package/base.ts +51 -17
  9. package/common.ts +1 -1
  10. package/configuration.ts +1 -1
  11. package/dist/api/api-keys-api.d.ts +4 -4
  12. package/dist/api/communications-api.d.ts +11 -11
  13. package/dist/api/events-api.d.ts +3 -3
  14. package/dist/api/exchange-api.d.ts +8 -8
  15. package/dist/api/exchange-api.js +4 -4
  16. package/dist/api/markets-api.d.ts +9 -9
  17. package/dist/api/markets-api.js +4 -4
  18. package/dist/api/milestones-api.d.ts +2 -2
  19. package/dist/api/multivariate-collections-api.d.ts +3 -3
  20. package/dist/api/portfolio-api.d.ts +52 -19
  21. package/dist/api/portfolio-api.js +69 -1
  22. package/dist/api/series-api.d.ts +2 -2
  23. package/dist/api/structured-targets-api.d.ts +2 -2
  24. package/dist/auth.d.ts +7 -0
  25. package/dist/auth.js +33 -0
  26. package/dist/base.d.ts +25 -10
  27. package/dist/base.js +37 -6
  28. package/dist/esm/api/api-keys-api.d.ts +4 -4
  29. package/dist/esm/api/communications-api.d.ts +11 -11
  30. package/dist/esm/api/events-api.d.ts +3 -3
  31. package/dist/esm/api/exchange-api.d.ts +8 -8
  32. package/dist/esm/api/exchange-api.js +4 -4
  33. package/dist/esm/api/markets-api.d.ts +9 -9
  34. package/dist/esm/api/markets-api.js +4 -4
  35. package/dist/esm/api/milestones-api.d.ts +2 -2
  36. package/dist/esm/api/multivariate-collections-api.d.ts +3 -3
  37. package/dist/esm/api/portfolio-api.d.ts +52 -19
  38. package/dist/esm/api/portfolio-api.js +69 -1
  39. package/dist/esm/api/series-api.d.ts +2 -2
  40. package/dist/esm/api/structured-targets-api.d.ts +2 -2
  41. package/dist/esm/auth.d.ts +7 -0
  42. package/dist/esm/auth.js +29 -0
  43. package/dist/esm/base.d.ts +25 -10
  44. package/dist/esm/base.js +36 -5
  45. package/dist/esm/models/amend-order-request.d.ts +30 -0
  46. package/dist/esm/models/amend-order-request.js +8 -1
  47. package/dist/esm/models/create-order-group-request.d.ts +4 -1
  48. package/dist/esm/models/create-order-group-response.d.ts +4 -2
  49. package/dist/esm/models/create-order-request.d.ts +8 -0
  50. package/dist/esm/models/error-response-error.d.ts +1 -1
  51. package/dist/esm/models/event-position.d.ts +53 -0
  52. package/dist/esm/models/event-position.js +14 -0
  53. package/dist/esm/models/get-order-group-response.d.ts +21 -0
  54. package/dist/esm/models/get-order-group-response.js +14 -0
  55. package/dist/esm/models/get-order-response.d.ts +1 -1
  56. package/dist/esm/models/get-positions-response.d.ts +3 -1
  57. package/dist/esm/models/index.d.ts +2 -0
  58. package/dist/esm/models/index.js +2 -0
  59. package/dist/esm/models/order-group.d.ts +8 -4
  60. package/dist/esm/models/order.d.ts +16 -0
  61. package/dist/models/amend-order-request.d.ts +30 -0
  62. package/dist/models/amend-order-request.js +9 -0
  63. package/dist/models/create-order-group-request.d.ts +4 -1
  64. package/dist/models/create-order-group-response.d.ts +4 -2
  65. package/dist/models/create-order-request.d.ts +8 -0
  66. package/dist/models/error-response-error.d.ts +1 -1
  67. package/dist/models/event-position.d.ts +53 -0
  68. package/dist/models/event-position.js +15 -0
  69. package/dist/models/get-order-group-response.d.ts +21 -0
  70. package/dist/models/get-order-group-response.js +15 -0
  71. package/dist/models/get-order-response.d.ts +1 -1
  72. package/dist/models/get-positions-response.d.ts +3 -1
  73. package/dist/models/index.d.ts +2 -0
  74. package/dist/models/index.js +2 -0
  75. package/dist/models/order-group.d.ts +8 -4
  76. package/dist/models/order.d.ts +16 -0
  77. package/docs/AcceptQuoteRequest.md +1 -1
  78. package/docs/AmendOrderRequest.md +11 -1
  79. package/docs/AmendOrderResponse.md +1 -1
  80. package/docs/Announcement.md +1 -1
  81. package/docs/ApiKey.md +1 -1
  82. package/docs/ApiKeysApi.md +20 -8
  83. package/docs/BatchCancelOrdersRequest.md +1 -1
  84. package/docs/BatchCancelOrdersResponse.md +1 -1
  85. package/docs/BatchCancelOrdersResponseResponsesInner.md +1 -1
  86. package/docs/BatchCreateOrdersRequest.md +1 -1
  87. package/docs/BatchCreateOrdersResponse.md +1 -1
  88. package/docs/BatchCreateOrdersResponseResponsesInner.md +1 -1
  89. package/docs/CancelOrderResponse.md +1 -1
  90. package/docs/Candlestick.md +1 -1
  91. package/docs/CommunicationsApi.md +55 -22
  92. package/docs/CreateApiKeyRequest.md +1 -1
  93. package/docs/CreateApiKeyResponse.md +1 -1
  94. package/docs/CreateOrderGroupRequest.md +3 -3
  95. package/docs/CreateOrderGroupResponse.md +3 -3
  96. package/docs/CreateOrderRequest.md +5 -1
  97. package/docs/CreateOrderResponse.md +1 -1
  98. package/docs/CreateQuoteRequest.md +1 -1
  99. package/docs/CreateQuoteResponse.md +1 -1
  100. package/docs/CreateRFQRequest.md +1 -1
  101. package/docs/CreateRFQResponse.md +1 -1
  102. package/docs/DailySchedule.md +1 -1
  103. package/docs/DecreaseOrderRequest.md +1 -1
  104. package/docs/DecreaseOrderResponse.md +1 -1
  105. package/docs/ErrorResponse.md +1 -1
  106. package/docs/ErrorResponseError.md +2 -2
  107. package/docs/Event.md +1 -1
  108. package/docs/EventPosition.md +38 -0
  109. package/docs/EventsApi.md +15 -6
  110. package/docs/ExchangeApi.md +21 -9
  111. package/docs/ExchangeStatus.md +1 -1
  112. package/docs/Fill.md +1 -1
  113. package/docs/GenerateApiKeyRequest.md +1 -1
  114. package/docs/GenerateApiKeyResponse.md +1 -1
  115. package/docs/GetApiKeysResponse.md +1 -1
  116. package/docs/GetBalanceResponse.md +1 -1
  117. package/docs/GetCommunicationsIDResponse.md +1 -1
  118. package/docs/GetEventMetadataResponse.md +1 -1
  119. package/docs/GetEventResponse.md +1 -1
  120. package/docs/GetEventsResponse.md +1 -1
  121. package/docs/GetExchangeAnnouncementsResponse.md +1 -1
  122. package/docs/GetExchangeScheduleResponse.md +1 -1
  123. package/docs/GetExchangeScheduleResponseSchedule.md +1 -1
  124. package/docs/GetFillsResponse.md +1 -1
  125. package/docs/GetMarketCandlesticksResponse.md +1 -1
  126. package/docs/GetMarketOrderbookResponse.md +1 -1
  127. package/docs/GetMarketOrderbookResponseOrderbook.md +1 -1
  128. package/docs/GetMarketResponse.md +1 -1
  129. package/docs/GetMarketsResponse.md +1 -1
  130. package/docs/GetMilestoneResponse.md +1 -1
  131. package/docs/GetMilestonesResponse.md +1 -1
  132. package/docs/GetMultivariateEventCollectionResponse.md +1 -1
  133. package/docs/GetMultivariateEventCollectionsResponse.md +1 -1
  134. package/docs/GetOrderGroupResponse.md +22 -0
  135. package/docs/GetOrderGroupsResponse.md +1 -1
  136. package/docs/GetOrderQueuePositionResponse.md +1 -1
  137. package/docs/GetOrderResponse.md +2 -2
  138. package/docs/GetOrdersResponse.md +1 -1
  139. package/docs/GetPositionsResponse.md +5 -3
  140. package/docs/GetQueuePositionsRequest.md +1 -1
  141. package/docs/GetQueuePositionsResponse.md +1 -1
  142. package/docs/GetQuoteResponse.md +1 -1
  143. package/docs/GetQuotesResponse.md +1 -1
  144. package/docs/GetRFQResponse.md +1 -1
  145. package/docs/GetRFQsResponse.md +1 -1
  146. package/docs/GetSeriesByTickerResponse.md +1 -1
  147. package/docs/GetSeriesResponse.md +1 -1
  148. package/docs/GetSettlementsResponse.md +1 -1
  149. package/docs/GetStructuredTargetResponse.md +1 -1
  150. package/docs/GetStructuredTargetsResponse.md +1 -1
  151. package/docs/GetTotalRestingOrderValueResponse.md +1 -1
  152. package/docs/GetTradesResponse.md +1 -1
  153. package/docs/GetUserDataTimestampResponse.md +1 -1
  154. package/docs/LookupBundleRequest.md +1 -1
  155. package/docs/LookupBundleRequestBundleInner.md +1 -1
  156. package/docs/LookupBundleResponse.md +1 -1
  157. package/docs/Market.md +1 -1
  158. package/docs/MarketsApi.md +26 -11
  159. package/docs/Milestone.md +1 -1
  160. package/docs/MilestonesApi.md +10 -4
  161. package/docs/MultivariateCollectionsApi.md +15 -6
  162. package/docs/MultivariateEventCollection.md +1 -1
  163. package/docs/MultivariateEventCollectionEventsInner.md +1 -1
  164. package/docs/Order.md +9 -1
  165. package/docs/OrderGroup.md +5 -9
  166. package/docs/OrderbookLevel.md +1 -1
  167. package/docs/PortfolioApi.md +154 -39
  168. package/docs/Position.md +1 -1
  169. package/docs/Quote.md +1 -1
  170. package/docs/RFQ.md +1 -1
  171. package/docs/Series.md +1 -1
  172. package/docs/SeriesApi.md +10 -4
  173. package/docs/Settlement.md +1 -1
  174. package/docs/StructuredTarget.md +1 -1
  175. package/docs/StructuredTargetsApi.md +10 -4
  176. package/docs/Trade.md +1 -1
  177. package/models/amend-order-request.ts +34 -0
  178. package/models/create-order-group-request.ts +4 -1
  179. package/models/create-order-group-response.ts +4 -4
  180. package/models/create-order-request.ts +8 -0
  181. package/models/error-response-error.ts +1 -1
  182. package/models/event-position.ts +59 -0
  183. package/models/get-order-group-response.ts +27 -0
  184. package/models/get-order-response.ts +1 -1
  185. package/models/get-positions-response.ts +5 -1
  186. package/models/index.ts +2 -0
  187. package/models/order-group.ts +8 -4
  188. package/models/order.ts +16 -0
  189. package/package.json +4 -4
@@ -27,6 +27,7 @@ import type { DecreaseOrderRequest } from '../models';
27
27
  import type { DecreaseOrderResponse } from '../models';
28
28
  import type { GetBalanceResponse } from '../models';
29
29
  import type { GetFillsResponse } from '../models';
30
+ import type { GetOrderGroupResponse } from '../models';
30
31
  import type { GetOrderGroupsResponse } from '../models';
31
32
  import type { GetOrderQueuePositionResponse } from '../models';
32
33
  import type { GetOrderResponse } from '../models';
@@ -134,6 +135,14 @@ export declare const PortfolioApiAxiosParamCreator: (configuration?: Configurati
134
135
  * @throws {RequiredError}
135
136
  */
136
137
  getOrder: (orderId: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
138
+ /**
139
+ * Get details of a specific order group
140
+ * @summary Get Order Group
141
+ * @param {string} orderGroupId Order group ID
142
+ * @param {*} [options] Override http request option.
143
+ * @throws {RequiredError}
144
+ */
145
+ getOrderGroup: (orderGroupId: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
137
146
  /**
138
147
  * Get order groups for the logged-in user
139
148
  * @summary Get Order Groups
@@ -310,6 +319,14 @@ export declare const PortfolioApiFp: (configuration?: Configuration) => {
310
319
  * @throws {RequiredError}
311
320
  */
312
321
  getOrder(orderId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetOrderResponse>>;
322
+ /**
323
+ * Get details of a specific order group
324
+ * @summary Get Order Group
325
+ * @param {string} orderGroupId Order group ID
326
+ * @param {*} [options] Override http request option.
327
+ * @throws {RequiredError}
328
+ */
329
+ getOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetOrderGroupResponse>>;
313
330
  /**
314
331
  * Get order groups for the logged-in user
315
332
  * @summary Get Order Groups
@@ -486,6 +503,14 @@ export declare const PortfolioApiFactory: (configuration?: Configuration, basePa
486
503
  * @throws {RequiredError}
487
504
  */
488
505
  getOrder(orderId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetOrderResponse>;
506
+ /**
507
+ * Get details of a specific order group
508
+ * @summary Get Order Group
509
+ * @param {string} orderGroupId Order group ID
510
+ * @param {*} [options] Override http request option.
511
+ * @throws {RequiredError}
512
+ */
513
+ getOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetOrderGroupResponse>;
489
514
  /**
490
515
  * Get order groups for the logged-in user
491
516
  * @summary Get Order Groups
@@ -576,7 +601,7 @@ export declare class PortfolioApi extends BaseAPI {
576
601
  * @param {*} [options] Override http request option.
577
602
  * @throws {RequiredError}
578
603
  */
579
- amendOrder(orderId: string, amendOrderRequest: AmendOrderRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<AmendOrderResponse, any>>;
604
+ amendOrder(orderId: string, amendOrderRequest: AmendOrderRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<AmendOrderResponse, any, {}>>;
580
605
  /**
581
606
  * Cancel multiple orders in a single request
582
607
  * @summary Batch Cancel Orders
@@ -584,7 +609,7 @@ export declare class PortfolioApi extends BaseAPI {
584
609
  * @param {*} [options] Override http request option.
585
610
  * @throws {RequiredError}
586
611
  */
587
- batchCancelOrders(batchCancelOrdersRequest: BatchCancelOrdersRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<BatchCancelOrdersResponse, any>>;
612
+ batchCancelOrders(batchCancelOrdersRequest: BatchCancelOrdersRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<BatchCancelOrdersResponse, any, {}>>;
588
613
  /**
589
614
  * Create multiple orders in a single request
590
615
  * @summary Batch Create Orders
@@ -592,7 +617,7 @@ export declare class PortfolioApi extends BaseAPI {
592
617
  * @param {*} [options] Override http request option.
593
618
  * @throws {RequiredError}
594
619
  */
595
- batchCreateOrders(batchCreateOrdersRequest: BatchCreateOrdersRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<BatchCreateOrdersResponse, any>>;
620
+ batchCreateOrders(batchCreateOrdersRequest: BatchCreateOrdersRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<BatchCreateOrdersResponse, any, {}>>;
596
621
  /**
597
622
  * Cancel an order
598
623
  * @summary Cancel Order
@@ -600,7 +625,7 @@ export declare class PortfolioApi extends BaseAPI {
600
625
  * @param {*} [options] Override http request option.
601
626
  * @throws {RequiredError}
602
627
  */
603
- cancelOrder(orderId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CancelOrderResponse, any>>;
628
+ cancelOrder(orderId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CancelOrderResponse, any, {}>>;
604
629
  /**
605
630
  * Create a new order
606
631
  * @summary Create Order
@@ -608,7 +633,7 @@ export declare class PortfolioApi extends BaseAPI {
608
633
  * @param {*} [options] Override http request option.
609
634
  * @throws {RequiredError}
610
635
  */
611
- createOrder(createOrderRequest: CreateOrderRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateOrderResponse, any>>;
636
+ createOrder(createOrderRequest: CreateOrderRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateOrderResponse, any, {}>>;
612
637
  /**
613
638
  * Create a new order group
614
639
  * @summary Create Order Group
@@ -616,7 +641,7 @@ export declare class PortfolioApi extends BaseAPI {
616
641
  * @param {*} [options] Override http request option.
617
642
  * @throws {RequiredError}
618
643
  */
619
- createOrderGroup(createOrderGroupRequest: CreateOrderGroupRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateOrderGroupResponse, any>>;
644
+ createOrderGroup(createOrderGroupRequest: CreateOrderGroupRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateOrderGroupResponse, any, {}>>;
620
645
  /**
621
646
  * Decrease the size of an existing order
622
647
  * @summary Decrease Order
@@ -625,7 +650,7 @@ export declare class PortfolioApi extends BaseAPI {
625
650
  * @param {*} [options] Override http request option.
626
651
  * @throws {RequiredError}
627
652
  */
628
- decreaseOrder(orderId: string, decreaseOrderRequest: DecreaseOrderRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<DecreaseOrderResponse, any>>;
653
+ decreaseOrder(orderId: string, decreaseOrderRequest: DecreaseOrderRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<DecreaseOrderResponse, any, {}>>;
629
654
  /**
630
655
  * Delete an order group
631
656
  * @summary Delete Order Group
@@ -633,14 +658,14 @@ export declare class PortfolioApi extends BaseAPI {
633
658
  * @param {*} [options] Override http request option.
634
659
  * @throws {RequiredError}
635
660
  */
636
- deleteOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any>>;
661
+ deleteOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}>>;
637
662
  /**
638
663
  * Get the user\'s current balance
639
664
  * @summary Get Balance
640
665
  * @param {*} [options] Override http request option.
641
666
  * @throws {RequiredError}
642
667
  */
643
- getBalance(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetBalanceResponse, any>>;
668
+ getBalance(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetBalanceResponse, any, {}>>;
644
669
  /**
645
670
  * Get fills for the logged-in user. A fill represents a partial or complete execution of an order. When an order matches with another order in the orderbook, a fill is created for each side of the trade.
646
671
  * @summary Get Fills
@@ -653,7 +678,7 @@ export declare class PortfolioApi extends BaseAPI {
653
678
  * @param {*} [options] Override http request option.
654
679
  * @throws {RequiredError}
655
680
  */
656
- getFills(ticker?: string, orderId?: string, minTs?: number, maxTs?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetFillsResponse, any>>;
681
+ getFills(ticker?: string, orderId?: string, minTs?: number, maxTs?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetFillsResponse, any, {}>>;
657
682
  /**
658
683
  * Get a single order by ID
659
684
  * @summary Get Order
@@ -661,7 +686,15 @@ export declare class PortfolioApi extends BaseAPI {
661
686
  * @param {*} [options] Override http request option.
662
687
  * @throws {RequiredError}
663
688
  */
664
- getOrder(orderId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrderResponse, any>>;
689
+ getOrder(orderId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrderResponse, any, {}>>;
690
+ /**
691
+ * Get details of a specific order group
692
+ * @summary Get Order Group
693
+ * @param {string} orderGroupId Order group ID
694
+ * @param {*} [options] Override http request option.
695
+ * @throws {RequiredError}
696
+ */
697
+ getOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrderGroupResponse, any, {}>>;
665
698
  /**
666
699
  * Get order groups for the logged-in user
667
700
  * @summary Get Order Groups
@@ -671,7 +704,7 @@ export declare class PortfolioApi extends BaseAPI {
671
704
  * @param {*} [options] Override http request option.
672
705
  * @throws {RequiredError}
673
706
  */
674
- getOrderGroups(status?: string, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrderGroupsResponse, any>>;
707
+ getOrderGroups(status?: string, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrderGroupsResponse, any, {}>>;
675
708
  /**
676
709
  * Get the queue position for an order
677
710
  * @summary Get Order Queue Position
@@ -679,7 +712,7 @@ export declare class PortfolioApi extends BaseAPI {
679
712
  * @param {*} [options] Override http request option.
680
713
  * @throws {RequiredError}
681
714
  */
682
- getOrderQueuePosition(orderId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrderQueuePositionResponse, any>>;
715
+ getOrderQueuePosition(orderId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrderQueuePositionResponse, any, {}>>;
683
716
  /**
684
717
  * Get orders for the logged-in user
685
718
  * @summary Get Orders
@@ -693,7 +726,7 @@ export declare class PortfolioApi extends BaseAPI {
693
726
  * @param {*} [options] Override http request option.
694
727
  * @throws {RequiredError}
695
728
  */
696
- getOrders(ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, status?: string, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrdersResponse, any>>;
729
+ getOrders(ticker?: string, eventTicker?: string, minTs?: number, maxTs?: number, status?: string, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetOrdersResponse, any, {}>>;
697
730
  /**
698
731
  * Get positions for the logged-in user
699
732
  * @summary Get Positions
@@ -706,7 +739,7 @@ export declare class PortfolioApi extends BaseAPI {
706
739
  * @param {*} [options] Override http request option.
707
740
  * @throws {RequiredError}
708
741
  */
709
- getPositions(ticker?: string, eventTicker?: string, countDown?: number, countUp?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetPositionsResponse, any>>;
742
+ getPositions(ticker?: string, eventTicker?: string, countDown?: number, countUp?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetPositionsResponse, any, {}>>;
710
743
  /**
711
744
  * Get queue positions for multiple orders
712
745
  * @summary Get Queue Positions
@@ -714,7 +747,7 @@ export declare class PortfolioApi extends BaseAPI {
714
747
  * @param {*} [options] Override http request option.
715
748
  * @throws {RequiredError}
716
749
  */
717
- getQueuePositions(getQueuePositionsRequest: GetQueuePositionsRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetQueuePositionsResponse, any>>;
750
+ getQueuePositions(getQueuePositionsRequest: GetQueuePositionsRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetQueuePositionsResponse, any, {}>>;
718
751
  /**
719
752
  * Get settlements for the logged-in user
720
753
  * @summary Get Settlements
@@ -723,14 +756,14 @@ export declare class PortfolioApi extends BaseAPI {
723
756
  * @param {*} [options] Override http request option.
724
757
  * @throws {RequiredError}
725
758
  */
726
- getSettlements(limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSettlementsResponse, any>>;
759
+ getSettlements(limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetSettlementsResponse, any, {}>>;
727
760
  /**
728
761
  * Get the total value of all resting orders
729
762
  * @summary Get Total Resting Order Value
730
763
  * @param {*} [options] Override http request option.
731
764
  * @throws {RequiredError}
732
765
  */
733
- getTotalRestingOrderValue(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetTotalRestingOrderValueResponse, any>>;
766
+ getTotalRestingOrderValue(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetTotalRestingOrderValueResponse, any, {}>>;
734
767
  /**
735
768
  * Reset an order group
736
769
  * @summary Reset Order Group
@@ -738,5 +771,5 @@ export declare class PortfolioApi extends BaseAPI {
738
771
  * @param {*} [options] Override http request option.
739
772
  * @throws {RequiredError}
740
773
  */
741
- resetOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any>>;
774
+ resetOrderGroup(orderGroupId: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}>>;
742
775
  }
@@ -419,6 +419,38 @@ const PortfolioApiAxiosParamCreator = function (configuration) {
419
419
  options: localVarRequestOptions,
420
420
  };
421
421
  }),
422
+ /**
423
+ * Get details of a specific order group
424
+ * @summary Get Order Group
425
+ * @param {string} orderGroupId Order group ID
426
+ * @param {*} [options] Override http request option.
427
+ * @throws {RequiredError}
428
+ */
429
+ getOrderGroup: (orderGroupId_1, ...args_1) => __awaiter(this, [orderGroupId_1, ...args_1], void 0, function* (orderGroupId, options = {}) {
430
+ // verify required parameter 'orderGroupId' is not null or undefined
431
+ (0, common_1.assertParamExists)('getOrderGroup', 'orderGroupId', orderGroupId);
432
+ const localVarPath = `/portfolio/order_groups/{order_group_id}`
433
+ .replace(`{${"order_group_id"}}`, encodeURIComponent(String(orderGroupId)));
434
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
435
+ const localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
436
+ let baseOptions;
437
+ if (configuration) {
438
+ baseOptions = configuration.baseOptions;
439
+ }
440
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
441
+ const localVarHeaderParameter = {};
442
+ const localVarQueryParameter = {};
443
+ // authentication bearerAuth required
444
+ // http bearer authentication required
445
+ yield (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
446
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
447
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
448
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
449
+ return {
450
+ url: (0, common_1.toPathString)(localVarUrlObj),
451
+ options: localVarRequestOptions,
452
+ };
453
+ }),
422
454
  /**
423
455
  * Get order groups for the logged-in user
424
456
  * @summary Get Order Groups
@@ -714,7 +746,7 @@ const PortfolioApiAxiosParamCreator = function (configuration) {
714
746
  if (configuration) {
715
747
  baseOptions = configuration.baseOptions;
716
748
  }
717
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
749
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options);
718
750
  const localVarHeaderParameter = {};
719
751
  const localVarQueryParameter = {};
720
752
  // authentication bearerAuth required
@@ -919,6 +951,22 @@ const PortfolioApiFp = function (configuration) {
919
951
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
920
952
  });
921
953
  },
954
+ /**
955
+ * Get details of a specific order group
956
+ * @summary Get Order Group
957
+ * @param {string} orderGroupId Order group ID
958
+ * @param {*} [options] Override http request option.
959
+ * @throws {RequiredError}
960
+ */
961
+ getOrderGroup(orderGroupId, options) {
962
+ return __awaiter(this, void 0, void 0, function* () {
963
+ var _a, _b, _c;
964
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.getOrderGroup(orderGroupId, options);
965
+ const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
966
+ const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['PortfolioApi.getOrderGroup']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
967
+ return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
968
+ });
969
+ },
922
970
  /**
923
971
  * Get order groups for the logged-in user
924
972
  * @summary Get Order Groups
@@ -1185,6 +1233,16 @@ const PortfolioApiFactory = function (configuration, basePath, axios) {
1185
1233
  getOrder(orderId, options) {
1186
1234
  return localVarFp.getOrder(orderId, options).then((request) => request(axios, basePath));
1187
1235
  },
1236
+ /**
1237
+ * Get details of a specific order group
1238
+ * @summary Get Order Group
1239
+ * @param {string} orderGroupId Order group ID
1240
+ * @param {*} [options] Override http request option.
1241
+ * @throws {RequiredError}
1242
+ */
1243
+ getOrderGroup(orderGroupId, options) {
1244
+ return localVarFp.getOrderGroup(orderGroupId, options).then((request) => request(axios, basePath));
1245
+ },
1188
1246
  /**
1189
1247
  * Get order groups for the logged-in user
1190
1248
  * @summary Get Order Groups
@@ -1401,6 +1459,16 @@ class PortfolioApi extends base_1.BaseAPI {
1401
1459
  getOrder(orderId, options) {
1402
1460
  return (0, exports.PortfolioApiFp)(this.configuration).getOrder(orderId, options).then((request) => request(this.axios, this.basePath));
1403
1461
  }
1462
+ /**
1463
+ * Get details of a specific order group
1464
+ * @summary Get Order Group
1465
+ * @param {string} orderGroupId Order group ID
1466
+ * @param {*} [options] Override http request option.
1467
+ * @throws {RequiredError}
1468
+ */
1469
+ getOrderGroup(orderGroupId, options) {
1470
+ return (0, exports.PortfolioApiFp)(this.configuration).getOrderGroup(orderGroupId, options).then((request) => request(this.axios, this.basePath));
1471
+ }
1404
1472
  /**
1405
1473
  * Get order groups for the logged-in user
1406
1474
  * @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/auth.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare class KalshiAuth {
2
+ private apiKey;
3
+ private privateKeyPem;
4
+ constructor(apiKey: string, privateKeyPem: string);
5
+ private signPssText;
6
+ generateAuthHeaders(method: string, path: string): Record<string, string>;
7
+ }
package/dist/auth.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KalshiAuth = void 0;
4
+ const crypto = require("crypto");
5
+ class KalshiAuth {
6
+ constructor(apiKey, privateKeyPem) {
7
+ this.apiKey = apiKey;
8
+ this.privateKeyPem = privateKeyPem;
9
+ }
10
+ signPssText(text) {
11
+ const sign = crypto.createSign('RSA-SHA256');
12
+ sign.update(text);
13
+ sign.end();
14
+ const signature = sign.sign({
15
+ key: this.privateKeyPem,
16
+ padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
17
+ saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
18
+ });
19
+ return signature.toString('base64');
20
+ }
21
+ generateAuthHeaders(method, path) {
22
+ const currentTimeMilliseconds = Date.now();
23
+ const timestampStr = currentTimeMilliseconds.toString();
24
+ const msgString = timestampStr + method + path;
25
+ const sig = this.signPssText(msgString);
26
+ return {
27
+ 'KALSHI-ACCESS-KEY': this.apiKey,
28
+ 'KALSHI-ACCESS-SIGNATURE': sig,
29
+ 'KALSHI-ACCESS-TIMESTAMP': timestampStr
30
+ };
31
+ }
32
+ }
33
+ exports.KalshiAuth = KalshiAuth;
package/dist/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, RawAxiosRequestConfig } from 'axios';
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: RawAxiosRequestConfig;
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/base.js CHANGED
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
2
  /**
5
3
  * Kalshi Trading API
6
4
  * Complete API for the Kalshi trading platform including all handlers for SDK generation
@@ -13,28 +11,62 @@
13
11
  * Do not edit the class manually.
14
12
  */
15
13
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.operationServerMap = exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
14
+ exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
17
15
  const axios_1 = require("axios");
16
+ const auth_1 = require("./auth");
18
17
  exports.BASE_PATH = "https://api.elections.kalshi.com/trade-api/v2".replace(/\/+$/, "");
18
+ /**
19
+ *
20
+ * @export
21
+ */
19
22
  exports.COLLECTION_FORMATS = {
20
23
  csv: ",",
21
24
  ssv: " ",
22
25
  tsv: "\t",
23
26
  pipes: "|",
24
27
  };
28
+ /**
29
+ *
30
+ * @export
31
+ * @class BaseAPI
32
+ */
25
33
  class BaseAPI {
26
34
  constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
27
- var _a;
28
35
  this.basePath = basePath;
29
36
  this.axios = axios;
30
37
  if (configuration) {
31
38
  this.configuration = configuration;
32
- this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath;
39
+ this.basePath = configuration.basePath || this.basePath;
40
+ // Initialize auth if credentials are provided
41
+ if (configuration.apiKey && (configuration.privateKeyPath || configuration.privateKeyPem)) {
42
+ const privateKey = configuration.privateKeyPem ||
43
+ (configuration.privateKeyPath ? require('fs').readFileSync(configuration.privateKeyPath, 'utf8') : '');
44
+ this.auth = new auth_1.KalshiAuth(configuration.apiKey, privateKey);
45
+ }
33
46
  }
47
+ // Add request interceptor for authentication
48
+ this.axios.interceptors.request.use((config) => {
49
+ if (this.auth && config.url && config.method) {
50
+ // Extract path from URL
51
+ const url = new URL(config.url, this.basePath);
52
+ const path = url.pathname;
53
+ const method = config.method.toUpperCase();
54
+ // Generate and add auth headers
55
+ const authHeaders = this.auth.generateAuthHeaders(method, path);
56
+ Object.assign(config.headers, authHeaders);
57
+ }
58
+ return config;
59
+ });
34
60
  }
35
61
  }
36
62
  exports.BaseAPI = BaseAPI;
37
63
  ;
64
+ /**
65
+ *
66
+ * @export
67
+ * @class RequiredError
68
+ * @extends {Error}
69
+ */
38
70
  class RequiredError extends Error {
39
71
  constructor(field, msg) {
40
72
  super(msg);
@@ -43,4 +75,3 @@ class RequiredError extends Error {
43
75
  }
44
76
  }
45
77
  exports.RequiredError = RequiredError;
46
- exports.operationServerMap = {};
@@ -136,7 +136,7 @@ export declare class ApiKeysApi extends BaseAPI {
136
136
  * @param {*} [options] Override http request option.
137
137
  * @throws {RequiredError}
138
138
  */
139
- createApiKey(createApiKeyRequest: CreateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateApiKeyResponse, any>>;
139
+ createApiKey(createApiKeyRequest: CreateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateApiKeyResponse, any, {}>>;
140
140
  /**
141
141
  * Delete an existing API key. This endpoint permanently deletes an API key. Once deleted, the key can no longer be used for authentication. This action cannot be undone.
142
142
  * @summary Delete API Key
@@ -144,7 +144,7 @@ export declare class ApiKeysApi extends BaseAPI {
144
144
  * @param {*} [options] Override http request option.
145
145
  * @throws {RequiredError}
146
146
  */
147
- deleteApiKey(apiKey: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any>>;
147
+ deleteApiKey(apiKey: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}>>;
148
148
  /**
149
149
  * Generate a new API key with an automatically created key pair. This endpoint generates both a public and private RSA key pair. The public key is stored on the platform, while the private key is returned to the user and must be stored securely. The private key cannot be retrieved again.
150
150
  * @summary Generate API Key
@@ -152,12 +152,12 @@ export declare class ApiKeysApi extends BaseAPI {
152
152
  * @param {*} [options] Override http request option.
153
153
  * @throws {RequiredError}
154
154
  */
155
- generateApiKey(generateApiKeyRequest: GenerateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GenerateApiKeyResponse, any>>;
155
+ generateApiKey(generateApiKeyRequest: GenerateApiKeyRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GenerateApiKeyResponse, any, {}>>;
156
156
  /**
157
157
  * Retrieve all API keys associated with the authenticated user. API keys allow programmatic access to the platform without requiring username/password authentication. Each key has a unique identifier and name.
158
158
  * @summary Get API Keys
159
159
  * @param {*} [options] Override http request option.
160
160
  * @throws {RequiredError}
161
161
  */
162
- getApiKeys(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetApiKeysResponse, any>>;
162
+ getApiKeys(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<GetApiKeysResponse, any, {}>>;
163
163
  }