snaptrade-python-sdk 11.0.115__py3-none-any.whl → 11.0.117__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 (37) hide show
  1. snaptrade_client/__init__.py +1 -1
  2. snaptrade_client/api_client.py +1 -1
  3. snaptrade_client/apis/path_to_api.py +6 -3
  4. snaptrade_client/apis/paths/accounts_account_id_trading_cancel.py +7 -0
  5. snaptrade_client/apis/paths/brokerages_brokerage_id_instruments.py +7 -0
  6. snaptrade_client/apis/tags/reference_data_api_generated.py +2 -0
  7. snaptrade_client/apis/tags/trading_api_generated.py +1 -1
  8. snaptrade_client/configuration.py +1 -1
  9. snaptrade_client/model/brokerage_id.py +25 -0
  10. snaptrade_client/model/brokerage_id.pyi +25 -0
  11. snaptrade_client/model/brokerage_instrument.py +197 -0
  12. snaptrade_client/model/brokerage_instrument.pyi +197 -0
  13. snaptrade_client/model/brokerage_instruments_response.py +103 -0
  14. snaptrade_client/model/brokerage_instruments_response.pyi +103 -0
  15. snaptrade_client/model/cancel_order_response.py +96 -0
  16. snaptrade_client/model/cancel_order_response.pyi +96 -0
  17. snaptrade_client/model/cancel_order_response_raw_response.py +62 -0
  18. snaptrade_client/model/cancel_order_response_raw_response.pyi +62 -0
  19. snaptrade_client/models/__init__.py +5 -0
  20. snaptrade_client/operation_parameter_map.py +9 -2
  21. snaptrade_client/paths/__init__.py +2 -1
  22. snaptrade_client/paths/{accounts_account_id_trading_simple_brokerage_order_id_cancel → accounts_account_id_trading_cancel}/__init__.py +2 -2
  23. snaptrade_client/paths/{accounts_account_id_trading_simple_brokerage_order_id_cancel → accounts_account_id_trading_cancel}/post.py +120 -19
  24. snaptrade_client/paths/{accounts_account_id_trading_simple_brokerage_order_id_cancel → accounts_account_id_trading_cancel}/post.pyi +120 -19
  25. snaptrade_client/paths/brokerages_brokerage_id_instruments/__init__.py +7 -0
  26. snaptrade_client/paths/brokerages_brokerage_id_instruments/get.py +417 -0
  27. snaptrade_client/paths/brokerages_brokerage_id_instruments/get.pyi +406 -0
  28. snaptrade_client/type/brokerage_id.py +19 -0
  29. snaptrade_client/type/brokerage_instrument.py +39 -0
  30. snaptrade_client/type/brokerage_instruments_response.py +27 -0
  31. snaptrade_client/type/cancel_order_response.py +29 -0
  32. snaptrade_client/type/cancel_order_response_raw_response.py +19 -0
  33. {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/METADATA +41 -5
  34. {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/RECORD +36 -17
  35. snaptrade_client/apis/paths/accounts_account_id_trading_simple_brokerage_order_id_cancel.py +0 -7
  36. {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/LICENSE +0 -0
  37. {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/WHEEL +0 -0
@@ -33,10 +33,10 @@ import frozendict # noqa: F401
33
33
  from snaptrade_client import schemas # noqa: F401
34
34
 
35
35
  from snaptrade_client.model.model400_failed_request_response import Model400FailedRequestResponse as Model400FailedRequestResponseSchema
36
- from snaptrade_client.model.order_updated_response import OrderUpdatedResponse as OrderUpdatedResponseSchema
36
+ from snaptrade_client.model.cancel_order_response import CancelOrderResponse as CancelOrderResponseSchema
37
37
 
38
+ from snaptrade_client.type.cancel_order_response import CancelOrderResponse
38
39
  from snaptrade_client.type.model400_failed_request_response import Model400FailedRequestResponse
39
- from snaptrade_client.type.order_updated_response import OrderUpdatedResponse
40
40
 
41
41
  # Query params
42
42
  UserIdSchema = schemas.StrSchema
@@ -76,12 +76,10 @@ request_query_user_secret = api_client.QueryParameter(
76
76
  )
77
77
  # Path params
78
78
  AccountIdSchema = schemas.UUIDSchema
79
- BrokerageOrderIdSchema = schemas.StrSchema
80
79
  RequestRequiredPathParams = typing_extensions.TypedDict(
81
80
  'RequestRequiredPathParams',
82
81
  {
83
82
  'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
84
- 'brokerageOrderId': typing.Union[BrokerageOrderIdSchema, str, ],
85
83
  }
86
84
  )
87
85
  RequestOptionalPathParams = typing_extensions.TypedDict(
@@ -102,23 +100,77 @@ request_path_account_id = api_client.PathParameter(
102
100
  schema=AccountIdSchema,
103
101
  required=True,
104
102
  )
105
- request_path_brokerage_order_id = api_client.PathParameter(
106
- name="brokerageOrderId",
107
- style=api_client.ParameterStyle.SIMPLE,
108
- schema=BrokerageOrderIdSchema,
103
+ # body param
104
+
105
+
106
+ class SchemaForRequestBodyApplicationJson(
107
+ schemas.DictSchema
108
+ ):
109
+
110
+
111
+ class MetaOapg:
112
+
113
+ class properties:
114
+ brokerage_order_id = schemas.StrSchema
115
+ __annotations__ = {
116
+ "brokerage_order_id": brokerage_order_id,
117
+ }
118
+
119
+ @typing.overload
120
+ def __getitem__(self, name: typing_extensions.Literal["brokerage_order_id"]) -> MetaOapg.properties.brokerage_order_id: ...
121
+
122
+ @typing.overload
123
+ def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
124
+
125
+ def __getitem__(self, name: typing.Union[typing_extensions.Literal["brokerage_order_id", ], str]):
126
+ # dict_instance[name] accessor
127
+ return super().__getitem__(name)
128
+
129
+
130
+ @typing.overload
131
+ def get_item_oapg(self, name: typing_extensions.Literal["brokerage_order_id"]) -> typing.Union[MetaOapg.properties.brokerage_order_id, schemas.Unset]: ...
132
+
133
+ @typing.overload
134
+ def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
135
+
136
+ def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["brokerage_order_id", ], str]):
137
+ return super().get_item_oapg(name)
138
+
139
+
140
+ def __new__(
141
+ cls,
142
+ *args: typing.Union[dict, frozendict.frozendict, ],
143
+ brokerage_order_id: typing.Union[MetaOapg.properties.brokerage_order_id, str, schemas.Unset] = schemas.unset,
144
+ _configuration: typing.Optional[schemas.Configuration] = None,
145
+ **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
146
+ ) -> 'SchemaForRequestBodyApplicationJson':
147
+ return super().__new__(
148
+ cls,
149
+ *args,
150
+ brokerage_order_id=brokerage_order_id,
151
+ _configuration=_configuration,
152
+ **kwargs,
153
+ )
154
+
155
+
156
+ request_body_typing_any = api_client.RequestBody(
157
+ content={
158
+ 'application/json': api_client.MediaType(
159
+ schema=SchemaForRequestBodyApplicationJson),
160
+ },
109
161
  required=True,
110
162
  )
111
- SchemaFor200ResponseBodyApplicationJson = OrderUpdatedResponseSchema
163
+ SchemaFor200ResponseBodyApplicationJson = CancelOrderResponseSchema
112
164
 
113
165
 
114
166
  @dataclass
115
167
  class ApiResponseFor200(api_client.ApiResponse):
116
- body: OrderUpdatedResponse
168
+ body: CancelOrderResponse
117
169
 
118
170
 
119
171
  @dataclass
120
172
  class ApiResponseFor200Async(api_client.AsyncApiResponse):
121
- body: OrderUpdatedResponse
173
+ body: CancelOrderResponse
122
174
 
123
175
 
124
176
  _response_for_200 = api_client.OpenApiResponse(
@@ -175,6 +227,7 @@ class BaseApi(api_client.Api):
175
227
 
176
228
  def _cancel_order_mapped_args(
177
229
  self,
230
+ body: typing.Optional[typing.Any] = None,
178
231
  user_id: typing.Optional[str] = None,
179
232
  user_secret: typing.Optional[str] = None,
180
233
  account_id: typing.Optional[str] = None,
@@ -185,25 +238,29 @@ class BaseApi(api_client.Api):
185
238
  args: api_client.MappedArgs = api_client.MappedArgs()
186
239
  _query_params = {}
187
240
  _path_params = {}
241
+ _body = {}
242
+ if brokerage_order_id is not None:
243
+ _body["brokerage_order_id"] = brokerage_order_id
244
+ args.body = body if body is not None else _body
188
245
  if user_id is not None:
189
246
  _query_params["userId"] = user_id
190
247
  if user_secret is not None:
191
248
  _query_params["userSecret"] = user_secret
192
249
  if account_id is not None:
193
250
  _path_params["accountId"] = account_id
194
- if brokerage_order_id is not None:
195
- _path_params["brokerageOrderId"] = brokerage_order_id
196
251
  args.query = query_params if query_params else _query_params
197
252
  args.path = path_params if path_params else _path_params
198
253
  return args
199
254
 
200
255
  async def _acancel_order_oapg(
201
256
  self,
257
+ body: typing.Any = None,
202
258
  query_params: typing.Optional[dict] = {},
203
259
  path_params: typing.Optional[dict] = {},
204
260
  skip_deserialization: bool = True,
205
261
  timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
206
262
  accept_content_types: typing.Tuple[str] = _all_accept_content_types,
263
+ content_type: str = 'application/json',
207
264
  stream: bool = False,
208
265
  **kwargs,
209
266
  ) -> typing.Union[
@@ -212,7 +269,7 @@ class BaseApi(api_client.Api):
212
269
  AsyncGeneratorResponse,
213
270
  ]:
214
271
  """
215
- Cancel crypto order
272
+ Cancel order
216
273
  :param skip_deserialization: If true then api_response.response will be set but
217
274
  api_response.body and api_response.headers will not be deserialized into schema
218
275
  class instances
@@ -224,7 +281,6 @@ class BaseApi(api_client.Api):
224
281
  _path_params = {}
225
282
  for parameter in (
226
283
  request_path_account_id,
227
- request_path_brokerage_order_id,
228
284
  ):
229
285
  parameter_data = path_params.get(parameter.name, schemas.unset)
230
286
  if parameter_data is schemas.unset:
@@ -255,19 +311,35 @@ class BaseApi(api_client.Api):
255
311
  for accept_content_type in accept_content_types:
256
312
  _headers.add('Accept', accept_content_type)
257
313
  method = 'post'.upper()
314
+ _headers.add('Content-Type', content_type)
315
+
316
+ if body is schemas.unset:
317
+ raise exceptions.ApiValueError(
318
+ 'The required body parameter has an invalid value of: unset. Set a valid value instead')
319
+ _fields = None
320
+ _body = None
258
321
  request_before_hook(
259
322
  resource_path=used_path,
260
323
  method=method,
261
324
  configuration=self.api_client.configuration,
262
- path_template='/accounts/{accountId}/trading/simple/{brokerageOrderId}/cancel',
325
+ path_template='/accounts/{accountId}/trading/cancel',
326
+ body=body,
263
327
  auth_settings=_auth,
264
328
  headers=_headers,
265
329
  )
330
+ serialized_data = request_body_typing_any.serialize(body, content_type)
331
+ if 'fields' in serialized_data:
332
+ _fields = serialized_data['fields']
333
+ elif 'body' in serialized_data:
334
+ _body = serialized_data['body']
266
335
 
267
336
  response = await self.api_client.async_call_api(
268
337
  resource_path=used_path,
269
338
  method=method,
270
339
  headers=_headers,
340
+ fields=_fields,
341
+ serialized_body=_body,
342
+ body=body,
271
343
  auth_settings=_auth,
272
344
  prefix_separator_iterator=prefix_separator_iterator,
273
345
  timeout=timeout,
@@ -330,18 +402,20 @@ class BaseApi(api_client.Api):
330
402
 
331
403
  def _cancel_order_oapg(
332
404
  self,
405
+ body: typing.Any = None,
333
406
  query_params: typing.Optional[dict] = {},
334
407
  path_params: typing.Optional[dict] = {},
335
408
  skip_deserialization: bool = True,
336
409
  timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
337
410
  accept_content_types: typing.Tuple[str] = _all_accept_content_types,
411
+ content_type: str = 'application/json',
338
412
  stream: bool = False,
339
413
  ) -> typing.Union[
340
414
  ApiResponseFor200,
341
415
  api_client.ApiResponseWithoutDeserialization,
342
416
  ]:
343
417
  """
344
- Cancel crypto order
418
+ Cancel order
345
419
  :param skip_deserialization: If true then api_response.response will be set but
346
420
  api_response.body and api_response.headers will not be deserialized into schema
347
421
  class instances
@@ -353,7 +427,6 @@ class BaseApi(api_client.Api):
353
427
  _path_params = {}
354
428
  for parameter in (
355
429
  request_path_account_id,
356
- request_path_brokerage_order_id,
357
430
  ):
358
431
  parameter_data = path_params.get(parameter.name, schemas.unset)
359
432
  if parameter_data is schemas.unset:
@@ -384,19 +457,35 @@ class BaseApi(api_client.Api):
384
457
  for accept_content_type in accept_content_types:
385
458
  _headers.add('Accept', accept_content_type)
386
459
  method = 'post'.upper()
460
+ _headers.add('Content-Type', content_type)
461
+
462
+ if body is schemas.unset:
463
+ raise exceptions.ApiValueError(
464
+ 'The required body parameter has an invalid value of: unset. Set a valid value instead')
465
+ _fields = None
466
+ _body = None
387
467
  request_before_hook(
388
468
  resource_path=used_path,
389
469
  method=method,
390
470
  configuration=self.api_client.configuration,
391
- path_template='/accounts/{accountId}/trading/simple/{brokerageOrderId}/cancel',
471
+ path_template='/accounts/{accountId}/trading/cancel',
472
+ body=body,
392
473
  auth_settings=_auth,
393
474
  headers=_headers,
394
475
  )
476
+ serialized_data = request_body_typing_any.serialize(body, content_type)
477
+ if 'fields' in serialized_data:
478
+ _fields = serialized_data['fields']
479
+ elif 'body' in serialized_data:
480
+ _body = serialized_data['body']
395
481
 
396
482
  response = self.api_client.call_api(
397
483
  resource_path=used_path,
398
484
  method=method,
399
485
  headers=_headers,
486
+ fields=_fields,
487
+ serialized_body=_body,
488
+ body=body,
400
489
  auth_settings=_auth,
401
490
  prefix_separator_iterator=prefix_separator_iterator,
402
491
  timeout=timeout,
@@ -431,6 +520,7 @@ class CancelOrder(BaseApi):
431
520
 
432
521
  async def acancel_order(
433
522
  self,
523
+ body: typing.Optional[typing.Any] = None,
434
524
  user_id: typing.Optional[str] = None,
435
525
  user_secret: typing.Optional[str] = None,
436
526
  account_id: typing.Optional[str] = None,
@@ -444,6 +534,7 @@ class CancelOrder(BaseApi):
444
534
  AsyncGeneratorResponse,
445
535
  ]:
446
536
  args = self._cancel_order_mapped_args(
537
+ body=body,
447
538
  query_params=query_params,
448
539
  path_params=path_params,
449
540
  user_id=user_id,
@@ -452,6 +543,7 @@ class CancelOrder(BaseApi):
452
543
  brokerage_order_id=brokerage_order_id,
453
544
  )
454
545
  return await self._acancel_order_oapg(
546
+ body=args.body,
455
547
  query_params=args.query,
456
548
  path_params=args.path,
457
549
  **kwargs,
@@ -459,6 +551,7 @@ class CancelOrder(BaseApi):
459
551
 
460
552
  def cancel_order(
461
553
  self,
554
+ body: typing.Optional[typing.Any] = None,
462
555
  user_id: typing.Optional[str] = None,
463
556
  user_secret: typing.Optional[str] = None,
464
557
  account_id: typing.Optional[str] = None,
@@ -471,6 +564,7 @@ class CancelOrder(BaseApi):
471
564
  ]:
472
565
  """ Cancels an order in the specified account. """
473
566
  args = self._cancel_order_mapped_args(
567
+ body=body,
474
568
  query_params=query_params,
475
569
  path_params=path_params,
476
570
  user_id=user_id,
@@ -479,6 +573,7 @@ class CancelOrder(BaseApi):
479
573
  brokerage_order_id=brokerage_order_id,
480
574
  )
481
575
  return self._cancel_order_oapg(
576
+ body=args.body,
482
577
  query_params=args.query,
483
578
  path_params=args.path,
484
579
  )
@@ -488,6 +583,7 @@ class ApiForpost(BaseApi):
488
583
 
489
584
  async def apost(
490
585
  self,
586
+ body: typing.Optional[typing.Any] = None,
491
587
  user_id: typing.Optional[str] = None,
492
588
  user_secret: typing.Optional[str] = None,
493
589
  account_id: typing.Optional[str] = None,
@@ -501,6 +597,7 @@ class ApiForpost(BaseApi):
501
597
  AsyncGeneratorResponse,
502
598
  ]:
503
599
  args = self._cancel_order_mapped_args(
600
+ body=body,
504
601
  query_params=query_params,
505
602
  path_params=path_params,
506
603
  user_id=user_id,
@@ -509,6 +606,7 @@ class ApiForpost(BaseApi):
509
606
  brokerage_order_id=brokerage_order_id,
510
607
  )
511
608
  return await self._acancel_order_oapg(
609
+ body=args.body,
512
610
  query_params=args.query,
513
611
  path_params=args.path,
514
612
  **kwargs,
@@ -516,6 +614,7 @@ class ApiForpost(BaseApi):
516
614
 
517
615
  def post(
518
616
  self,
617
+ body: typing.Optional[typing.Any] = None,
519
618
  user_id: typing.Optional[str] = None,
520
619
  user_secret: typing.Optional[str] = None,
521
620
  account_id: typing.Optional[str] = None,
@@ -528,6 +627,7 @@ class ApiForpost(BaseApi):
528
627
  ]:
529
628
  """ Cancels an order in the specified account. """
530
629
  args = self._cancel_order_mapped_args(
630
+ body=body,
531
631
  query_params=query_params,
532
632
  path_params=path_params,
533
633
  user_id=user_id,
@@ -536,6 +636,7 @@ class ApiForpost(BaseApi):
536
636
  brokerage_order_id=brokerage_order_id,
537
637
  )
538
638
  return self._cancel_order_oapg(
639
+ body=args.body,
539
640
  query_params=args.query,
540
641
  path_params=args.path,
541
642
  )
@@ -0,0 +1,7 @@
1
+ # do not import all endpoints into this module because that uses a lot of memory and stack frames
2
+ # if you need the ability to import all endpoints from this module, import them with
3
+ # from snaptrade_client.paths.brokerages_brokerage_id_instruments import Api
4
+
5
+ from snaptrade_client.paths import PathValues
6
+
7
+ path = PathValues.BROKERAGES_BROKERAGE_ID_INSTRUMENTS