kalshi-python-async 3.0.0__py3-none-any.whl

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 (151) hide show
  1. kalshi_python_async/__init__.py +272 -0
  2. kalshi_python_async/api/__init__.py +19 -0
  3. kalshi_python_async/api/api_keys_api.py +1098 -0
  4. kalshi_python_async/api/communications_api.py +3216 -0
  5. kalshi_python_async/api/events_api.py +1941 -0
  6. kalshi_python_async/api/exchange_api.py +1263 -0
  7. kalshi_python_async/api/fcm_api.py +792 -0
  8. kalshi_python_async/api/incentive_programs_api.py +346 -0
  9. kalshi_python_async/api/live_data_api.py +564 -0
  10. kalshi_python_async/api/market_api.py +2568 -0
  11. kalshi_python_async/api/milestone_api.py +689 -0
  12. kalshi_python_async/api/multivariate_api.py +1486 -0
  13. kalshi_python_async/api/order_groups_api.py +1375 -0
  14. kalshi_python_async/api/orders_api.py +2913 -0
  15. kalshi_python_async/api/portfolio_api.py +1572 -0
  16. kalshi_python_async/api/search_api.py +516 -0
  17. kalshi_python_async/api/structured_targets_api.py +605 -0
  18. kalshi_python_async/api_client.py +833 -0
  19. kalshi_python_async/api_response.py +21 -0
  20. kalshi_python_async/auth.py +89 -0
  21. kalshi_python_async/configuration.py +622 -0
  22. kalshi_python_async/exceptions.py +216 -0
  23. kalshi_python_async/models/__init__.py +136 -0
  24. kalshi_python_async/models/accept_quote_request.py +94 -0
  25. kalshi_python_async/models/amend_order_request.py +120 -0
  26. kalshi_python_async/models/amend_order_response.py +96 -0
  27. kalshi_python_async/models/announcement.py +108 -0
  28. kalshi_python_async/models/api_key.py +89 -0
  29. kalshi_python_async/models/associated_event.py +105 -0
  30. kalshi_python_async/models/batch_cancel_orders_individual_response.py +111 -0
  31. kalshi_python_async/models/batch_cancel_orders_request.py +87 -0
  32. kalshi_python_async/models/batch_cancel_orders_response.py +95 -0
  33. kalshi_python_async/models/batch_create_orders_individual_response.py +114 -0
  34. kalshi_python_async/models/batch_create_orders_request.py +95 -0
  35. kalshi_python_async/models/batch_create_orders_response.py +95 -0
  36. kalshi_python_async/models/batch_get_market_candlesticks_response.py +95 -0
  37. kalshi_python_async/models/bid_ask_distribution.py +101 -0
  38. kalshi_python_async/models/cancel_order_response.py +93 -0
  39. kalshi_python_async/models/create_api_key_request.py +89 -0
  40. kalshi_python_async/models/create_api_key_response.py +87 -0
  41. kalshi_python_async/models/create_market_in_multivariate_event_collection_request.py +95 -0
  42. kalshi_python_async/models/create_market_in_multivariate_event_collection_response.py +89 -0
  43. kalshi_python_async/models/create_order_group_request.py +88 -0
  44. kalshi_python_async/models/create_order_group_response.py +87 -0
  45. kalshi_python_async/models/create_order_request.py +159 -0
  46. kalshi_python_async/models/create_order_response.py +91 -0
  47. kalshi_python_async/models/create_quote_request.py +93 -0
  48. kalshi_python_async/models/create_quote_response.py +87 -0
  49. kalshi_python_async/models/create_rfq_request.py +97 -0
  50. kalshi_python_async/models/create_rfq_response.py +87 -0
  51. kalshi_python_async/models/daily_schedule.py +89 -0
  52. kalshi_python_async/models/decrease_order_request.py +90 -0
  53. kalshi_python_async/models/decrease_order_response.py +91 -0
  54. kalshi_python_async/models/error_response.py +93 -0
  55. kalshi_python_async/models/event_data.py +133 -0
  56. kalshi_python_async/models/event_position.py +105 -0
  57. kalshi_python_async/models/exchange_status.py +97 -0
  58. kalshi_python_async/models/fill.py +134 -0
  59. kalshi_python_async/models/forecast_percentiles_point.py +101 -0
  60. kalshi_python_async/models/generate_api_key_request.py +87 -0
  61. kalshi_python_async/models/generate_api_key_response.py +89 -0
  62. kalshi_python_async/models/get_api_keys_response.py +95 -0
  63. kalshi_python_async/models/get_balance_response.py +91 -0
  64. kalshi_python_async/models/get_communications_id_response.py +87 -0
  65. kalshi_python_async/models/get_event_candlesticks_response.py +104 -0
  66. kalshi_python_async/models/get_event_forecast_percentiles_history_response.py +95 -0
  67. kalshi_python_async/models/get_event_metadata_response.py +123 -0
  68. kalshi_python_async/models/get_event_response.py +101 -0
  69. kalshi_python_async/models/get_events_candlesticks_response.py +95 -0
  70. kalshi_python_async/models/get_events_candlesticks_response_events_inner.py +106 -0
  71. kalshi_python_async/models/get_events_response.py +107 -0
  72. kalshi_python_async/models/get_exchange_announcements_response.py +95 -0
  73. kalshi_python_async/models/get_exchange_schedule_response.py +91 -0
  74. kalshi_python_async/models/get_fills_response.py +97 -0
  75. kalshi_python_async/models/get_filters_by_sports_response.py +102 -0
  76. kalshi_python_async/models/get_incentive_programs_response.py +97 -0
  77. kalshi_python_async/models/get_live_data_response.py +91 -0
  78. kalshi_python_async/models/get_live_datas_response.py +95 -0
  79. kalshi_python_async/models/get_market_candlesticks_response.py +97 -0
  80. kalshi_python_async/models/get_market_orderbook_response.py +91 -0
  81. kalshi_python_async/models/get_market_response.py +91 -0
  82. kalshi_python_async/models/get_markets_response.py +97 -0
  83. kalshi_python_async/models/get_milestone_response.py +91 -0
  84. kalshi_python_async/models/get_milestones_response.py +97 -0
  85. kalshi_python_async/models/get_multivariate_event_collection_lookup_history_response.py +95 -0
  86. kalshi_python_async/models/get_multivariate_event_collection_response.py +91 -0
  87. kalshi_python_async/models/get_multivariate_event_collections_response.py +97 -0
  88. kalshi_python_async/models/get_multivariate_events_response.py +97 -0
  89. kalshi_python_async/models/get_order_group_response.py +89 -0
  90. kalshi_python_async/models/get_order_groups_response.py +95 -0
  91. kalshi_python_async/models/get_order_queue_position_response.py +87 -0
  92. kalshi_python_async/models/get_order_queue_positions_response.py +95 -0
  93. kalshi_python_async/models/get_order_response.py +91 -0
  94. kalshi_python_async/models/get_orders_response.py +97 -0
  95. kalshi_python_async/models/get_portfolio_resting_order_total_value_response.py +87 -0
  96. kalshi_python_async/models/get_positions_response.py +107 -0
  97. kalshi_python_async/models/get_quote_response.py +91 -0
  98. kalshi_python_async/models/get_quotes_response.py +97 -0
  99. kalshi_python_async/models/get_rfq_response.py +91 -0
  100. kalshi_python_async/models/get_rfqs_response.py +97 -0
  101. kalshi_python_async/models/get_series_fee_changes_response.py +95 -0
  102. kalshi_python_async/models/get_series_list_response.py +95 -0
  103. kalshi_python_async/models/get_series_response.py +91 -0
  104. kalshi_python_async/models/get_settlements_response.py +97 -0
  105. kalshi_python_async/models/get_structured_target_response.py +91 -0
  106. kalshi_python_async/models/get_structured_targets_response.py +97 -0
  107. kalshi_python_async/models/get_tags_for_series_categories_response.py +87 -0
  108. kalshi_python_async/models/get_trades_response.py +97 -0
  109. kalshi_python_async/models/get_user_data_timestamp_response.py +88 -0
  110. kalshi_python_async/models/incentive_program.py +121 -0
  111. kalshi_python_async/models/live_data.py +91 -0
  112. kalshi_python_async/models/lookup_point.py +102 -0
  113. kalshi_python_async/models/lookup_tickers_for_market_in_multivariate_event_collection_request.py +95 -0
  114. kalshi_python_async/models/lookup_tickers_for_market_in_multivariate_event_collection_response.py +89 -0
  115. kalshi_python_async/models/maintenance_window.py +90 -0
  116. kalshi_python_async/models/market.py +307 -0
  117. kalshi_python_async/models/market_candlestick.py +108 -0
  118. kalshi_python_async/models/market_candlesticks_response.py +97 -0
  119. kalshi_python_async/models/market_metadata.py +91 -0
  120. kalshi_python_async/models/market_position.py +110 -0
  121. kalshi_python_async/models/milestone.py +120 -0
  122. kalshi_python_async/models/multivariate_event_collection.py +122 -0
  123. kalshi_python_async/models/mve_selected_leg.py +91 -0
  124. kalshi_python_async/models/order.py +189 -0
  125. kalshi_python_async/models/order_group.py +89 -0
  126. kalshi_python_async/models/order_queue_position.py +91 -0
  127. kalshi_python_async/models/order_status.py +38 -0
  128. kalshi_python_async/models/orderbook.py +94 -0
  129. kalshi_python_async/models/percentile_point.py +93 -0
  130. kalshi_python_async/models/price_distribution.py +157 -0
  131. kalshi_python_async/models/price_range.py +91 -0
  132. kalshi_python_async/models/quote.py +153 -0
  133. kalshi_python_async/models/rfq.py +129 -0
  134. kalshi_python_async/models/schedule.py +105 -0
  135. kalshi_python_async/models/scope_list.py +87 -0
  136. kalshi_python_async/models/self_trade_prevention_type.py +37 -0
  137. kalshi_python_async/models/series.py +129 -0
  138. kalshi_python_async/models/series_fee_change.py +103 -0
  139. kalshi_python_async/models/settlement.py +118 -0
  140. kalshi_python_async/models/settlement_source.py +89 -0
  141. kalshi_python_async/models/sport_filter_details.py +102 -0
  142. kalshi_python_async/models/structured_target.py +98 -0
  143. kalshi_python_async/models/ticker_pair.py +98 -0
  144. kalshi_python_async/models/trade.py +113 -0
  145. kalshi_python_async/models/weekly_schedule.py +154 -0
  146. kalshi_python_async/py.typed +0 -0
  147. kalshi_python_async/rest.py +213 -0
  148. kalshi_python_async-3.0.0.dist-info/METADATA +78 -0
  149. kalshi_python_async-3.0.0.dist-info/RECORD +151 -0
  150. kalshi_python_async-3.0.0.dist-info/WHEEL +5 -0
  151. kalshi_python_async-3.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2913 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+ import warnings
14
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt, StrictBool
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+ from typing_extensions import Annotated
17
+
18
+ from pydantic import Field, StrictInt, StrictStr
19
+ from typing import Optional
20
+ from typing_extensions import Annotated
21
+ from kalshi_python_async.models.amend_order_request import AmendOrderRequest
22
+ from kalshi_python_async.models.amend_order_response import AmendOrderResponse
23
+ from kalshi_python_async.models.batch_cancel_orders_request import BatchCancelOrdersRequest
24
+ from kalshi_python_async.models.batch_cancel_orders_response import BatchCancelOrdersResponse
25
+ from kalshi_python_async.models.batch_create_orders_request import BatchCreateOrdersRequest
26
+ from kalshi_python_async.models.batch_create_orders_response import BatchCreateOrdersResponse
27
+ from kalshi_python_async.models.cancel_order_response import CancelOrderResponse
28
+ from kalshi_python_async.models.create_order_request import CreateOrderRequest
29
+ from kalshi_python_async.models.create_order_response import CreateOrderResponse
30
+ from kalshi_python_async.models.decrease_order_request import DecreaseOrderRequest
31
+ from kalshi_python_async.models.decrease_order_response import DecreaseOrderResponse
32
+ from kalshi_python_async.models.get_order_queue_position_response import GetOrderQueuePositionResponse
33
+ from kalshi_python_async.models.get_order_queue_positions_response import GetOrderQueuePositionsResponse
34
+ from kalshi_python_async.models.get_order_response import GetOrderResponse
35
+ from kalshi_python_async.models.get_orders_response import GetOrdersResponse
36
+
37
+ from kalshi_python_async.api_client import ApiClient, RequestSerialized
38
+ from kalshi_python_async.api_response import ApiResponse
39
+ from kalshi_python_async.rest import RESTResponseType
40
+
41
+
42
+ class OrdersApi:
43
+ """NOTE: This class is auto generated by OpenAPI Generator
44
+ Ref: https://openapi-generator.tech
45
+
46
+ Do not edit the class manually.
47
+ """
48
+
49
+ def __init__(self, api_client=None) -> None:
50
+ if api_client is None:
51
+ api_client = ApiClient.get_default()
52
+ self.api_client = api_client
53
+
54
+
55
+ @validate_call
56
+ async def amend_order(
57
+ self,
58
+ order_id: StrictStr,
59
+ # Request body parameters as keyword arguments
60
+ **kwargs: Any,
61
+ ) -> AmendOrderResponse:
62
+ """Amend Order
63
+
64
+ Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is `remaining_count` + `fill_count`.
65
+
66
+ :param order_id: Order ID (required)
67
+ :type order_id: str
68
+ :param amend_order_request: (required)
69
+ :type amend_order_request: AmendOrderRequest
70
+ :param _request_timeout: timeout setting for this request. If one
71
+ number provided, it will be total request
72
+ timeout. It can also be a pair (tuple) of
73
+ (connection, read) timeouts.
74
+ :type _request_timeout: int, tuple(int, int), optional
75
+ :param _request_auth: set to override the auth_settings for an a single
76
+ request; this effectively ignores the
77
+ authentication in the spec for a single request.
78
+ :type _request_auth: dict, optional
79
+ :param _content_type: force content-type for the request.
80
+ :type _content_type: str, Optional
81
+ :param _headers: set to override the headers for a single
82
+ request; this effectively ignores the headers
83
+ in the spec for a single request.
84
+ :type _headers: dict, optional
85
+ :param _host_index: set to override the host_index for a single
86
+ request; this effectively ignores the host_index
87
+ in the spec for a single request.
88
+ :type _host_index: int, optional
89
+ :return: Returns the result object.
90
+ """ # noqa: E501
91
+
92
+ # Create request object from kwargs
93
+ amend_order_request = AmendOrderRequest(**kwargs) if kwargs else None
94
+
95
+ _param = self._amend_order_serialize(
96
+ order_id=order_id,
97
+ amend_order_request=amend_order_request,
98
+ _request_auth=kwargs.get('_request_auth'),
99
+ _content_type=kwargs.get('_content_type'),
100
+ _headers=kwargs.get('_headers'),
101
+ _host_index=kwargs.get('_host_index', 0)
102
+ )
103
+
104
+ _response_types_map: Dict[str, Optional[str]] = {
105
+ '200': "AmendOrderResponse",
106
+ '400': "ErrorResponse",
107
+ '401': "ErrorResponse",
108
+ '404': "ErrorResponse",
109
+ '500': "ErrorResponse",
110
+ }
111
+ response_data = await self.api_client.call_api(
112
+ *_param,
113
+ _request_timeout=kwargs.get('_request_timeout'),
114
+ )
115
+ await response_data.read()
116
+ return self.api_client.response_deserialize(
117
+ response_data=response_data,
118
+ response_types_map=_response_types_map,
119
+ ).data
120
+
121
+
122
+ @validate_call
123
+ async def amend_order_with_http_info(
124
+ self,
125
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
126
+ amend_order_request: AmendOrderRequest,
127
+ _request_timeout: Union[
128
+ None,
129
+ Annotated[StrictFloat, Field(gt=0)],
130
+ Tuple[
131
+ Annotated[StrictFloat, Field(gt=0)],
132
+ Annotated[StrictFloat, Field(gt=0)]
133
+ ]
134
+ ] = None,
135
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
136
+ _content_type: Optional[StrictStr] = None,
137
+ _headers: Optional[Dict[StrictStr, Any]] = None,
138
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
139
+ ) -> ApiResponse[AmendOrderResponse]:
140
+ """Amend Order
141
+
142
+ Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is `remaining_count` + `fill_count`.
143
+
144
+ :param order_id: Order ID (required)
145
+ :type order_id: str
146
+ :param amend_order_request: (required)
147
+ :type amend_order_request: AmendOrderRequest
148
+ :param _request_timeout: timeout setting for this request. If one
149
+ number provided, it will be total request
150
+ timeout. It can also be a pair (tuple) of
151
+ (connection, read) timeouts.
152
+ :type _request_timeout: int, tuple(int, int), optional
153
+ :param _request_auth: set to override the auth_settings for an a single
154
+ request; this effectively ignores the
155
+ authentication in the spec for a single request.
156
+ :type _request_auth: dict, optional
157
+ :param _content_type: force content-type for the request.
158
+ :type _content_type: str, Optional
159
+ :param _headers: set to override the headers for a single
160
+ request; this effectively ignores the headers
161
+ in the spec for a single request.
162
+ :type _headers: dict, optional
163
+ :param _host_index: set to override the host_index for a single
164
+ request; this effectively ignores the host_index
165
+ in the spec for a single request.
166
+ :type _host_index: int, optional
167
+ :return: Returns the result object.
168
+ """ # noqa: E501
169
+
170
+ _param = self._amend_order_serialize(
171
+ order_id=order_id,
172
+ amend_order_request=amend_order_request,
173
+ _request_auth=_request_auth,
174
+ _content_type=_content_type,
175
+ _headers=_headers,
176
+ _host_index=_host_index
177
+ )
178
+
179
+ _response_types_map: Dict[str, Optional[str]] = {
180
+ '200': "AmendOrderResponse",
181
+ '400': "ErrorResponse",
182
+ '401': "ErrorResponse",
183
+ '404': "ErrorResponse",
184
+ '500': "ErrorResponse",
185
+ }
186
+ response_data = await self.api_client.call_api(
187
+ *_param,
188
+ _request_timeout=_request_timeout
189
+ )
190
+ await response_data.read()
191
+ return self.api_client.response_deserialize(
192
+ response_data=response_data,
193
+ response_types_map=_response_types_map,
194
+ )
195
+
196
+
197
+ @validate_call
198
+ async def amend_order_without_preload_content(
199
+ self,
200
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
201
+ amend_order_request: AmendOrderRequest,
202
+ _request_timeout: Union[
203
+ None,
204
+ Annotated[StrictFloat, Field(gt=0)],
205
+ Tuple[
206
+ Annotated[StrictFloat, Field(gt=0)],
207
+ Annotated[StrictFloat, Field(gt=0)]
208
+ ]
209
+ ] = None,
210
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
211
+ _content_type: Optional[StrictStr] = None,
212
+ _headers: Optional[Dict[StrictStr, Any]] = None,
213
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
214
+ ) -> RESTResponseType:
215
+ """Amend Order
216
+
217
+ Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is `remaining_count` + `fill_count`.
218
+
219
+ :param order_id: Order ID (required)
220
+ :type order_id: str
221
+ :param amend_order_request: (required)
222
+ :type amend_order_request: AmendOrderRequest
223
+ :param _request_timeout: timeout setting for this request. If one
224
+ number provided, it will be total request
225
+ timeout. It can also be a pair (tuple) of
226
+ (connection, read) timeouts.
227
+ :type _request_timeout: int, tuple(int, int), optional
228
+ :param _request_auth: set to override the auth_settings for an a single
229
+ request; this effectively ignores the
230
+ authentication in the spec for a single request.
231
+ :type _request_auth: dict, optional
232
+ :param _content_type: force content-type for the request.
233
+ :type _content_type: str, Optional
234
+ :param _headers: set to override the headers for a single
235
+ request; this effectively ignores the headers
236
+ in the spec for a single request.
237
+ :type _headers: dict, optional
238
+ :param _host_index: set to override the host_index for a single
239
+ request; this effectively ignores the host_index
240
+ in the spec for a single request.
241
+ :type _host_index: int, optional
242
+ :return: Returns the result object.
243
+ """ # noqa: E501
244
+
245
+ _param = self._amend_order_serialize(
246
+ order_id=order_id,
247
+ amend_order_request=amend_order_request,
248
+ _request_auth=_request_auth,
249
+ _content_type=_content_type,
250
+ _headers=_headers,
251
+ _host_index=_host_index
252
+ )
253
+
254
+ _response_types_map: Dict[str, Optional[str]] = {
255
+ '200': "AmendOrderResponse",
256
+ '400': "ErrorResponse",
257
+ '401': "ErrorResponse",
258
+ '404': "ErrorResponse",
259
+ '500': "ErrorResponse",
260
+ }
261
+ response_data = await self.api_client.call_api(
262
+ *_param,
263
+ _request_timeout=_request_timeout
264
+ )
265
+ return response_data.response
266
+
267
+
268
+ def _amend_order_serialize(
269
+ self,
270
+ order_id,
271
+ amend_order_request,
272
+ _request_auth,
273
+ _content_type,
274
+ _headers,
275
+ _host_index,
276
+ ) -> RequestSerialized:
277
+
278
+ _host = None
279
+
280
+ _collection_formats: Dict[str, str] = {
281
+ }
282
+
283
+ _path_params: Dict[str, str] = {}
284
+ _query_params: List[Tuple[str, str]] = []
285
+ _header_params: Dict[str, Optional[str]] = _headers or {}
286
+ _form_params: List[Tuple[str, str]] = []
287
+ _files: Dict[
288
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
289
+ ] = {}
290
+ _body_params: Optional[bytes] = None
291
+
292
+ # process the path parameters
293
+ if order_id is not None:
294
+ _path_params['order_id'] = order_id
295
+ # process the query parameters
296
+ # process the header parameters
297
+ # process the form parameters
298
+ # process the body parameter
299
+ if amend_order_request is not None:
300
+ _body_params = amend_order_request
301
+
302
+
303
+ # set the HTTP header `Accept`
304
+ if 'Accept' not in _header_params:
305
+ _header_params['Accept'] = self.api_client.select_header_accept(
306
+ [
307
+ 'application/json'
308
+ ]
309
+ )
310
+
311
+ # set the HTTP header `Content-Type`
312
+ if _content_type:
313
+ _header_params['Content-Type'] = _content_type
314
+ else:
315
+ _default_content_type = (
316
+ self.api_client.select_header_content_type(
317
+ [
318
+ 'application/json'
319
+ ]
320
+ )
321
+ )
322
+ if _default_content_type is not None:
323
+ _header_params['Content-Type'] = _default_content_type
324
+
325
+ # authentication setting
326
+ _auth_settings: List[str] = [
327
+ 'kalshiAccessSignature',
328
+ 'kalshiAccessKey',
329
+ 'kalshiAccessTimestamp'
330
+ ]
331
+
332
+ return self.api_client.param_serialize(
333
+ method='POST',
334
+ resource_path='/portfolio/orders/{order_id}/amend',
335
+ path_params=_path_params,
336
+ query_params=_query_params,
337
+ header_params=_header_params,
338
+ body=_body_params,
339
+ post_params=_form_params,
340
+ files=_files,
341
+ auth_settings=_auth_settings,
342
+ collection_formats=_collection_formats,
343
+ _host=_host,
344
+ _request_auth=_request_auth
345
+ )
346
+
347
+
348
+
349
+
350
+ @validate_call
351
+ async def batch_cancel_orders(
352
+ self,
353
+ # Request body parameters as keyword arguments
354
+ **kwargs: Any,
355
+ ) -> BatchCancelOrdersResponse:
356
+ """Batch Cancel Orders
357
+
358
+ Endpoint for cancelling up to 20 orders at once.
359
+
360
+ :param batch_cancel_orders_request: (required)
361
+ :type batch_cancel_orders_request: BatchCancelOrdersRequest
362
+ :param _request_timeout: timeout setting for this request. If one
363
+ number provided, it will be total request
364
+ timeout. It can also be a pair (tuple) of
365
+ (connection, read) timeouts.
366
+ :type _request_timeout: int, tuple(int, int), optional
367
+ :param _request_auth: set to override the auth_settings for an a single
368
+ request; this effectively ignores the
369
+ authentication in the spec for a single request.
370
+ :type _request_auth: dict, optional
371
+ :param _content_type: force content-type for the request.
372
+ :type _content_type: str, Optional
373
+ :param _headers: set to override the headers for a single
374
+ request; this effectively ignores the headers
375
+ in the spec for a single request.
376
+ :type _headers: dict, optional
377
+ :param _host_index: set to override the host_index for a single
378
+ request; this effectively ignores the host_index
379
+ in the spec for a single request.
380
+ :type _host_index: int, optional
381
+ :return: Returns the result object.
382
+ """ # noqa: E501
383
+
384
+ # Create request object from kwargs
385
+ batch_cancel_orders_request = BatchCancelOrdersRequest(**kwargs) if kwargs else None
386
+
387
+ _param = self._batch_cancel_orders_serialize(
388
+ batch_cancel_orders_request=batch_cancel_orders_request,
389
+ _request_auth=kwargs.get('_request_auth'),
390
+ _content_type=kwargs.get('_content_type'),
391
+ _headers=kwargs.get('_headers'),
392
+ _host_index=kwargs.get('_host_index', 0)
393
+ )
394
+
395
+ _response_types_map: Dict[str, Optional[str]] = {
396
+ '200': "BatchCancelOrdersResponse",
397
+ '400': "ErrorResponse",
398
+ '401': "ErrorResponse",
399
+ '403': "ErrorResponse",
400
+ '500': "ErrorResponse",
401
+ }
402
+ response_data = await self.api_client.call_api(
403
+ *_param,
404
+ _request_timeout=kwargs.get('_request_timeout'),
405
+ )
406
+ await response_data.read()
407
+ return self.api_client.response_deserialize(
408
+ response_data=response_data,
409
+ response_types_map=_response_types_map,
410
+ ).data
411
+
412
+
413
+ @validate_call
414
+ async def batch_cancel_orders_with_http_info(
415
+ self,
416
+ batch_cancel_orders_request: BatchCancelOrdersRequest,
417
+ _request_timeout: Union[
418
+ None,
419
+ Annotated[StrictFloat, Field(gt=0)],
420
+ Tuple[
421
+ Annotated[StrictFloat, Field(gt=0)],
422
+ Annotated[StrictFloat, Field(gt=0)]
423
+ ]
424
+ ] = None,
425
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
426
+ _content_type: Optional[StrictStr] = None,
427
+ _headers: Optional[Dict[StrictStr, Any]] = None,
428
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
429
+ ) -> ApiResponse[BatchCancelOrdersResponse]:
430
+ """Batch Cancel Orders
431
+
432
+ Endpoint for cancelling up to 20 orders at once.
433
+
434
+ :param batch_cancel_orders_request: (required)
435
+ :type batch_cancel_orders_request: BatchCancelOrdersRequest
436
+ :param _request_timeout: timeout setting for this request. If one
437
+ number provided, it will be total request
438
+ timeout. It can also be a pair (tuple) of
439
+ (connection, read) timeouts.
440
+ :type _request_timeout: int, tuple(int, int), optional
441
+ :param _request_auth: set to override the auth_settings for an a single
442
+ request; this effectively ignores the
443
+ authentication in the spec for a single request.
444
+ :type _request_auth: dict, optional
445
+ :param _content_type: force content-type for the request.
446
+ :type _content_type: str, Optional
447
+ :param _headers: set to override the headers for a single
448
+ request; this effectively ignores the headers
449
+ in the spec for a single request.
450
+ :type _headers: dict, optional
451
+ :param _host_index: set to override the host_index for a single
452
+ request; this effectively ignores the host_index
453
+ in the spec for a single request.
454
+ :type _host_index: int, optional
455
+ :return: Returns the result object.
456
+ """ # noqa: E501
457
+
458
+ _param = self._batch_cancel_orders_serialize(
459
+ batch_cancel_orders_request=batch_cancel_orders_request,
460
+ _request_auth=_request_auth,
461
+ _content_type=_content_type,
462
+ _headers=_headers,
463
+ _host_index=_host_index
464
+ )
465
+
466
+ _response_types_map: Dict[str, Optional[str]] = {
467
+ '200': "BatchCancelOrdersResponse",
468
+ '400': "ErrorResponse",
469
+ '401': "ErrorResponse",
470
+ '403': "ErrorResponse",
471
+ '500': "ErrorResponse",
472
+ }
473
+ response_data = await self.api_client.call_api(
474
+ *_param,
475
+ _request_timeout=_request_timeout
476
+ )
477
+ await response_data.read()
478
+ return self.api_client.response_deserialize(
479
+ response_data=response_data,
480
+ response_types_map=_response_types_map,
481
+ )
482
+
483
+
484
+ @validate_call
485
+ async def batch_cancel_orders_without_preload_content(
486
+ self,
487
+ batch_cancel_orders_request: BatchCancelOrdersRequest,
488
+ _request_timeout: Union[
489
+ None,
490
+ Annotated[StrictFloat, Field(gt=0)],
491
+ Tuple[
492
+ Annotated[StrictFloat, Field(gt=0)],
493
+ Annotated[StrictFloat, Field(gt=0)]
494
+ ]
495
+ ] = None,
496
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
497
+ _content_type: Optional[StrictStr] = None,
498
+ _headers: Optional[Dict[StrictStr, Any]] = None,
499
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
500
+ ) -> RESTResponseType:
501
+ """Batch Cancel Orders
502
+
503
+ Endpoint for cancelling up to 20 orders at once.
504
+
505
+ :param batch_cancel_orders_request: (required)
506
+ :type batch_cancel_orders_request: BatchCancelOrdersRequest
507
+ :param _request_timeout: timeout setting for this request. If one
508
+ number provided, it will be total request
509
+ timeout. It can also be a pair (tuple) of
510
+ (connection, read) timeouts.
511
+ :type _request_timeout: int, tuple(int, int), optional
512
+ :param _request_auth: set to override the auth_settings for an a single
513
+ request; this effectively ignores the
514
+ authentication in the spec for a single request.
515
+ :type _request_auth: dict, optional
516
+ :param _content_type: force content-type for the request.
517
+ :type _content_type: str, Optional
518
+ :param _headers: set to override the headers for a single
519
+ request; this effectively ignores the headers
520
+ in the spec for a single request.
521
+ :type _headers: dict, optional
522
+ :param _host_index: set to override the host_index for a single
523
+ request; this effectively ignores the host_index
524
+ in the spec for a single request.
525
+ :type _host_index: int, optional
526
+ :return: Returns the result object.
527
+ """ # noqa: E501
528
+
529
+ _param = self._batch_cancel_orders_serialize(
530
+ batch_cancel_orders_request=batch_cancel_orders_request,
531
+ _request_auth=_request_auth,
532
+ _content_type=_content_type,
533
+ _headers=_headers,
534
+ _host_index=_host_index
535
+ )
536
+
537
+ _response_types_map: Dict[str, Optional[str]] = {
538
+ '200': "BatchCancelOrdersResponse",
539
+ '400': "ErrorResponse",
540
+ '401': "ErrorResponse",
541
+ '403': "ErrorResponse",
542
+ '500': "ErrorResponse",
543
+ }
544
+ response_data = await self.api_client.call_api(
545
+ *_param,
546
+ _request_timeout=_request_timeout
547
+ )
548
+ return response_data.response
549
+
550
+
551
+ def _batch_cancel_orders_serialize(
552
+ self,
553
+ batch_cancel_orders_request,
554
+ _request_auth,
555
+ _content_type,
556
+ _headers,
557
+ _host_index,
558
+ ) -> RequestSerialized:
559
+
560
+ _host = None
561
+
562
+ _collection_formats: Dict[str, str] = {
563
+ }
564
+
565
+ _path_params: Dict[str, str] = {}
566
+ _query_params: List[Tuple[str, str]] = []
567
+ _header_params: Dict[str, Optional[str]] = _headers or {}
568
+ _form_params: List[Tuple[str, str]] = []
569
+ _files: Dict[
570
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
571
+ ] = {}
572
+ _body_params: Optional[bytes] = None
573
+
574
+ # process the path parameters
575
+ # process the query parameters
576
+ # process the header parameters
577
+ # process the form parameters
578
+ # process the body parameter
579
+ if batch_cancel_orders_request is not None:
580
+ _body_params = batch_cancel_orders_request
581
+
582
+
583
+ # set the HTTP header `Accept`
584
+ if 'Accept' not in _header_params:
585
+ _header_params['Accept'] = self.api_client.select_header_accept(
586
+ [
587
+ 'application/json'
588
+ ]
589
+ )
590
+
591
+ # set the HTTP header `Content-Type`
592
+ if _content_type:
593
+ _header_params['Content-Type'] = _content_type
594
+ else:
595
+ _default_content_type = (
596
+ self.api_client.select_header_content_type(
597
+ [
598
+ 'application/json'
599
+ ]
600
+ )
601
+ )
602
+ if _default_content_type is not None:
603
+ _header_params['Content-Type'] = _default_content_type
604
+
605
+ # authentication setting
606
+ _auth_settings: List[str] = [
607
+ 'kalshiAccessSignature',
608
+ 'kalshiAccessKey',
609
+ 'kalshiAccessTimestamp'
610
+ ]
611
+
612
+ return self.api_client.param_serialize(
613
+ method='DELETE',
614
+ resource_path='/portfolio/orders/batched',
615
+ path_params=_path_params,
616
+ query_params=_query_params,
617
+ header_params=_header_params,
618
+ body=_body_params,
619
+ post_params=_form_params,
620
+ files=_files,
621
+ auth_settings=_auth_settings,
622
+ collection_formats=_collection_formats,
623
+ _host=_host,
624
+ _request_auth=_request_auth
625
+ )
626
+
627
+
628
+
629
+
630
+ @validate_call
631
+ async def batch_create_orders(
632
+ self,
633
+ # Request body parameters as keyword arguments
634
+ **kwargs: Any,
635
+ ) -> BatchCreateOrdersResponse:
636
+ """Batch Create Orders
637
+
638
+ Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per-second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch.
639
+
640
+ :param batch_create_orders_request: (required)
641
+ :type batch_create_orders_request: BatchCreateOrdersRequest
642
+ :param _request_timeout: timeout setting for this request. If one
643
+ number provided, it will be total request
644
+ timeout. It can also be a pair (tuple) of
645
+ (connection, read) timeouts.
646
+ :type _request_timeout: int, tuple(int, int), optional
647
+ :param _request_auth: set to override the auth_settings for an a single
648
+ request; this effectively ignores the
649
+ authentication in the spec for a single request.
650
+ :type _request_auth: dict, optional
651
+ :param _content_type: force content-type for the request.
652
+ :type _content_type: str, Optional
653
+ :param _headers: set to override the headers for a single
654
+ request; this effectively ignores the headers
655
+ in the spec for a single request.
656
+ :type _headers: dict, optional
657
+ :param _host_index: set to override the host_index for a single
658
+ request; this effectively ignores the host_index
659
+ in the spec for a single request.
660
+ :type _host_index: int, optional
661
+ :return: Returns the result object.
662
+ """ # noqa: E501
663
+
664
+ # Create request object from kwargs
665
+ batch_create_orders_request = BatchCreateOrdersRequest(**kwargs) if kwargs else None
666
+
667
+ _param = self._batch_create_orders_serialize(
668
+ batch_create_orders_request=batch_create_orders_request,
669
+ _request_auth=kwargs.get('_request_auth'),
670
+ _content_type=kwargs.get('_content_type'),
671
+ _headers=kwargs.get('_headers'),
672
+ _host_index=kwargs.get('_host_index', 0)
673
+ )
674
+
675
+ _response_types_map: Dict[str, Optional[str]] = {
676
+ '201': "BatchCreateOrdersResponse",
677
+ '400': "ErrorResponse",
678
+ '401': "ErrorResponse",
679
+ '403': "ErrorResponse",
680
+ '500': "ErrorResponse",
681
+ }
682
+ response_data = await self.api_client.call_api(
683
+ *_param,
684
+ _request_timeout=kwargs.get('_request_timeout'),
685
+ )
686
+ await response_data.read()
687
+ return self.api_client.response_deserialize(
688
+ response_data=response_data,
689
+ response_types_map=_response_types_map,
690
+ ).data
691
+
692
+
693
+ @validate_call
694
+ async def batch_create_orders_with_http_info(
695
+ self,
696
+ batch_create_orders_request: BatchCreateOrdersRequest,
697
+ _request_timeout: Union[
698
+ None,
699
+ Annotated[StrictFloat, Field(gt=0)],
700
+ Tuple[
701
+ Annotated[StrictFloat, Field(gt=0)],
702
+ Annotated[StrictFloat, Field(gt=0)]
703
+ ]
704
+ ] = None,
705
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
706
+ _content_type: Optional[StrictStr] = None,
707
+ _headers: Optional[Dict[StrictStr, Any]] = None,
708
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
709
+ ) -> ApiResponse[BatchCreateOrdersResponse]:
710
+ """Batch Create Orders
711
+
712
+ Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per-second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch.
713
+
714
+ :param batch_create_orders_request: (required)
715
+ :type batch_create_orders_request: BatchCreateOrdersRequest
716
+ :param _request_timeout: timeout setting for this request. If one
717
+ number provided, it will be total request
718
+ timeout. It can also be a pair (tuple) of
719
+ (connection, read) timeouts.
720
+ :type _request_timeout: int, tuple(int, int), optional
721
+ :param _request_auth: set to override the auth_settings for an a single
722
+ request; this effectively ignores the
723
+ authentication in the spec for a single request.
724
+ :type _request_auth: dict, optional
725
+ :param _content_type: force content-type for the request.
726
+ :type _content_type: str, Optional
727
+ :param _headers: set to override the headers for a single
728
+ request; this effectively ignores the headers
729
+ in the spec for a single request.
730
+ :type _headers: dict, optional
731
+ :param _host_index: set to override the host_index for a single
732
+ request; this effectively ignores the host_index
733
+ in the spec for a single request.
734
+ :type _host_index: int, optional
735
+ :return: Returns the result object.
736
+ """ # noqa: E501
737
+
738
+ _param = self._batch_create_orders_serialize(
739
+ batch_create_orders_request=batch_create_orders_request,
740
+ _request_auth=_request_auth,
741
+ _content_type=_content_type,
742
+ _headers=_headers,
743
+ _host_index=_host_index
744
+ )
745
+
746
+ _response_types_map: Dict[str, Optional[str]] = {
747
+ '201': "BatchCreateOrdersResponse",
748
+ '400': "ErrorResponse",
749
+ '401': "ErrorResponse",
750
+ '403': "ErrorResponse",
751
+ '500': "ErrorResponse",
752
+ }
753
+ response_data = await self.api_client.call_api(
754
+ *_param,
755
+ _request_timeout=_request_timeout
756
+ )
757
+ await response_data.read()
758
+ return self.api_client.response_deserialize(
759
+ response_data=response_data,
760
+ response_types_map=_response_types_map,
761
+ )
762
+
763
+
764
+ @validate_call
765
+ async def batch_create_orders_without_preload_content(
766
+ self,
767
+ batch_create_orders_request: BatchCreateOrdersRequest,
768
+ _request_timeout: Union[
769
+ None,
770
+ Annotated[StrictFloat, Field(gt=0)],
771
+ Tuple[
772
+ Annotated[StrictFloat, Field(gt=0)],
773
+ Annotated[StrictFloat, Field(gt=0)]
774
+ ]
775
+ ] = None,
776
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
777
+ _content_type: Optional[StrictStr] = None,
778
+ _headers: Optional[Dict[StrictStr, Any]] = None,
779
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
780
+ ) -> RESTResponseType:
781
+ """Batch Create Orders
782
+
783
+ Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per-second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch.
784
+
785
+ :param batch_create_orders_request: (required)
786
+ :type batch_create_orders_request: BatchCreateOrdersRequest
787
+ :param _request_timeout: timeout setting for this request. If one
788
+ number provided, it will be total request
789
+ timeout. It can also be a pair (tuple) of
790
+ (connection, read) timeouts.
791
+ :type _request_timeout: int, tuple(int, int), optional
792
+ :param _request_auth: set to override the auth_settings for an a single
793
+ request; this effectively ignores the
794
+ authentication in the spec for a single request.
795
+ :type _request_auth: dict, optional
796
+ :param _content_type: force content-type for the request.
797
+ :type _content_type: str, Optional
798
+ :param _headers: set to override the headers for a single
799
+ request; this effectively ignores the headers
800
+ in the spec for a single request.
801
+ :type _headers: dict, optional
802
+ :param _host_index: set to override the host_index for a single
803
+ request; this effectively ignores the host_index
804
+ in the spec for a single request.
805
+ :type _host_index: int, optional
806
+ :return: Returns the result object.
807
+ """ # noqa: E501
808
+
809
+ _param = self._batch_create_orders_serialize(
810
+ batch_create_orders_request=batch_create_orders_request,
811
+ _request_auth=_request_auth,
812
+ _content_type=_content_type,
813
+ _headers=_headers,
814
+ _host_index=_host_index
815
+ )
816
+
817
+ _response_types_map: Dict[str, Optional[str]] = {
818
+ '201': "BatchCreateOrdersResponse",
819
+ '400': "ErrorResponse",
820
+ '401': "ErrorResponse",
821
+ '403': "ErrorResponse",
822
+ '500': "ErrorResponse",
823
+ }
824
+ response_data = await self.api_client.call_api(
825
+ *_param,
826
+ _request_timeout=_request_timeout
827
+ )
828
+ return response_data.response
829
+
830
+
831
+ def _batch_create_orders_serialize(
832
+ self,
833
+ batch_create_orders_request,
834
+ _request_auth,
835
+ _content_type,
836
+ _headers,
837
+ _host_index,
838
+ ) -> RequestSerialized:
839
+
840
+ _host = None
841
+
842
+ _collection_formats: Dict[str, str] = {
843
+ }
844
+
845
+ _path_params: Dict[str, str] = {}
846
+ _query_params: List[Tuple[str, str]] = []
847
+ _header_params: Dict[str, Optional[str]] = _headers or {}
848
+ _form_params: List[Tuple[str, str]] = []
849
+ _files: Dict[
850
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
851
+ ] = {}
852
+ _body_params: Optional[bytes] = None
853
+
854
+ # process the path parameters
855
+ # process the query parameters
856
+ # process the header parameters
857
+ # process the form parameters
858
+ # process the body parameter
859
+ if batch_create_orders_request is not None:
860
+ _body_params = batch_create_orders_request
861
+
862
+
863
+ # set the HTTP header `Accept`
864
+ if 'Accept' not in _header_params:
865
+ _header_params['Accept'] = self.api_client.select_header_accept(
866
+ [
867
+ 'application/json'
868
+ ]
869
+ )
870
+
871
+ # set the HTTP header `Content-Type`
872
+ if _content_type:
873
+ _header_params['Content-Type'] = _content_type
874
+ else:
875
+ _default_content_type = (
876
+ self.api_client.select_header_content_type(
877
+ [
878
+ 'application/json'
879
+ ]
880
+ )
881
+ )
882
+ if _default_content_type is not None:
883
+ _header_params['Content-Type'] = _default_content_type
884
+
885
+ # authentication setting
886
+ _auth_settings: List[str] = [
887
+ 'kalshiAccessSignature',
888
+ 'kalshiAccessKey',
889
+ 'kalshiAccessTimestamp'
890
+ ]
891
+
892
+ return self.api_client.param_serialize(
893
+ method='POST',
894
+ resource_path='/portfolio/orders/batched',
895
+ path_params=_path_params,
896
+ query_params=_query_params,
897
+ header_params=_header_params,
898
+ body=_body_params,
899
+ post_params=_form_params,
900
+ files=_files,
901
+ auth_settings=_auth_settings,
902
+ collection_formats=_collection_formats,
903
+ _host=_host,
904
+ _request_auth=_request_auth
905
+ )
906
+
907
+
908
+
909
+
910
+ @validate_call
911
+ async def cancel_order(
912
+ self,
913
+ order_id: StrictStr,
914
+ ) -> CancelOrderResponse:
915
+ """Cancel Order
916
+
917
+ Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can't completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.
918
+
919
+ :param order_id: Order ID (required)
920
+ :type order_id: str
921
+ :param _request_timeout: timeout setting for this request. If one
922
+ number provided, it will be total request
923
+ timeout. It can also be a pair (tuple) of
924
+ (connection, read) timeouts.
925
+ :type _request_timeout: int, tuple(int, int), optional
926
+ :param _request_auth: set to override the auth_settings for an a single
927
+ request; this effectively ignores the
928
+ authentication in the spec for a single request.
929
+ :type _request_auth: dict, optional
930
+ :param _content_type: force content-type for the request.
931
+ :type _content_type: str, Optional
932
+ :param _headers: set to override the headers for a single
933
+ request; this effectively ignores the headers
934
+ in the spec for a single request.
935
+ :type _headers: dict, optional
936
+ :param _host_index: set to override the host_index for a single
937
+ request; this effectively ignores the host_index
938
+ in the spec for a single request.
939
+ :type _host_index: int, optional
940
+ :return: Returns the result object.
941
+ """ # noqa: E501
942
+
943
+
944
+ _param = self._cancel_order_serialize(
945
+ order_id=order_id,
946
+ _request_auth=None,
947
+ _content_type=None,
948
+ _headers=None,
949
+ _host_index=0
950
+ )
951
+
952
+ _response_types_map: Dict[str, Optional[str]] = {
953
+ '200': "CancelOrderResponse",
954
+ '401': "ErrorResponse",
955
+ '404': "ErrorResponse",
956
+ '500': "ErrorResponse",
957
+ }
958
+ response_data = await self.api_client.call_api(
959
+ *_param,
960
+ _request_timeout=None,
961
+ )
962
+ await response_data.read()
963
+ return self.api_client.response_deserialize(
964
+ response_data=response_data,
965
+ response_types_map=_response_types_map,
966
+ ).data
967
+
968
+
969
+ @validate_call
970
+ async def cancel_order_with_http_info(
971
+ self,
972
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
973
+ _request_timeout: Union[
974
+ None,
975
+ Annotated[StrictFloat, Field(gt=0)],
976
+ Tuple[
977
+ Annotated[StrictFloat, Field(gt=0)],
978
+ Annotated[StrictFloat, Field(gt=0)]
979
+ ]
980
+ ] = None,
981
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
982
+ _content_type: Optional[StrictStr] = None,
983
+ _headers: Optional[Dict[StrictStr, Any]] = None,
984
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
985
+ ) -> ApiResponse[CancelOrderResponse]:
986
+ """Cancel Order
987
+
988
+ Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can't completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.
989
+
990
+ :param order_id: Order ID (required)
991
+ :type order_id: str
992
+ :param _request_timeout: timeout setting for this request. If one
993
+ number provided, it will be total request
994
+ timeout. It can also be a pair (tuple) of
995
+ (connection, read) timeouts.
996
+ :type _request_timeout: int, tuple(int, int), optional
997
+ :param _request_auth: set to override the auth_settings for an a single
998
+ request; this effectively ignores the
999
+ authentication in the spec for a single request.
1000
+ :type _request_auth: dict, optional
1001
+ :param _content_type: force content-type for the request.
1002
+ :type _content_type: str, Optional
1003
+ :param _headers: set to override the headers for a single
1004
+ request; this effectively ignores the headers
1005
+ in the spec for a single request.
1006
+ :type _headers: dict, optional
1007
+ :param _host_index: set to override the host_index for a single
1008
+ request; this effectively ignores the host_index
1009
+ in the spec for a single request.
1010
+ :type _host_index: int, optional
1011
+ :return: Returns the result object.
1012
+ """ # noqa: E501
1013
+
1014
+ _param = self._cancel_order_serialize(
1015
+ order_id=order_id,
1016
+ _request_auth=_request_auth,
1017
+ _content_type=_content_type,
1018
+ _headers=_headers,
1019
+ _host_index=_host_index
1020
+ )
1021
+
1022
+ _response_types_map: Dict[str, Optional[str]] = {
1023
+ '200': "CancelOrderResponse",
1024
+ '401': "ErrorResponse",
1025
+ '404': "ErrorResponse",
1026
+ '500': "ErrorResponse",
1027
+ }
1028
+ response_data = await self.api_client.call_api(
1029
+ *_param,
1030
+ _request_timeout=_request_timeout
1031
+ )
1032
+ await response_data.read()
1033
+ return self.api_client.response_deserialize(
1034
+ response_data=response_data,
1035
+ response_types_map=_response_types_map,
1036
+ )
1037
+
1038
+
1039
+ @validate_call
1040
+ async def cancel_order_without_preload_content(
1041
+ self,
1042
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
1043
+ _request_timeout: Union[
1044
+ None,
1045
+ Annotated[StrictFloat, Field(gt=0)],
1046
+ Tuple[
1047
+ Annotated[StrictFloat, Field(gt=0)],
1048
+ Annotated[StrictFloat, Field(gt=0)]
1049
+ ]
1050
+ ] = None,
1051
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1052
+ _content_type: Optional[StrictStr] = None,
1053
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1054
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1055
+ ) -> RESTResponseType:
1056
+ """Cancel Order
1057
+
1058
+ Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can't completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.
1059
+
1060
+ :param order_id: Order ID (required)
1061
+ :type order_id: str
1062
+ :param _request_timeout: timeout setting for this request. If one
1063
+ number provided, it will be total request
1064
+ timeout. It can also be a pair (tuple) of
1065
+ (connection, read) timeouts.
1066
+ :type _request_timeout: int, tuple(int, int), optional
1067
+ :param _request_auth: set to override the auth_settings for an a single
1068
+ request; this effectively ignores the
1069
+ authentication in the spec for a single request.
1070
+ :type _request_auth: dict, optional
1071
+ :param _content_type: force content-type for the request.
1072
+ :type _content_type: str, Optional
1073
+ :param _headers: set to override the headers for a single
1074
+ request; this effectively ignores the headers
1075
+ in the spec for a single request.
1076
+ :type _headers: dict, optional
1077
+ :param _host_index: set to override the host_index for a single
1078
+ request; this effectively ignores the host_index
1079
+ in the spec for a single request.
1080
+ :type _host_index: int, optional
1081
+ :return: Returns the result object.
1082
+ """ # noqa: E501
1083
+
1084
+ _param = self._cancel_order_serialize(
1085
+ order_id=order_id,
1086
+ _request_auth=_request_auth,
1087
+ _content_type=_content_type,
1088
+ _headers=_headers,
1089
+ _host_index=_host_index
1090
+ )
1091
+
1092
+ _response_types_map: Dict[str, Optional[str]] = {
1093
+ '200': "CancelOrderResponse",
1094
+ '401': "ErrorResponse",
1095
+ '404': "ErrorResponse",
1096
+ '500': "ErrorResponse",
1097
+ }
1098
+ response_data = await self.api_client.call_api(
1099
+ *_param,
1100
+ _request_timeout=_request_timeout
1101
+ )
1102
+ return response_data.response
1103
+
1104
+
1105
+ def _cancel_order_serialize(
1106
+ self,
1107
+ order_id,
1108
+ _request_auth,
1109
+ _content_type,
1110
+ _headers,
1111
+ _host_index,
1112
+ ) -> RequestSerialized:
1113
+
1114
+ _host = None
1115
+
1116
+ _collection_formats: Dict[str, str] = {
1117
+ }
1118
+
1119
+ _path_params: Dict[str, str] = {}
1120
+ _query_params: List[Tuple[str, str]] = []
1121
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1122
+ _form_params: List[Tuple[str, str]] = []
1123
+ _files: Dict[
1124
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1125
+ ] = {}
1126
+ _body_params: Optional[bytes] = None
1127
+
1128
+ # process the path parameters
1129
+ if order_id is not None:
1130
+ _path_params['order_id'] = order_id
1131
+ # process the query parameters
1132
+ # process the header parameters
1133
+ # process the form parameters
1134
+ # process the body parameter
1135
+
1136
+
1137
+ # set the HTTP header `Accept`
1138
+ if 'Accept' not in _header_params:
1139
+ _header_params['Accept'] = self.api_client.select_header_accept(
1140
+ [
1141
+ 'application/json'
1142
+ ]
1143
+ )
1144
+
1145
+
1146
+ # authentication setting
1147
+ _auth_settings: List[str] = [
1148
+ 'kalshiAccessSignature',
1149
+ 'kalshiAccessKey',
1150
+ 'kalshiAccessTimestamp'
1151
+ ]
1152
+
1153
+ return self.api_client.param_serialize(
1154
+ method='DELETE',
1155
+ resource_path='/portfolio/orders/{order_id}',
1156
+ path_params=_path_params,
1157
+ query_params=_query_params,
1158
+ header_params=_header_params,
1159
+ body=_body_params,
1160
+ post_params=_form_params,
1161
+ files=_files,
1162
+ auth_settings=_auth_settings,
1163
+ collection_formats=_collection_formats,
1164
+ _host=_host,
1165
+ _request_auth=_request_auth
1166
+ )
1167
+
1168
+
1169
+
1170
+
1171
+ @validate_call
1172
+ async def create_order(
1173
+ self,
1174
+ # Request body parameters as keyword arguments
1175
+ **kwargs: Any,
1176
+ ) -> CreateOrderResponse:
1177
+ """Create Order
1178
+
1179
+ Endpoint for submitting orders in a market. Each user is limited to 200 000 open orders at a time.
1180
+
1181
+ :param create_order_request: (required)
1182
+ :type create_order_request: CreateOrderRequest
1183
+ :param _request_timeout: timeout setting for this request. If one
1184
+ number provided, it will be total request
1185
+ timeout. It can also be a pair (tuple) of
1186
+ (connection, read) timeouts.
1187
+ :type _request_timeout: int, tuple(int, int), optional
1188
+ :param _request_auth: set to override the auth_settings for an a single
1189
+ request; this effectively ignores the
1190
+ authentication in the spec for a single request.
1191
+ :type _request_auth: dict, optional
1192
+ :param _content_type: force content-type for the request.
1193
+ :type _content_type: str, Optional
1194
+ :param _headers: set to override the headers for a single
1195
+ request; this effectively ignores the headers
1196
+ in the spec for a single request.
1197
+ :type _headers: dict, optional
1198
+ :param _host_index: set to override the host_index for a single
1199
+ request; this effectively ignores the host_index
1200
+ in the spec for a single request.
1201
+ :type _host_index: int, optional
1202
+ :return: Returns the result object.
1203
+ """ # noqa: E501
1204
+
1205
+ # Create request object from kwargs
1206
+ create_order_request = CreateOrderRequest(**kwargs) if kwargs else None
1207
+
1208
+ _param = self._create_order_serialize(
1209
+ create_order_request=create_order_request,
1210
+ _request_auth=kwargs.get('_request_auth'),
1211
+ _content_type=kwargs.get('_content_type'),
1212
+ _headers=kwargs.get('_headers'),
1213
+ _host_index=kwargs.get('_host_index', 0)
1214
+ )
1215
+
1216
+ _response_types_map: Dict[str, Optional[str]] = {
1217
+ '201': "CreateOrderResponse",
1218
+ '400': "ErrorResponse",
1219
+ '401': "ErrorResponse",
1220
+ '409': "ErrorResponse",
1221
+ '429': "ErrorResponse",
1222
+ '500': "ErrorResponse",
1223
+ }
1224
+ response_data = await self.api_client.call_api(
1225
+ *_param,
1226
+ _request_timeout=kwargs.get('_request_timeout'),
1227
+ )
1228
+ await response_data.read()
1229
+ return self.api_client.response_deserialize(
1230
+ response_data=response_data,
1231
+ response_types_map=_response_types_map,
1232
+ ).data
1233
+
1234
+
1235
+ @validate_call
1236
+ async def create_order_with_http_info(
1237
+ self,
1238
+ create_order_request: CreateOrderRequest,
1239
+ _request_timeout: Union[
1240
+ None,
1241
+ Annotated[StrictFloat, Field(gt=0)],
1242
+ Tuple[
1243
+ Annotated[StrictFloat, Field(gt=0)],
1244
+ Annotated[StrictFloat, Field(gt=0)]
1245
+ ]
1246
+ ] = None,
1247
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1248
+ _content_type: Optional[StrictStr] = None,
1249
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1250
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1251
+ ) -> ApiResponse[CreateOrderResponse]:
1252
+ """Create Order
1253
+
1254
+ Endpoint for submitting orders in a market. Each user is limited to 200 000 open orders at a time.
1255
+
1256
+ :param create_order_request: (required)
1257
+ :type create_order_request: CreateOrderRequest
1258
+ :param _request_timeout: timeout setting for this request. If one
1259
+ number provided, it will be total request
1260
+ timeout. It can also be a pair (tuple) of
1261
+ (connection, read) timeouts.
1262
+ :type _request_timeout: int, tuple(int, int), optional
1263
+ :param _request_auth: set to override the auth_settings for an a single
1264
+ request; this effectively ignores the
1265
+ authentication in the spec for a single request.
1266
+ :type _request_auth: dict, optional
1267
+ :param _content_type: force content-type for the request.
1268
+ :type _content_type: str, Optional
1269
+ :param _headers: set to override the headers for a single
1270
+ request; this effectively ignores the headers
1271
+ in the spec for a single request.
1272
+ :type _headers: dict, optional
1273
+ :param _host_index: set to override the host_index for a single
1274
+ request; this effectively ignores the host_index
1275
+ in the spec for a single request.
1276
+ :type _host_index: int, optional
1277
+ :return: Returns the result object.
1278
+ """ # noqa: E501
1279
+
1280
+ _param = self._create_order_serialize(
1281
+ create_order_request=create_order_request,
1282
+ _request_auth=_request_auth,
1283
+ _content_type=_content_type,
1284
+ _headers=_headers,
1285
+ _host_index=_host_index
1286
+ )
1287
+
1288
+ _response_types_map: Dict[str, Optional[str]] = {
1289
+ '201': "CreateOrderResponse",
1290
+ '400': "ErrorResponse",
1291
+ '401': "ErrorResponse",
1292
+ '409': "ErrorResponse",
1293
+ '429': "ErrorResponse",
1294
+ '500': "ErrorResponse",
1295
+ }
1296
+ response_data = await self.api_client.call_api(
1297
+ *_param,
1298
+ _request_timeout=_request_timeout
1299
+ )
1300
+ await response_data.read()
1301
+ return self.api_client.response_deserialize(
1302
+ response_data=response_data,
1303
+ response_types_map=_response_types_map,
1304
+ )
1305
+
1306
+
1307
+ @validate_call
1308
+ async def create_order_without_preload_content(
1309
+ self,
1310
+ create_order_request: CreateOrderRequest,
1311
+ _request_timeout: Union[
1312
+ None,
1313
+ Annotated[StrictFloat, Field(gt=0)],
1314
+ Tuple[
1315
+ Annotated[StrictFloat, Field(gt=0)],
1316
+ Annotated[StrictFloat, Field(gt=0)]
1317
+ ]
1318
+ ] = None,
1319
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1320
+ _content_type: Optional[StrictStr] = None,
1321
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1322
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1323
+ ) -> RESTResponseType:
1324
+ """Create Order
1325
+
1326
+ Endpoint for submitting orders in a market. Each user is limited to 200 000 open orders at a time.
1327
+
1328
+ :param create_order_request: (required)
1329
+ :type create_order_request: CreateOrderRequest
1330
+ :param _request_timeout: timeout setting for this request. If one
1331
+ number provided, it will be total request
1332
+ timeout. It can also be a pair (tuple) of
1333
+ (connection, read) timeouts.
1334
+ :type _request_timeout: int, tuple(int, int), optional
1335
+ :param _request_auth: set to override the auth_settings for an a single
1336
+ request; this effectively ignores the
1337
+ authentication in the spec for a single request.
1338
+ :type _request_auth: dict, optional
1339
+ :param _content_type: force content-type for the request.
1340
+ :type _content_type: str, Optional
1341
+ :param _headers: set to override the headers for a single
1342
+ request; this effectively ignores the headers
1343
+ in the spec for a single request.
1344
+ :type _headers: dict, optional
1345
+ :param _host_index: set to override the host_index for a single
1346
+ request; this effectively ignores the host_index
1347
+ in the spec for a single request.
1348
+ :type _host_index: int, optional
1349
+ :return: Returns the result object.
1350
+ """ # noqa: E501
1351
+
1352
+ _param = self._create_order_serialize(
1353
+ create_order_request=create_order_request,
1354
+ _request_auth=_request_auth,
1355
+ _content_type=_content_type,
1356
+ _headers=_headers,
1357
+ _host_index=_host_index
1358
+ )
1359
+
1360
+ _response_types_map: Dict[str, Optional[str]] = {
1361
+ '201': "CreateOrderResponse",
1362
+ '400': "ErrorResponse",
1363
+ '401': "ErrorResponse",
1364
+ '409': "ErrorResponse",
1365
+ '429': "ErrorResponse",
1366
+ '500': "ErrorResponse",
1367
+ }
1368
+ response_data = await self.api_client.call_api(
1369
+ *_param,
1370
+ _request_timeout=_request_timeout
1371
+ )
1372
+ return response_data.response
1373
+
1374
+
1375
+ def _create_order_serialize(
1376
+ self,
1377
+ create_order_request,
1378
+ _request_auth,
1379
+ _content_type,
1380
+ _headers,
1381
+ _host_index,
1382
+ ) -> RequestSerialized:
1383
+
1384
+ _host = None
1385
+
1386
+ _collection_formats: Dict[str, str] = {
1387
+ }
1388
+
1389
+ _path_params: Dict[str, str] = {}
1390
+ _query_params: List[Tuple[str, str]] = []
1391
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1392
+ _form_params: List[Tuple[str, str]] = []
1393
+ _files: Dict[
1394
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1395
+ ] = {}
1396
+ _body_params: Optional[bytes] = None
1397
+
1398
+ # process the path parameters
1399
+ # process the query parameters
1400
+ # process the header parameters
1401
+ # process the form parameters
1402
+ # process the body parameter
1403
+ if create_order_request is not None:
1404
+ _body_params = create_order_request
1405
+
1406
+
1407
+ # set the HTTP header `Accept`
1408
+ if 'Accept' not in _header_params:
1409
+ _header_params['Accept'] = self.api_client.select_header_accept(
1410
+ [
1411
+ 'application/json'
1412
+ ]
1413
+ )
1414
+
1415
+ # set the HTTP header `Content-Type`
1416
+ if _content_type:
1417
+ _header_params['Content-Type'] = _content_type
1418
+ else:
1419
+ _default_content_type = (
1420
+ self.api_client.select_header_content_type(
1421
+ [
1422
+ 'application/json'
1423
+ ]
1424
+ )
1425
+ )
1426
+ if _default_content_type is not None:
1427
+ _header_params['Content-Type'] = _default_content_type
1428
+
1429
+ # authentication setting
1430
+ _auth_settings: List[str] = [
1431
+ 'kalshiAccessSignature',
1432
+ 'kalshiAccessKey',
1433
+ 'kalshiAccessTimestamp'
1434
+ ]
1435
+
1436
+ return self.api_client.param_serialize(
1437
+ method='POST',
1438
+ resource_path='/portfolio/orders',
1439
+ path_params=_path_params,
1440
+ query_params=_query_params,
1441
+ header_params=_header_params,
1442
+ body=_body_params,
1443
+ post_params=_form_params,
1444
+ files=_files,
1445
+ auth_settings=_auth_settings,
1446
+ collection_formats=_collection_formats,
1447
+ _host=_host,
1448
+ _request_auth=_request_auth
1449
+ )
1450
+
1451
+
1452
+
1453
+
1454
+ @validate_call
1455
+ async def decrease_order(
1456
+ self,
1457
+ order_id: StrictStr,
1458
+ # Request body parameters as keyword arguments
1459
+ **kwargs: Any,
1460
+ ) -> DecreaseOrderResponse:
1461
+ """Decrease Order
1462
+
1463
+ Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.
1464
+
1465
+ :param order_id: Order ID (required)
1466
+ :type order_id: str
1467
+ :param decrease_order_request: (required)
1468
+ :type decrease_order_request: DecreaseOrderRequest
1469
+ :param _request_timeout: timeout setting for this request. If one
1470
+ number provided, it will be total request
1471
+ timeout. It can also be a pair (tuple) of
1472
+ (connection, read) timeouts.
1473
+ :type _request_timeout: int, tuple(int, int), optional
1474
+ :param _request_auth: set to override the auth_settings for an a single
1475
+ request; this effectively ignores the
1476
+ authentication in the spec for a single request.
1477
+ :type _request_auth: dict, optional
1478
+ :param _content_type: force content-type for the request.
1479
+ :type _content_type: str, Optional
1480
+ :param _headers: set to override the headers for a single
1481
+ request; this effectively ignores the headers
1482
+ in the spec for a single request.
1483
+ :type _headers: dict, optional
1484
+ :param _host_index: set to override the host_index for a single
1485
+ request; this effectively ignores the host_index
1486
+ in the spec for a single request.
1487
+ :type _host_index: int, optional
1488
+ :return: Returns the result object.
1489
+ """ # noqa: E501
1490
+
1491
+ # Create request object from kwargs
1492
+ decrease_order_request = DecreaseOrderRequest(**kwargs) if kwargs else None
1493
+
1494
+ _param = self._decrease_order_serialize(
1495
+ order_id=order_id,
1496
+ decrease_order_request=decrease_order_request,
1497
+ _request_auth=kwargs.get('_request_auth'),
1498
+ _content_type=kwargs.get('_content_type'),
1499
+ _headers=kwargs.get('_headers'),
1500
+ _host_index=kwargs.get('_host_index', 0)
1501
+ )
1502
+
1503
+ _response_types_map: Dict[str, Optional[str]] = {
1504
+ '200': "DecreaseOrderResponse",
1505
+ '400': "ErrorResponse",
1506
+ '401': "ErrorResponse",
1507
+ '404': "ErrorResponse",
1508
+ '500': "ErrorResponse",
1509
+ }
1510
+ response_data = await self.api_client.call_api(
1511
+ *_param,
1512
+ _request_timeout=kwargs.get('_request_timeout'),
1513
+ )
1514
+ await response_data.read()
1515
+ return self.api_client.response_deserialize(
1516
+ response_data=response_data,
1517
+ response_types_map=_response_types_map,
1518
+ ).data
1519
+
1520
+
1521
+ @validate_call
1522
+ async def decrease_order_with_http_info(
1523
+ self,
1524
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
1525
+ decrease_order_request: DecreaseOrderRequest,
1526
+ _request_timeout: Union[
1527
+ None,
1528
+ Annotated[StrictFloat, Field(gt=0)],
1529
+ Tuple[
1530
+ Annotated[StrictFloat, Field(gt=0)],
1531
+ Annotated[StrictFloat, Field(gt=0)]
1532
+ ]
1533
+ ] = None,
1534
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1535
+ _content_type: Optional[StrictStr] = None,
1536
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1537
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1538
+ ) -> ApiResponse[DecreaseOrderResponse]:
1539
+ """Decrease Order
1540
+
1541
+ Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.
1542
+
1543
+ :param order_id: Order ID (required)
1544
+ :type order_id: str
1545
+ :param decrease_order_request: (required)
1546
+ :type decrease_order_request: DecreaseOrderRequest
1547
+ :param _request_timeout: timeout setting for this request. If one
1548
+ number provided, it will be total request
1549
+ timeout. It can also be a pair (tuple) of
1550
+ (connection, read) timeouts.
1551
+ :type _request_timeout: int, tuple(int, int), optional
1552
+ :param _request_auth: set to override the auth_settings for an a single
1553
+ request; this effectively ignores the
1554
+ authentication in the spec for a single request.
1555
+ :type _request_auth: dict, optional
1556
+ :param _content_type: force content-type for the request.
1557
+ :type _content_type: str, Optional
1558
+ :param _headers: set to override the headers for a single
1559
+ request; this effectively ignores the headers
1560
+ in the spec for a single request.
1561
+ :type _headers: dict, optional
1562
+ :param _host_index: set to override the host_index for a single
1563
+ request; this effectively ignores the host_index
1564
+ in the spec for a single request.
1565
+ :type _host_index: int, optional
1566
+ :return: Returns the result object.
1567
+ """ # noqa: E501
1568
+
1569
+ _param = self._decrease_order_serialize(
1570
+ order_id=order_id,
1571
+ decrease_order_request=decrease_order_request,
1572
+ _request_auth=_request_auth,
1573
+ _content_type=_content_type,
1574
+ _headers=_headers,
1575
+ _host_index=_host_index
1576
+ )
1577
+
1578
+ _response_types_map: Dict[str, Optional[str]] = {
1579
+ '200': "DecreaseOrderResponse",
1580
+ '400': "ErrorResponse",
1581
+ '401': "ErrorResponse",
1582
+ '404': "ErrorResponse",
1583
+ '500': "ErrorResponse",
1584
+ }
1585
+ response_data = await self.api_client.call_api(
1586
+ *_param,
1587
+ _request_timeout=_request_timeout
1588
+ )
1589
+ await response_data.read()
1590
+ return self.api_client.response_deserialize(
1591
+ response_data=response_data,
1592
+ response_types_map=_response_types_map,
1593
+ )
1594
+
1595
+
1596
+ @validate_call
1597
+ async def decrease_order_without_preload_content(
1598
+ self,
1599
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
1600
+ decrease_order_request: DecreaseOrderRequest,
1601
+ _request_timeout: Union[
1602
+ None,
1603
+ Annotated[StrictFloat, Field(gt=0)],
1604
+ Tuple[
1605
+ Annotated[StrictFloat, Field(gt=0)],
1606
+ Annotated[StrictFloat, Field(gt=0)]
1607
+ ]
1608
+ ] = None,
1609
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1610
+ _content_type: Optional[StrictStr] = None,
1611
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1612
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1613
+ ) -> RESTResponseType:
1614
+ """Decrease Order
1615
+
1616
+ Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.
1617
+
1618
+ :param order_id: Order ID (required)
1619
+ :type order_id: str
1620
+ :param decrease_order_request: (required)
1621
+ :type decrease_order_request: DecreaseOrderRequest
1622
+ :param _request_timeout: timeout setting for this request. If one
1623
+ number provided, it will be total request
1624
+ timeout. It can also be a pair (tuple) of
1625
+ (connection, read) timeouts.
1626
+ :type _request_timeout: int, tuple(int, int), optional
1627
+ :param _request_auth: set to override the auth_settings for an a single
1628
+ request; this effectively ignores the
1629
+ authentication in the spec for a single request.
1630
+ :type _request_auth: dict, optional
1631
+ :param _content_type: force content-type for the request.
1632
+ :type _content_type: str, Optional
1633
+ :param _headers: set to override the headers for a single
1634
+ request; this effectively ignores the headers
1635
+ in the spec for a single request.
1636
+ :type _headers: dict, optional
1637
+ :param _host_index: set to override the host_index for a single
1638
+ request; this effectively ignores the host_index
1639
+ in the spec for a single request.
1640
+ :type _host_index: int, optional
1641
+ :return: Returns the result object.
1642
+ """ # noqa: E501
1643
+
1644
+ _param = self._decrease_order_serialize(
1645
+ order_id=order_id,
1646
+ decrease_order_request=decrease_order_request,
1647
+ _request_auth=_request_auth,
1648
+ _content_type=_content_type,
1649
+ _headers=_headers,
1650
+ _host_index=_host_index
1651
+ )
1652
+
1653
+ _response_types_map: Dict[str, Optional[str]] = {
1654
+ '200': "DecreaseOrderResponse",
1655
+ '400': "ErrorResponse",
1656
+ '401': "ErrorResponse",
1657
+ '404': "ErrorResponse",
1658
+ '500': "ErrorResponse",
1659
+ }
1660
+ response_data = await self.api_client.call_api(
1661
+ *_param,
1662
+ _request_timeout=_request_timeout
1663
+ )
1664
+ return response_data.response
1665
+
1666
+
1667
+ def _decrease_order_serialize(
1668
+ self,
1669
+ order_id,
1670
+ decrease_order_request,
1671
+ _request_auth,
1672
+ _content_type,
1673
+ _headers,
1674
+ _host_index,
1675
+ ) -> RequestSerialized:
1676
+
1677
+ _host = None
1678
+
1679
+ _collection_formats: Dict[str, str] = {
1680
+ }
1681
+
1682
+ _path_params: Dict[str, str] = {}
1683
+ _query_params: List[Tuple[str, str]] = []
1684
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1685
+ _form_params: List[Tuple[str, str]] = []
1686
+ _files: Dict[
1687
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1688
+ ] = {}
1689
+ _body_params: Optional[bytes] = None
1690
+
1691
+ # process the path parameters
1692
+ if order_id is not None:
1693
+ _path_params['order_id'] = order_id
1694
+ # process the query parameters
1695
+ # process the header parameters
1696
+ # process the form parameters
1697
+ # process the body parameter
1698
+ if decrease_order_request is not None:
1699
+ _body_params = decrease_order_request
1700
+
1701
+
1702
+ # set the HTTP header `Accept`
1703
+ if 'Accept' not in _header_params:
1704
+ _header_params['Accept'] = self.api_client.select_header_accept(
1705
+ [
1706
+ 'application/json'
1707
+ ]
1708
+ )
1709
+
1710
+ # set the HTTP header `Content-Type`
1711
+ if _content_type:
1712
+ _header_params['Content-Type'] = _content_type
1713
+ else:
1714
+ _default_content_type = (
1715
+ self.api_client.select_header_content_type(
1716
+ [
1717
+ 'application/json'
1718
+ ]
1719
+ )
1720
+ )
1721
+ if _default_content_type is not None:
1722
+ _header_params['Content-Type'] = _default_content_type
1723
+
1724
+ # authentication setting
1725
+ _auth_settings: List[str] = [
1726
+ 'kalshiAccessSignature',
1727
+ 'kalshiAccessKey',
1728
+ 'kalshiAccessTimestamp'
1729
+ ]
1730
+
1731
+ return self.api_client.param_serialize(
1732
+ method='POST',
1733
+ resource_path='/portfolio/orders/{order_id}/decrease',
1734
+ path_params=_path_params,
1735
+ query_params=_query_params,
1736
+ header_params=_header_params,
1737
+ body=_body_params,
1738
+ post_params=_form_params,
1739
+ files=_files,
1740
+ auth_settings=_auth_settings,
1741
+ collection_formats=_collection_formats,
1742
+ _host=_host,
1743
+ _request_auth=_request_auth
1744
+ )
1745
+
1746
+
1747
+
1748
+
1749
+ @validate_call
1750
+ async def get_order(
1751
+ self,
1752
+ order_id: StrictStr,
1753
+ ) -> GetOrderResponse:
1754
+ """Get Order
1755
+
1756
+ Endpoint for getting a single order.
1757
+
1758
+ :param order_id: Order ID (required)
1759
+ :type order_id: str
1760
+ :param _request_timeout: timeout setting for this request. If one
1761
+ number provided, it will be total request
1762
+ timeout. It can also be a pair (tuple) of
1763
+ (connection, read) timeouts.
1764
+ :type _request_timeout: int, tuple(int, int), optional
1765
+ :param _request_auth: set to override the auth_settings for an a single
1766
+ request; this effectively ignores the
1767
+ authentication in the spec for a single request.
1768
+ :type _request_auth: dict, optional
1769
+ :param _content_type: force content-type for the request.
1770
+ :type _content_type: str, Optional
1771
+ :param _headers: set to override the headers for a single
1772
+ request; this effectively ignores the headers
1773
+ in the spec for a single request.
1774
+ :type _headers: dict, optional
1775
+ :param _host_index: set to override the host_index for a single
1776
+ request; this effectively ignores the host_index
1777
+ in the spec for a single request.
1778
+ :type _host_index: int, optional
1779
+ :return: Returns the result object.
1780
+ """ # noqa: E501
1781
+
1782
+
1783
+ _param = self._get_order_serialize(
1784
+ order_id=order_id,
1785
+ _request_auth=None,
1786
+ _content_type=None,
1787
+ _headers=None,
1788
+ _host_index=0
1789
+ )
1790
+
1791
+ _response_types_map: Dict[str, Optional[str]] = {
1792
+ '200': "GetOrderResponse",
1793
+ '401': "ErrorResponse",
1794
+ '404': "ErrorResponse",
1795
+ '500': "ErrorResponse",
1796
+ }
1797
+ response_data = await self.api_client.call_api(
1798
+ *_param,
1799
+ _request_timeout=None,
1800
+ )
1801
+ await response_data.read()
1802
+ return self.api_client.response_deserialize(
1803
+ response_data=response_data,
1804
+ response_types_map=_response_types_map,
1805
+ ).data
1806
+
1807
+
1808
+ @validate_call
1809
+ async def get_order_with_http_info(
1810
+ self,
1811
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
1812
+ _request_timeout: Union[
1813
+ None,
1814
+ Annotated[StrictFloat, Field(gt=0)],
1815
+ Tuple[
1816
+ Annotated[StrictFloat, Field(gt=0)],
1817
+ Annotated[StrictFloat, Field(gt=0)]
1818
+ ]
1819
+ ] = None,
1820
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1821
+ _content_type: Optional[StrictStr] = None,
1822
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1823
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1824
+ ) -> ApiResponse[GetOrderResponse]:
1825
+ """Get Order
1826
+
1827
+ Endpoint for getting a single order.
1828
+
1829
+ :param order_id: Order ID (required)
1830
+ :type order_id: str
1831
+ :param _request_timeout: timeout setting for this request. If one
1832
+ number provided, it will be total request
1833
+ timeout. It can also be a pair (tuple) of
1834
+ (connection, read) timeouts.
1835
+ :type _request_timeout: int, tuple(int, int), optional
1836
+ :param _request_auth: set to override the auth_settings for an a single
1837
+ request; this effectively ignores the
1838
+ authentication in the spec for a single request.
1839
+ :type _request_auth: dict, optional
1840
+ :param _content_type: force content-type for the request.
1841
+ :type _content_type: str, Optional
1842
+ :param _headers: set to override the headers for a single
1843
+ request; this effectively ignores the headers
1844
+ in the spec for a single request.
1845
+ :type _headers: dict, optional
1846
+ :param _host_index: set to override the host_index for a single
1847
+ request; this effectively ignores the host_index
1848
+ in the spec for a single request.
1849
+ :type _host_index: int, optional
1850
+ :return: Returns the result object.
1851
+ """ # noqa: E501
1852
+
1853
+ _param = self._get_order_serialize(
1854
+ order_id=order_id,
1855
+ _request_auth=_request_auth,
1856
+ _content_type=_content_type,
1857
+ _headers=_headers,
1858
+ _host_index=_host_index
1859
+ )
1860
+
1861
+ _response_types_map: Dict[str, Optional[str]] = {
1862
+ '200': "GetOrderResponse",
1863
+ '401': "ErrorResponse",
1864
+ '404': "ErrorResponse",
1865
+ '500': "ErrorResponse",
1866
+ }
1867
+ response_data = await self.api_client.call_api(
1868
+ *_param,
1869
+ _request_timeout=_request_timeout
1870
+ )
1871
+ await response_data.read()
1872
+ return self.api_client.response_deserialize(
1873
+ response_data=response_data,
1874
+ response_types_map=_response_types_map,
1875
+ )
1876
+
1877
+
1878
+ @validate_call
1879
+ async def get_order_without_preload_content(
1880
+ self,
1881
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
1882
+ _request_timeout: Union[
1883
+ None,
1884
+ Annotated[StrictFloat, Field(gt=0)],
1885
+ Tuple[
1886
+ Annotated[StrictFloat, Field(gt=0)],
1887
+ Annotated[StrictFloat, Field(gt=0)]
1888
+ ]
1889
+ ] = None,
1890
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1891
+ _content_type: Optional[StrictStr] = None,
1892
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1893
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1894
+ ) -> RESTResponseType:
1895
+ """Get Order
1896
+
1897
+ Endpoint for getting a single order.
1898
+
1899
+ :param order_id: Order ID (required)
1900
+ :type order_id: str
1901
+ :param _request_timeout: timeout setting for this request. If one
1902
+ number provided, it will be total request
1903
+ timeout. It can also be a pair (tuple) of
1904
+ (connection, read) timeouts.
1905
+ :type _request_timeout: int, tuple(int, int), optional
1906
+ :param _request_auth: set to override the auth_settings for an a single
1907
+ request; this effectively ignores the
1908
+ authentication in the spec for a single request.
1909
+ :type _request_auth: dict, optional
1910
+ :param _content_type: force content-type for the request.
1911
+ :type _content_type: str, Optional
1912
+ :param _headers: set to override the headers for a single
1913
+ request; this effectively ignores the headers
1914
+ in the spec for a single request.
1915
+ :type _headers: dict, optional
1916
+ :param _host_index: set to override the host_index for a single
1917
+ request; this effectively ignores the host_index
1918
+ in the spec for a single request.
1919
+ :type _host_index: int, optional
1920
+ :return: Returns the result object.
1921
+ """ # noqa: E501
1922
+
1923
+ _param = self._get_order_serialize(
1924
+ order_id=order_id,
1925
+ _request_auth=_request_auth,
1926
+ _content_type=_content_type,
1927
+ _headers=_headers,
1928
+ _host_index=_host_index
1929
+ )
1930
+
1931
+ _response_types_map: Dict[str, Optional[str]] = {
1932
+ '200': "GetOrderResponse",
1933
+ '401': "ErrorResponse",
1934
+ '404': "ErrorResponse",
1935
+ '500': "ErrorResponse",
1936
+ }
1937
+ response_data = await self.api_client.call_api(
1938
+ *_param,
1939
+ _request_timeout=_request_timeout
1940
+ )
1941
+ return response_data.response
1942
+
1943
+
1944
+ def _get_order_serialize(
1945
+ self,
1946
+ order_id,
1947
+ _request_auth,
1948
+ _content_type,
1949
+ _headers,
1950
+ _host_index,
1951
+ ) -> RequestSerialized:
1952
+
1953
+ _host = None
1954
+
1955
+ _collection_formats: Dict[str, str] = {
1956
+ }
1957
+
1958
+ _path_params: Dict[str, str] = {}
1959
+ _query_params: List[Tuple[str, str]] = []
1960
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1961
+ _form_params: List[Tuple[str, str]] = []
1962
+ _files: Dict[
1963
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1964
+ ] = {}
1965
+ _body_params: Optional[bytes] = None
1966
+
1967
+ # process the path parameters
1968
+ if order_id is not None:
1969
+ _path_params['order_id'] = order_id
1970
+ # process the query parameters
1971
+ # process the header parameters
1972
+ # process the form parameters
1973
+ # process the body parameter
1974
+
1975
+
1976
+ # set the HTTP header `Accept`
1977
+ if 'Accept' not in _header_params:
1978
+ _header_params['Accept'] = self.api_client.select_header_accept(
1979
+ [
1980
+ 'application/json'
1981
+ ]
1982
+ )
1983
+
1984
+
1985
+ # authentication setting
1986
+ _auth_settings: List[str] = [
1987
+ 'kalshiAccessSignature',
1988
+ 'kalshiAccessKey',
1989
+ 'kalshiAccessTimestamp'
1990
+ ]
1991
+
1992
+ return self.api_client.param_serialize(
1993
+ method='GET',
1994
+ resource_path='/portfolio/orders/{order_id}',
1995
+ path_params=_path_params,
1996
+ query_params=_query_params,
1997
+ header_params=_header_params,
1998
+ body=_body_params,
1999
+ post_params=_form_params,
2000
+ files=_files,
2001
+ auth_settings=_auth_settings,
2002
+ collection_formats=_collection_formats,
2003
+ _host=_host,
2004
+ _request_auth=_request_auth
2005
+ )
2006
+
2007
+
2008
+
2009
+
2010
+ @validate_call
2011
+ async def get_order_queue_position(
2012
+ self,
2013
+ order_id: StrictStr,
2014
+ ) -> GetOrderQueuePositionResponse:
2015
+ """Get Order Queue Position
2016
+
2017
+ Endpoint for getting an order's queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.
2018
+
2019
+ :param order_id: Order ID (required)
2020
+ :type order_id: str
2021
+ :param _request_timeout: timeout setting for this request. If one
2022
+ number provided, it will be total request
2023
+ timeout. It can also be a pair (tuple) of
2024
+ (connection, read) timeouts.
2025
+ :type _request_timeout: int, tuple(int, int), optional
2026
+ :param _request_auth: set to override the auth_settings for an a single
2027
+ request; this effectively ignores the
2028
+ authentication in the spec for a single request.
2029
+ :type _request_auth: dict, optional
2030
+ :param _content_type: force content-type for the request.
2031
+ :type _content_type: str, Optional
2032
+ :param _headers: set to override the headers for a single
2033
+ request; this effectively ignores the headers
2034
+ in the spec for a single request.
2035
+ :type _headers: dict, optional
2036
+ :param _host_index: set to override the host_index for a single
2037
+ request; this effectively ignores the host_index
2038
+ in the spec for a single request.
2039
+ :type _host_index: int, optional
2040
+ :return: Returns the result object.
2041
+ """ # noqa: E501
2042
+
2043
+
2044
+ _param = self._get_order_queue_position_serialize(
2045
+ order_id=order_id,
2046
+ _request_auth=None,
2047
+ _content_type=None,
2048
+ _headers=None,
2049
+ _host_index=0
2050
+ )
2051
+
2052
+ _response_types_map: Dict[str, Optional[str]] = {
2053
+ '200': "GetOrderQueuePositionResponse",
2054
+ '401': "ErrorResponse",
2055
+ '404': "ErrorResponse",
2056
+ '500': "ErrorResponse",
2057
+ }
2058
+ response_data = await self.api_client.call_api(
2059
+ *_param,
2060
+ _request_timeout=None,
2061
+ )
2062
+ await response_data.read()
2063
+ return self.api_client.response_deserialize(
2064
+ response_data=response_data,
2065
+ response_types_map=_response_types_map,
2066
+ ).data
2067
+
2068
+
2069
+ @validate_call
2070
+ async def get_order_queue_position_with_http_info(
2071
+ self,
2072
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
2073
+ _request_timeout: Union[
2074
+ None,
2075
+ Annotated[StrictFloat, Field(gt=0)],
2076
+ Tuple[
2077
+ Annotated[StrictFloat, Field(gt=0)],
2078
+ Annotated[StrictFloat, Field(gt=0)]
2079
+ ]
2080
+ ] = None,
2081
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2082
+ _content_type: Optional[StrictStr] = None,
2083
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2084
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2085
+ ) -> ApiResponse[GetOrderQueuePositionResponse]:
2086
+ """Get Order Queue Position
2087
+
2088
+ Endpoint for getting an order's queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.
2089
+
2090
+ :param order_id: Order ID (required)
2091
+ :type order_id: str
2092
+ :param _request_timeout: timeout setting for this request. If one
2093
+ number provided, it will be total request
2094
+ timeout. It can also be a pair (tuple) of
2095
+ (connection, read) timeouts.
2096
+ :type _request_timeout: int, tuple(int, int), optional
2097
+ :param _request_auth: set to override the auth_settings for an a single
2098
+ request; this effectively ignores the
2099
+ authentication in the spec for a single request.
2100
+ :type _request_auth: dict, optional
2101
+ :param _content_type: force content-type for the request.
2102
+ :type _content_type: str, Optional
2103
+ :param _headers: set to override the headers for a single
2104
+ request; this effectively ignores the headers
2105
+ in the spec for a single request.
2106
+ :type _headers: dict, optional
2107
+ :param _host_index: set to override the host_index for a single
2108
+ request; this effectively ignores the host_index
2109
+ in the spec for a single request.
2110
+ :type _host_index: int, optional
2111
+ :return: Returns the result object.
2112
+ """ # noqa: E501
2113
+
2114
+ _param = self._get_order_queue_position_serialize(
2115
+ order_id=order_id,
2116
+ _request_auth=_request_auth,
2117
+ _content_type=_content_type,
2118
+ _headers=_headers,
2119
+ _host_index=_host_index
2120
+ )
2121
+
2122
+ _response_types_map: Dict[str, Optional[str]] = {
2123
+ '200': "GetOrderQueuePositionResponse",
2124
+ '401': "ErrorResponse",
2125
+ '404': "ErrorResponse",
2126
+ '500': "ErrorResponse",
2127
+ }
2128
+ response_data = await self.api_client.call_api(
2129
+ *_param,
2130
+ _request_timeout=_request_timeout
2131
+ )
2132
+ await response_data.read()
2133
+ return self.api_client.response_deserialize(
2134
+ response_data=response_data,
2135
+ response_types_map=_response_types_map,
2136
+ )
2137
+
2138
+
2139
+ @validate_call
2140
+ async def get_order_queue_position_without_preload_content(
2141
+ self,
2142
+ order_id: Annotated[StrictStr, Field(description="Order ID")],
2143
+ _request_timeout: Union[
2144
+ None,
2145
+ Annotated[StrictFloat, Field(gt=0)],
2146
+ Tuple[
2147
+ Annotated[StrictFloat, Field(gt=0)],
2148
+ Annotated[StrictFloat, Field(gt=0)]
2149
+ ]
2150
+ ] = None,
2151
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2152
+ _content_type: Optional[StrictStr] = None,
2153
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2154
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2155
+ ) -> RESTResponseType:
2156
+ """Get Order Queue Position
2157
+
2158
+ Endpoint for getting an order's queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.
2159
+
2160
+ :param order_id: Order ID (required)
2161
+ :type order_id: str
2162
+ :param _request_timeout: timeout setting for this request. If one
2163
+ number provided, it will be total request
2164
+ timeout. It can also be a pair (tuple) of
2165
+ (connection, read) timeouts.
2166
+ :type _request_timeout: int, tuple(int, int), optional
2167
+ :param _request_auth: set to override the auth_settings for an a single
2168
+ request; this effectively ignores the
2169
+ authentication in the spec for a single request.
2170
+ :type _request_auth: dict, optional
2171
+ :param _content_type: force content-type for the request.
2172
+ :type _content_type: str, Optional
2173
+ :param _headers: set to override the headers for a single
2174
+ request; this effectively ignores the headers
2175
+ in the spec for a single request.
2176
+ :type _headers: dict, optional
2177
+ :param _host_index: set to override the host_index for a single
2178
+ request; this effectively ignores the host_index
2179
+ in the spec for a single request.
2180
+ :type _host_index: int, optional
2181
+ :return: Returns the result object.
2182
+ """ # noqa: E501
2183
+
2184
+ _param = self._get_order_queue_position_serialize(
2185
+ order_id=order_id,
2186
+ _request_auth=_request_auth,
2187
+ _content_type=_content_type,
2188
+ _headers=_headers,
2189
+ _host_index=_host_index
2190
+ )
2191
+
2192
+ _response_types_map: Dict[str, Optional[str]] = {
2193
+ '200': "GetOrderQueuePositionResponse",
2194
+ '401': "ErrorResponse",
2195
+ '404': "ErrorResponse",
2196
+ '500': "ErrorResponse",
2197
+ }
2198
+ response_data = await self.api_client.call_api(
2199
+ *_param,
2200
+ _request_timeout=_request_timeout
2201
+ )
2202
+ return response_data.response
2203
+
2204
+
2205
+ def _get_order_queue_position_serialize(
2206
+ self,
2207
+ order_id,
2208
+ _request_auth,
2209
+ _content_type,
2210
+ _headers,
2211
+ _host_index,
2212
+ ) -> RequestSerialized:
2213
+
2214
+ _host = None
2215
+
2216
+ _collection_formats: Dict[str, str] = {
2217
+ }
2218
+
2219
+ _path_params: Dict[str, str] = {}
2220
+ _query_params: List[Tuple[str, str]] = []
2221
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2222
+ _form_params: List[Tuple[str, str]] = []
2223
+ _files: Dict[
2224
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2225
+ ] = {}
2226
+ _body_params: Optional[bytes] = None
2227
+
2228
+ # process the path parameters
2229
+ if order_id is not None:
2230
+ _path_params['order_id'] = order_id
2231
+ # process the query parameters
2232
+ # process the header parameters
2233
+ # process the form parameters
2234
+ # process the body parameter
2235
+
2236
+
2237
+ # set the HTTP header `Accept`
2238
+ if 'Accept' not in _header_params:
2239
+ _header_params['Accept'] = self.api_client.select_header_accept(
2240
+ [
2241
+ 'application/json'
2242
+ ]
2243
+ )
2244
+
2245
+
2246
+ # authentication setting
2247
+ _auth_settings: List[str] = [
2248
+ 'kalshiAccessSignature',
2249
+ 'kalshiAccessKey',
2250
+ 'kalshiAccessTimestamp'
2251
+ ]
2252
+
2253
+ return self.api_client.param_serialize(
2254
+ method='GET',
2255
+ resource_path='/portfolio/orders/{order_id}/queue_position',
2256
+ path_params=_path_params,
2257
+ query_params=_query_params,
2258
+ header_params=_header_params,
2259
+ body=_body_params,
2260
+ post_params=_form_params,
2261
+ files=_files,
2262
+ auth_settings=_auth_settings,
2263
+ collection_formats=_collection_formats,
2264
+ _host=_host,
2265
+ _request_auth=_request_auth
2266
+ )
2267
+
2268
+
2269
+
2270
+
2271
+ @validate_call
2272
+ async def get_order_queue_positions(
2273
+ self,
2274
+ market_tickers: Any = None,
2275
+ event_ticker: Any = None,
2276
+ ) -> GetOrderQueuePositionsResponse:
2277
+ """Get Queue Positions for Orders
2278
+
2279
+ Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.
2280
+
2281
+ :param market_tickers: Comma-separated list of market tickers to filter by
2282
+ :type market_tickers: str
2283
+ :param event_ticker: Event ticker to filter by
2284
+ :type event_ticker: str
2285
+ :param _request_timeout: timeout setting for this request. If one
2286
+ number provided, it will be total request
2287
+ timeout. It can also be a pair (tuple) of
2288
+ (connection, read) timeouts.
2289
+ :type _request_timeout: int, tuple(int, int), optional
2290
+ :param _request_auth: set to override the auth_settings for an a single
2291
+ request; this effectively ignores the
2292
+ authentication in the spec for a single request.
2293
+ :type _request_auth: dict, optional
2294
+ :param _content_type: force content-type for the request.
2295
+ :type _content_type: str, Optional
2296
+ :param _headers: set to override the headers for a single
2297
+ request; this effectively ignores the headers
2298
+ in the spec for a single request.
2299
+ :type _headers: dict, optional
2300
+ :param _host_index: set to override the host_index for a single
2301
+ request; this effectively ignores the host_index
2302
+ in the spec for a single request.
2303
+ :type _host_index: int, optional
2304
+ :return: Returns the result object.
2305
+ """ # noqa: E501
2306
+
2307
+
2308
+ _param = self._get_order_queue_positions_serialize(
2309
+ market_tickers=market_tickers,
2310
+ event_ticker=event_ticker,
2311
+ _request_auth=None,
2312
+ _content_type=None,
2313
+ _headers=None,
2314
+ _host_index=0
2315
+ )
2316
+
2317
+ _response_types_map: Dict[str, Optional[str]] = {
2318
+ '200': "GetOrderQueuePositionsResponse",
2319
+ '400': "ErrorResponse",
2320
+ '401': "ErrorResponse",
2321
+ '500': "ErrorResponse",
2322
+ }
2323
+ response_data = await self.api_client.call_api(
2324
+ *_param,
2325
+ _request_timeout=None,
2326
+ )
2327
+ await response_data.read()
2328
+ return self.api_client.response_deserialize(
2329
+ response_data=response_data,
2330
+ response_types_map=_response_types_map,
2331
+ ).data
2332
+
2333
+
2334
+ @validate_call
2335
+ async def get_order_queue_positions_with_http_info(
2336
+ self,
2337
+ market_tickers: Annotated[Optional[StrictStr], Field(description="Comma-separated list of market tickers to filter by")] = None,
2338
+ event_ticker: Annotated[Optional[StrictStr], Field(description="Event ticker to filter by")] = None,
2339
+ _request_timeout: Union[
2340
+ None,
2341
+ Annotated[StrictFloat, Field(gt=0)],
2342
+ Tuple[
2343
+ Annotated[StrictFloat, Field(gt=0)],
2344
+ Annotated[StrictFloat, Field(gt=0)]
2345
+ ]
2346
+ ] = None,
2347
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2348
+ _content_type: Optional[StrictStr] = None,
2349
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2350
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2351
+ ) -> ApiResponse[GetOrderQueuePositionsResponse]:
2352
+ """Get Queue Positions for Orders
2353
+
2354
+ Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.
2355
+
2356
+ :param market_tickers: Comma-separated list of market tickers to filter by
2357
+ :type market_tickers: str
2358
+ :param event_ticker: Event ticker to filter by
2359
+ :type event_ticker: str
2360
+ :param _request_timeout: timeout setting for this request. If one
2361
+ number provided, it will be total request
2362
+ timeout. It can also be a pair (tuple) of
2363
+ (connection, read) timeouts.
2364
+ :type _request_timeout: int, tuple(int, int), optional
2365
+ :param _request_auth: set to override the auth_settings for an a single
2366
+ request; this effectively ignores the
2367
+ authentication in the spec for a single request.
2368
+ :type _request_auth: dict, optional
2369
+ :param _content_type: force content-type for the request.
2370
+ :type _content_type: str, Optional
2371
+ :param _headers: set to override the headers for a single
2372
+ request; this effectively ignores the headers
2373
+ in the spec for a single request.
2374
+ :type _headers: dict, optional
2375
+ :param _host_index: set to override the host_index for a single
2376
+ request; this effectively ignores the host_index
2377
+ in the spec for a single request.
2378
+ :type _host_index: int, optional
2379
+ :return: Returns the result object.
2380
+ """ # noqa: E501
2381
+
2382
+ _param = self._get_order_queue_positions_serialize(
2383
+ market_tickers=market_tickers,
2384
+ event_ticker=event_ticker,
2385
+ _request_auth=_request_auth,
2386
+ _content_type=_content_type,
2387
+ _headers=_headers,
2388
+ _host_index=_host_index
2389
+ )
2390
+
2391
+ _response_types_map: Dict[str, Optional[str]] = {
2392
+ '200': "GetOrderQueuePositionsResponse",
2393
+ '400': "ErrorResponse",
2394
+ '401': "ErrorResponse",
2395
+ '500': "ErrorResponse",
2396
+ }
2397
+ response_data = await self.api_client.call_api(
2398
+ *_param,
2399
+ _request_timeout=_request_timeout
2400
+ )
2401
+ await response_data.read()
2402
+ return self.api_client.response_deserialize(
2403
+ response_data=response_data,
2404
+ response_types_map=_response_types_map,
2405
+ )
2406
+
2407
+
2408
+ @validate_call
2409
+ async def get_order_queue_positions_without_preload_content(
2410
+ self,
2411
+ market_tickers: Annotated[Optional[StrictStr], Field(description="Comma-separated list of market tickers to filter by")] = None,
2412
+ event_ticker: Annotated[Optional[StrictStr], Field(description="Event ticker to filter by")] = None,
2413
+ _request_timeout: Union[
2414
+ None,
2415
+ Annotated[StrictFloat, Field(gt=0)],
2416
+ Tuple[
2417
+ Annotated[StrictFloat, Field(gt=0)],
2418
+ Annotated[StrictFloat, Field(gt=0)]
2419
+ ]
2420
+ ] = None,
2421
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2422
+ _content_type: Optional[StrictStr] = None,
2423
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2424
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2425
+ ) -> RESTResponseType:
2426
+ """Get Queue Positions for Orders
2427
+
2428
+ Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.
2429
+
2430
+ :param market_tickers: Comma-separated list of market tickers to filter by
2431
+ :type market_tickers: str
2432
+ :param event_ticker: Event ticker to filter by
2433
+ :type event_ticker: str
2434
+ :param _request_timeout: timeout setting for this request. If one
2435
+ number provided, it will be total request
2436
+ timeout. It can also be a pair (tuple) of
2437
+ (connection, read) timeouts.
2438
+ :type _request_timeout: int, tuple(int, int), optional
2439
+ :param _request_auth: set to override the auth_settings for an a single
2440
+ request; this effectively ignores the
2441
+ authentication in the spec for a single request.
2442
+ :type _request_auth: dict, optional
2443
+ :param _content_type: force content-type for the request.
2444
+ :type _content_type: str, Optional
2445
+ :param _headers: set to override the headers for a single
2446
+ request; this effectively ignores the headers
2447
+ in the spec for a single request.
2448
+ :type _headers: dict, optional
2449
+ :param _host_index: set to override the host_index for a single
2450
+ request; this effectively ignores the host_index
2451
+ in the spec for a single request.
2452
+ :type _host_index: int, optional
2453
+ :return: Returns the result object.
2454
+ """ # noqa: E501
2455
+
2456
+ _param = self._get_order_queue_positions_serialize(
2457
+ market_tickers=market_tickers,
2458
+ event_ticker=event_ticker,
2459
+ _request_auth=_request_auth,
2460
+ _content_type=_content_type,
2461
+ _headers=_headers,
2462
+ _host_index=_host_index
2463
+ )
2464
+
2465
+ _response_types_map: Dict[str, Optional[str]] = {
2466
+ '200': "GetOrderQueuePositionsResponse",
2467
+ '400': "ErrorResponse",
2468
+ '401': "ErrorResponse",
2469
+ '500': "ErrorResponse",
2470
+ }
2471
+ response_data = await self.api_client.call_api(
2472
+ *_param,
2473
+ _request_timeout=_request_timeout
2474
+ )
2475
+ return response_data.response
2476
+
2477
+
2478
+ def _get_order_queue_positions_serialize(
2479
+ self,
2480
+ market_tickers,
2481
+ event_ticker,
2482
+ _request_auth,
2483
+ _content_type,
2484
+ _headers,
2485
+ _host_index,
2486
+ ) -> RequestSerialized:
2487
+
2488
+ _host = None
2489
+
2490
+ _collection_formats: Dict[str, str] = {
2491
+ }
2492
+
2493
+ _path_params: Dict[str, str] = {}
2494
+ _query_params: List[Tuple[str, str]] = []
2495
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2496
+ _form_params: List[Tuple[str, str]] = []
2497
+ _files: Dict[
2498
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2499
+ ] = {}
2500
+ _body_params: Optional[bytes] = None
2501
+
2502
+ # process the path parameters
2503
+ # process the query parameters
2504
+ if market_tickers is not None:
2505
+
2506
+ _query_params.append(('market_tickers', market_tickers))
2507
+
2508
+ if event_ticker is not None:
2509
+
2510
+ _query_params.append(('event_ticker', event_ticker))
2511
+
2512
+ # process the header parameters
2513
+ # process the form parameters
2514
+ # process the body parameter
2515
+
2516
+
2517
+ # set the HTTP header `Accept`
2518
+ if 'Accept' not in _header_params:
2519
+ _header_params['Accept'] = self.api_client.select_header_accept(
2520
+ [
2521
+ 'application/json'
2522
+ ]
2523
+ )
2524
+
2525
+
2526
+ # authentication setting
2527
+ _auth_settings: List[str] = [
2528
+ 'kalshiAccessSignature',
2529
+ 'kalshiAccessKey',
2530
+ 'kalshiAccessTimestamp'
2531
+ ]
2532
+
2533
+ return self.api_client.param_serialize(
2534
+ method='GET',
2535
+ resource_path='/portfolio/orders/queue_positions',
2536
+ path_params=_path_params,
2537
+ query_params=_query_params,
2538
+ header_params=_header_params,
2539
+ body=_body_params,
2540
+ post_params=_form_params,
2541
+ files=_files,
2542
+ auth_settings=_auth_settings,
2543
+ collection_formats=_collection_formats,
2544
+ _host=_host,
2545
+ _request_auth=_request_auth
2546
+ )
2547
+
2548
+
2549
+
2550
+
2551
+ @validate_call
2552
+ async def get_orders(
2553
+ self,
2554
+ ticker: Any = None,
2555
+ event_ticker: Any = None,
2556
+ min_ts: Any = None,
2557
+ max_ts: Any = None,
2558
+ status: Any = None,
2559
+ limit: Any = None,
2560
+ cursor: Any = None,
2561
+ ) -> GetOrdersResponse:
2562
+ """Get Orders
2563
+
2564
+ Restricts the response to orders that have a certain status: resting, canceled, or executed.
2565
+
2566
+ :param ticker: Filter by market ticker
2567
+ :type ticker: str
2568
+ :param event_ticker: Event ticker of desired positions. Multiple event tickers can be provided as a comma-separated list (maximum 10).
2569
+ :type event_ticker: str
2570
+ :param min_ts: Filter items after this Unix timestamp
2571
+ :type min_ts: int
2572
+ :param max_ts: Filter items before this Unix timestamp
2573
+ :type max_ts: int
2574
+ :param status: Filter by status. Possible values depend on the endpoint.
2575
+ :type status: str
2576
+ :param limit: Number of results per page. Defaults to 100. Maximum value is 200.
2577
+ :type limit: int
2578
+ :param 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.
2579
+ :type cursor: str
2580
+ :param _request_timeout: timeout setting for this request. If one
2581
+ number provided, it will be total request
2582
+ timeout. It can also be a pair (tuple) of
2583
+ (connection, read) timeouts.
2584
+ :type _request_timeout: int, tuple(int, int), optional
2585
+ :param _request_auth: set to override the auth_settings for an a single
2586
+ request; this effectively ignores the
2587
+ authentication in the spec for a single request.
2588
+ :type _request_auth: dict, optional
2589
+ :param _content_type: force content-type for the request.
2590
+ :type _content_type: str, Optional
2591
+ :param _headers: set to override the headers for a single
2592
+ request; this effectively ignores the headers
2593
+ in the spec for a single request.
2594
+ :type _headers: dict, optional
2595
+ :param _host_index: set to override the host_index for a single
2596
+ request; this effectively ignores the host_index
2597
+ in the spec for a single request.
2598
+ :type _host_index: int, optional
2599
+ :return: Returns the result object.
2600
+ """ # noqa: E501
2601
+
2602
+
2603
+ _param = self._get_orders_serialize(
2604
+ ticker=ticker,
2605
+ event_ticker=event_ticker,
2606
+ min_ts=min_ts,
2607
+ max_ts=max_ts,
2608
+ status=status,
2609
+ limit=limit,
2610
+ cursor=cursor,
2611
+ _request_auth=None,
2612
+ _content_type=None,
2613
+ _headers=None,
2614
+ _host_index=0
2615
+ )
2616
+
2617
+ _response_types_map: Dict[str, Optional[str]] = {
2618
+ '200': "GetOrdersResponse",
2619
+ '400': "ErrorResponse",
2620
+ '401': "ErrorResponse",
2621
+ '500': "ErrorResponse",
2622
+ }
2623
+ response_data = await self.api_client.call_api(
2624
+ *_param,
2625
+ _request_timeout=None,
2626
+ )
2627
+ await response_data.read()
2628
+ return self.api_client.response_deserialize(
2629
+ response_data=response_data,
2630
+ response_types_map=_response_types_map,
2631
+ ).data
2632
+
2633
+
2634
+ @validate_call
2635
+ async def get_orders_with_http_info(
2636
+ self,
2637
+ ticker: Annotated[Optional[StrictStr], Field(description="Filter by market ticker")] = None,
2638
+ event_ticker: Annotated[Optional[StrictStr], Field(description="Event ticker of desired positions. Multiple event tickers can be provided as a comma-separated list (maximum 10).")] = None,
2639
+ min_ts: Annotated[Optional[StrictInt], Field(description="Filter items after this Unix timestamp")] = None,
2640
+ max_ts: Annotated[Optional[StrictInt], Field(description="Filter items before this Unix timestamp")] = None,
2641
+ status: Annotated[Optional[StrictStr], Field(description="Filter by status. Possible values depend on the endpoint.")] = None,
2642
+ limit: Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=1)]], Field(description="Number of results per page. Defaults to 100. Maximum value is 200.")] = None,
2643
+ cursor: Annotated[Optional[StrictStr], Field(description="Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.")] = None,
2644
+ _request_timeout: Union[
2645
+ None,
2646
+ Annotated[StrictFloat, Field(gt=0)],
2647
+ Tuple[
2648
+ Annotated[StrictFloat, Field(gt=0)],
2649
+ Annotated[StrictFloat, Field(gt=0)]
2650
+ ]
2651
+ ] = None,
2652
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2653
+ _content_type: Optional[StrictStr] = None,
2654
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2655
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2656
+ ) -> ApiResponse[GetOrdersResponse]:
2657
+ """Get Orders
2658
+
2659
+ Restricts the response to orders that have a certain status: resting, canceled, or executed.
2660
+
2661
+ :param ticker: Filter by market ticker
2662
+ :type ticker: str
2663
+ :param event_ticker: Event ticker of desired positions. Multiple event tickers can be provided as a comma-separated list (maximum 10).
2664
+ :type event_ticker: str
2665
+ :param min_ts: Filter items after this Unix timestamp
2666
+ :type min_ts: int
2667
+ :param max_ts: Filter items before this Unix timestamp
2668
+ :type max_ts: int
2669
+ :param status: Filter by status. Possible values depend on the endpoint.
2670
+ :type status: str
2671
+ :param limit: Number of results per page. Defaults to 100. Maximum value is 200.
2672
+ :type limit: int
2673
+ :param 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.
2674
+ :type cursor: str
2675
+ :param _request_timeout: timeout setting for this request. If one
2676
+ number provided, it will be total request
2677
+ timeout. It can also be a pair (tuple) of
2678
+ (connection, read) timeouts.
2679
+ :type _request_timeout: int, tuple(int, int), optional
2680
+ :param _request_auth: set to override the auth_settings for an a single
2681
+ request; this effectively ignores the
2682
+ authentication in the spec for a single request.
2683
+ :type _request_auth: dict, optional
2684
+ :param _content_type: force content-type for the request.
2685
+ :type _content_type: str, Optional
2686
+ :param _headers: set to override the headers for a single
2687
+ request; this effectively ignores the headers
2688
+ in the spec for a single request.
2689
+ :type _headers: dict, optional
2690
+ :param _host_index: set to override the host_index for a single
2691
+ request; this effectively ignores the host_index
2692
+ in the spec for a single request.
2693
+ :type _host_index: int, optional
2694
+ :return: Returns the result object.
2695
+ """ # noqa: E501
2696
+
2697
+ _param = self._get_orders_serialize(
2698
+ ticker=ticker,
2699
+ event_ticker=event_ticker,
2700
+ min_ts=min_ts,
2701
+ max_ts=max_ts,
2702
+ status=status,
2703
+ limit=limit,
2704
+ cursor=cursor,
2705
+ _request_auth=_request_auth,
2706
+ _content_type=_content_type,
2707
+ _headers=_headers,
2708
+ _host_index=_host_index
2709
+ )
2710
+
2711
+ _response_types_map: Dict[str, Optional[str]] = {
2712
+ '200': "GetOrdersResponse",
2713
+ '400': "ErrorResponse",
2714
+ '401': "ErrorResponse",
2715
+ '500': "ErrorResponse",
2716
+ }
2717
+ response_data = await self.api_client.call_api(
2718
+ *_param,
2719
+ _request_timeout=_request_timeout
2720
+ )
2721
+ await response_data.read()
2722
+ return self.api_client.response_deserialize(
2723
+ response_data=response_data,
2724
+ response_types_map=_response_types_map,
2725
+ )
2726
+
2727
+
2728
+ @validate_call
2729
+ async def get_orders_without_preload_content(
2730
+ self,
2731
+ ticker: Annotated[Optional[StrictStr], Field(description="Filter by market ticker")] = None,
2732
+ event_ticker: Annotated[Optional[StrictStr], Field(description="Event ticker of desired positions. Multiple event tickers can be provided as a comma-separated list (maximum 10).")] = None,
2733
+ min_ts: Annotated[Optional[StrictInt], Field(description="Filter items after this Unix timestamp")] = None,
2734
+ max_ts: Annotated[Optional[StrictInt], Field(description="Filter items before this Unix timestamp")] = None,
2735
+ status: Annotated[Optional[StrictStr], Field(description="Filter by status. Possible values depend on the endpoint.")] = None,
2736
+ limit: Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=1)]], Field(description="Number of results per page. Defaults to 100. Maximum value is 200.")] = None,
2737
+ cursor: Annotated[Optional[StrictStr], Field(description="Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.")] = None,
2738
+ _request_timeout: Union[
2739
+ None,
2740
+ Annotated[StrictFloat, Field(gt=0)],
2741
+ Tuple[
2742
+ Annotated[StrictFloat, Field(gt=0)],
2743
+ Annotated[StrictFloat, Field(gt=0)]
2744
+ ]
2745
+ ] = None,
2746
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2747
+ _content_type: Optional[StrictStr] = None,
2748
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2749
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2750
+ ) -> RESTResponseType:
2751
+ """Get Orders
2752
+
2753
+ Restricts the response to orders that have a certain status: resting, canceled, or executed.
2754
+
2755
+ :param ticker: Filter by market ticker
2756
+ :type ticker: str
2757
+ :param event_ticker: Event ticker of desired positions. Multiple event tickers can be provided as a comma-separated list (maximum 10).
2758
+ :type event_ticker: str
2759
+ :param min_ts: Filter items after this Unix timestamp
2760
+ :type min_ts: int
2761
+ :param max_ts: Filter items before this Unix timestamp
2762
+ :type max_ts: int
2763
+ :param status: Filter by status. Possible values depend on the endpoint.
2764
+ :type status: str
2765
+ :param limit: Number of results per page. Defaults to 100. Maximum value is 200.
2766
+ :type limit: int
2767
+ :param 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.
2768
+ :type cursor: str
2769
+ :param _request_timeout: timeout setting for this request. If one
2770
+ number provided, it will be total request
2771
+ timeout. It can also be a pair (tuple) of
2772
+ (connection, read) timeouts.
2773
+ :type _request_timeout: int, tuple(int, int), optional
2774
+ :param _request_auth: set to override the auth_settings for an a single
2775
+ request; this effectively ignores the
2776
+ authentication in the spec for a single request.
2777
+ :type _request_auth: dict, optional
2778
+ :param _content_type: force content-type for the request.
2779
+ :type _content_type: str, Optional
2780
+ :param _headers: set to override the headers for a single
2781
+ request; this effectively ignores the headers
2782
+ in the spec for a single request.
2783
+ :type _headers: dict, optional
2784
+ :param _host_index: set to override the host_index for a single
2785
+ request; this effectively ignores the host_index
2786
+ in the spec for a single request.
2787
+ :type _host_index: int, optional
2788
+ :return: Returns the result object.
2789
+ """ # noqa: E501
2790
+
2791
+ _param = self._get_orders_serialize(
2792
+ ticker=ticker,
2793
+ event_ticker=event_ticker,
2794
+ min_ts=min_ts,
2795
+ max_ts=max_ts,
2796
+ status=status,
2797
+ limit=limit,
2798
+ cursor=cursor,
2799
+ _request_auth=_request_auth,
2800
+ _content_type=_content_type,
2801
+ _headers=_headers,
2802
+ _host_index=_host_index
2803
+ )
2804
+
2805
+ _response_types_map: Dict[str, Optional[str]] = {
2806
+ '200': "GetOrdersResponse",
2807
+ '400': "ErrorResponse",
2808
+ '401': "ErrorResponse",
2809
+ '500': "ErrorResponse",
2810
+ }
2811
+ response_data = await self.api_client.call_api(
2812
+ *_param,
2813
+ _request_timeout=_request_timeout
2814
+ )
2815
+ return response_data.response
2816
+
2817
+
2818
+ def _get_orders_serialize(
2819
+ self,
2820
+ ticker,
2821
+ event_ticker,
2822
+ min_ts,
2823
+ max_ts,
2824
+ status,
2825
+ limit,
2826
+ cursor,
2827
+ _request_auth,
2828
+ _content_type,
2829
+ _headers,
2830
+ _host_index,
2831
+ ) -> RequestSerialized:
2832
+
2833
+ _host = None
2834
+
2835
+ _collection_formats: Dict[str, str] = {
2836
+ }
2837
+
2838
+ _path_params: Dict[str, str] = {}
2839
+ _query_params: List[Tuple[str, str]] = []
2840
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2841
+ _form_params: List[Tuple[str, str]] = []
2842
+ _files: Dict[
2843
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2844
+ ] = {}
2845
+ _body_params: Optional[bytes] = None
2846
+
2847
+ # process the path parameters
2848
+ # process the query parameters
2849
+ if ticker is not None:
2850
+
2851
+ _query_params.append(('ticker', ticker))
2852
+
2853
+ if event_ticker is not None:
2854
+
2855
+ _query_params.append(('event_ticker', event_ticker))
2856
+
2857
+ if min_ts is not None:
2858
+
2859
+ _query_params.append(('min_ts', min_ts))
2860
+
2861
+ if max_ts is not None:
2862
+
2863
+ _query_params.append(('max_ts', max_ts))
2864
+
2865
+ if status is not None:
2866
+
2867
+ _query_params.append(('status', status))
2868
+
2869
+ if limit is not None:
2870
+
2871
+ _query_params.append(('limit', limit))
2872
+
2873
+ if cursor is not None:
2874
+
2875
+ _query_params.append(('cursor', cursor))
2876
+
2877
+ # process the header parameters
2878
+ # process the form parameters
2879
+ # process the body parameter
2880
+
2881
+
2882
+ # set the HTTP header `Accept`
2883
+ if 'Accept' not in _header_params:
2884
+ _header_params['Accept'] = self.api_client.select_header_accept(
2885
+ [
2886
+ 'application/json'
2887
+ ]
2888
+ )
2889
+
2890
+
2891
+ # authentication setting
2892
+ _auth_settings: List[str] = [
2893
+ 'kalshiAccessSignature',
2894
+ 'kalshiAccessKey',
2895
+ 'kalshiAccessTimestamp'
2896
+ ]
2897
+
2898
+ return self.api_client.param_serialize(
2899
+ method='GET',
2900
+ resource_path='/portfolio/orders',
2901
+ path_params=_path_params,
2902
+ query_params=_query_params,
2903
+ header_params=_header_params,
2904
+ body=_body_params,
2905
+ post_params=_form_params,
2906
+ files=_files,
2907
+ auth_settings=_auth_settings,
2908
+ collection_formats=_collection_formats,
2909
+ _host=_host,
2910
+ _request_auth=_request_auth
2911
+ )
2912
+
2913
+