snaptrade-python-sdk 11.0.126__py3-none-any.whl → 11.0.128__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 (25) 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 -6
  4. snaptrade_client/apis/paths/accounts_account_id_orders_details.py +7 -0
  5. snaptrade_client/apis/paths/brokerages_slug_instruments.py +7 -0
  6. snaptrade_client/apis/tags/account_information_api_generated.py +1 -1
  7. snaptrade_client/apis/tags/reference_data_api_generated.py +1 -1
  8. snaptrade_client/configuration.py +1 -1
  9. snaptrade_client/model/brokerage_instrument.py +7 -2
  10. snaptrade_client/model/brokerage_instrument.pyi +7 -2
  11. snaptrade_client/operation_parameter_map.py +7 -7
  12. snaptrade_client/paths/__init__.py +2 -2
  13. snaptrade_client/paths/{brokerages_brokerage_id_instruments → accounts_account_id_orders_details}/__init__.py +2 -2
  14. snaptrade_client/paths/{accounts_account_id_orders_brokerage_order_id/get.py → accounts_account_id_orders_details/post.py} +167 -37
  15. snaptrade_client/paths/{accounts_account_id_orders_brokerage_order_id/get.pyi → accounts_account_id_orders_details/post.pyi} +166 -37
  16. snaptrade_client/paths/{accounts_account_id_orders_brokerage_order_id → brokerages_slug_instruments}/__init__.py +2 -2
  17. snaptrade_client/paths/{brokerages_brokerage_id_instruments → brokerages_slug_instruments}/get.py +20 -20
  18. snaptrade_client/paths/{brokerages_brokerage_id_instruments → brokerages_slug_instruments}/get.pyi +20 -20
  19. snaptrade_client/type/brokerage_instrument.py +2 -3
  20. {snaptrade_python_sdk-11.0.126.dist-info → snaptrade_python_sdk-11.0.128.dist-info}/METADATA +20 -13
  21. {snaptrade_python_sdk-11.0.126.dist-info → snaptrade_python_sdk-11.0.128.dist-info}/RECORD +23 -23
  22. snaptrade_client/apis/paths/accounts_account_id_orders_brokerage_order_id.py +0 -7
  23. snaptrade_client/apis/paths/brokerages_brokerage_id_instruments.py +0 -7
  24. {snaptrade_python_sdk-11.0.126.dist-info → snaptrade_python_sdk-11.0.128.dist-info}/LICENSE +0 -0
  25. {snaptrade_python_sdk-11.0.126.dist-info → snaptrade_python_sdk-11.0.128.dist-info}/WHEEL +0 -0
@@ -32,10 +32,12 @@ import frozendict # noqa: F401
32
32
 
33
33
  from snaptrade_client import schemas # noqa: F401
34
34
 
35
+ from snaptrade_client.model.model400_failed_request_response import Model400FailedRequestResponse as Model400FailedRequestResponseSchema
35
36
  from snaptrade_client.model.account_order_record import AccountOrderRecord as AccountOrderRecordSchema
36
37
  from snaptrade_client.model.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse as Model500UnexpectedExceptionResponseSchema
37
38
  from snaptrade_client.model.model404_failed_request_response import Model404FailedRequestResponse as Model404FailedRequestResponseSchema
38
39
 
40
+ from snaptrade_client.type.model400_failed_request_response import Model400FailedRequestResponse
39
41
  from snaptrade_client.type.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse
40
42
  from snaptrade_client.type.account_order_record import AccountOrderRecord
41
43
  from snaptrade_client.type.model404_failed_request_response import Model404FailedRequestResponse
@@ -80,12 +82,10 @@ request_query_user_secret = api_client.QueryParameter(
80
82
  )
81
83
  # Path params
82
84
  AccountIdSchema = schemas.UUIDSchema
83
- BrokerageOrderIdSchema = schemas.StrSchema
84
85
  RequestRequiredPathParams = typing_extensions.TypedDict(
85
86
  'RequestRequiredPathParams',
86
87
  {
87
88
  'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
88
- 'brokerageOrderId': typing.Union[BrokerageOrderIdSchema, str, ],
89
89
  }
90
90
  )
91
91
  RequestOptionalPathParams = typing_extensions.TypedDict(
@@ -106,10 +106,69 @@ request_path_account_id = api_client.PathParameter(
106
106
  schema=AccountIdSchema,
107
107
  required=True,
108
108
  )
109
- request_path_brokerage_order_id = api_client.PathParameter(
110
- name="brokerageOrderId",
111
- style=api_client.ParameterStyle.SIMPLE,
112
- schema=BrokerageOrderIdSchema,
109
+ # body param
110
+
111
+
112
+ class SchemaForRequestBodyApplicationJson(
113
+ schemas.DictSchema
114
+ ):
115
+
116
+
117
+ class MetaOapg:
118
+ required = {
119
+ "external_order_id",
120
+ }
121
+
122
+ class properties:
123
+ external_order_id = schemas.StrSchema
124
+ __annotations__ = {
125
+ "external_order_id": external_order_id,
126
+ }
127
+
128
+ external_order_id: MetaOapg.properties.external_order_id
129
+
130
+ @typing.overload
131
+ def __getitem__(self, name: typing_extensions.Literal["external_order_id"]) -> MetaOapg.properties.external_order_id: ...
132
+
133
+ @typing.overload
134
+ def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
135
+
136
+ def __getitem__(self, name: typing.Union[typing_extensions.Literal["external_order_id", ], str]):
137
+ # dict_instance[name] accessor
138
+ return super().__getitem__(name)
139
+
140
+
141
+ @typing.overload
142
+ def get_item_oapg(self, name: typing_extensions.Literal["external_order_id"]) -> MetaOapg.properties.external_order_id: ...
143
+
144
+ @typing.overload
145
+ def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
146
+
147
+ def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["external_order_id", ], str]):
148
+ return super().get_item_oapg(name)
149
+
150
+
151
+ def __new__(
152
+ cls,
153
+ *args: typing.Union[dict, frozendict.frozendict, ],
154
+ external_order_id: typing.Union[MetaOapg.properties.external_order_id, str, ],
155
+ _configuration: typing.Optional[schemas.Configuration] = None,
156
+ **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
157
+ ) -> 'SchemaForRequestBodyApplicationJson':
158
+ return super().__new__(
159
+ cls,
160
+ *args,
161
+ external_order_id=external_order_id,
162
+ _configuration=_configuration,
163
+ **kwargs,
164
+ )
165
+
166
+
167
+ request_body_typing_any = api_client.RequestBody(
168
+ content={
169
+ 'application/json': api_client.MediaType(
170
+ schema=SchemaForRequestBodyApplicationJson),
171
+ },
113
172
  required=True,
114
173
  )
115
174
  _auth = [
@@ -138,6 +197,27 @@ _response_for_200 = api_client.OpenApiResponse(
138
197
  schema=SchemaFor200ResponseBodyApplicationJson),
139
198
  },
140
199
  )
200
+ SchemaFor400ResponseBodyApplicationJson = Model400FailedRequestResponseSchema
201
+
202
+
203
+ @dataclass
204
+ class ApiResponseFor400(api_client.ApiResponse):
205
+ body: Model400FailedRequestResponse
206
+
207
+
208
+ @dataclass
209
+ class ApiResponseFor400Async(api_client.AsyncApiResponse):
210
+ body: Model400FailedRequestResponse
211
+
212
+
213
+ _response_for_400 = api_client.OpenApiResponse(
214
+ response_cls=ApiResponseFor400,
215
+ response_cls_async=ApiResponseFor400Async,
216
+ content={
217
+ 'application/json': api_client.MediaType(
218
+ schema=SchemaFor400ResponseBodyApplicationJson),
219
+ },
220
+ )
141
221
  SchemaFor404ResponseBodyApplicationJson = Model404FailedRequestResponseSchema
142
222
 
143
223
 
@@ -182,6 +262,7 @@ _response_for_500 = api_client.OpenApiResponse(
182
262
  )
183
263
  _status_code_to_response = {
184
264
  '200': _response_for_200,
265
+ '400': _response_for_400,
185
266
  '404': _response_for_404,
186
267
  '500': _response_for_500,
187
268
  }
@@ -194,35 +275,40 @@ class BaseApi(api_client.Api):
194
275
 
195
276
  def _get_user_account_order_detail_mapped_args(
196
277
  self,
278
+ body: typing.Optional[typing.Any] = None,
279
+ external_order_id: typing.Optional[str] = None,
280
+ account_id: typing.Optional[str] = None,
197
281
  user_id: typing.Optional[str] = None,
198
282
  user_secret: typing.Optional[str] = None,
199
- account_id: typing.Optional[str] = None,
200
- brokerage_order_id: typing.Optional[str] = None,
201
283
  query_params: typing.Optional[dict] = {},
202
284
  path_params: typing.Optional[dict] = {},
203
285
  ) -> api_client.MappedArgs:
204
286
  args: api_client.MappedArgs = api_client.MappedArgs()
205
287
  _query_params = {}
206
288
  _path_params = {}
289
+ _body = {}
290
+ if external_order_id is not None:
291
+ _body["external_order_id"] = external_order_id
292
+ args.body = body if body is not None else _body
207
293
  if user_id is not None:
208
294
  _query_params["userId"] = user_id
209
295
  if user_secret is not None:
210
296
  _query_params["userSecret"] = user_secret
211
297
  if account_id is not None:
212
298
  _path_params["accountId"] = account_id
213
- if brokerage_order_id is not None:
214
- _path_params["brokerageOrderId"] = brokerage_order_id
215
299
  args.query = query_params if query_params else _query_params
216
300
  args.path = path_params if path_params else _path_params
217
301
  return args
218
302
 
219
303
  async def _aget_user_account_order_detail_oapg(
220
304
  self,
305
+ body: typing.Any = None,
221
306
  query_params: typing.Optional[dict] = {},
222
307
  path_params: typing.Optional[dict] = {},
223
308
  skip_deserialization: bool = True,
224
309
  timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
225
310
  accept_content_types: typing.Tuple[str] = _all_accept_content_types,
311
+ content_type: str = 'application/json',
226
312
  stream: bool = False,
227
313
  **kwargs,
228
314
  ) -> typing.Union[
@@ -243,7 +329,6 @@ class BaseApi(api_client.Api):
243
329
  _path_params = {}
244
330
  for parameter in (
245
331
  request_path_account_id,
246
- request_path_brokerage_order_id,
247
332
  ):
248
333
  parameter_data = path_params.get(parameter.name, schemas.unset)
249
334
  if parameter_data is schemas.unset:
@@ -273,20 +358,36 @@ class BaseApi(api_client.Api):
273
358
  if accept_content_types:
274
359
  for accept_content_type in accept_content_types:
275
360
  _headers.add('Accept', accept_content_type)
276
- method = 'get'.upper()
361
+ method = 'post'.upper()
362
+ _headers.add('Content-Type', content_type)
363
+
364
+ if body is schemas.unset:
365
+ raise exceptions.ApiValueError(
366
+ 'The required body parameter has an invalid value of: unset. Set a valid value instead')
367
+ _fields = None
368
+ _body = None
277
369
  request_before_hook(
278
370
  resource_path=used_path,
279
371
  method=method,
280
372
  configuration=self.api_client.configuration,
281
- path_template='/accounts/{accountId}/orders/{brokerageOrderId}',
373
+ path_template='/accounts/{accountId}/orders/details',
374
+ body=body,
282
375
  auth_settings=_auth,
283
376
  headers=_headers,
284
377
  )
378
+ serialized_data = request_body_typing_any.serialize(body, content_type)
379
+ if 'fields' in serialized_data:
380
+ _fields = serialized_data['fields']
381
+ elif 'body' in serialized_data:
382
+ _body = serialized_data['body']
285
383
 
286
384
  response = await self.api_client.async_call_api(
287
385
  resource_path=used_path,
288
386
  method=method,
289
387
  headers=_headers,
388
+ fields=_fields,
389
+ serialized_body=_body,
390
+ body=body,
290
391
  auth_settings=_auth,
291
392
  prefix_separator_iterator=prefix_separator_iterator,
292
393
  timeout=timeout,
@@ -349,11 +450,13 @@ class BaseApi(api_client.Api):
349
450
 
350
451
  def _get_user_account_order_detail_oapg(
351
452
  self,
453
+ body: typing.Any = None,
352
454
  query_params: typing.Optional[dict] = {},
353
455
  path_params: typing.Optional[dict] = {},
354
456
  skip_deserialization: bool = True,
355
457
  timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
356
458
  accept_content_types: typing.Tuple[str] = _all_accept_content_types,
459
+ content_type: str = 'application/json',
357
460
  stream: bool = False,
358
461
  ) -> typing.Union[
359
462
  ApiResponseFor200,
@@ -372,7 +475,6 @@ class BaseApi(api_client.Api):
372
475
  _path_params = {}
373
476
  for parameter in (
374
477
  request_path_account_id,
375
- request_path_brokerage_order_id,
376
478
  ):
377
479
  parameter_data = path_params.get(parameter.name, schemas.unset)
378
480
  if parameter_data is schemas.unset:
@@ -402,20 +504,36 @@ class BaseApi(api_client.Api):
402
504
  if accept_content_types:
403
505
  for accept_content_type in accept_content_types:
404
506
  _headers.add('Accept', accept_content_type)
405
- method = 'get'.upper()
507
+ method = 'post'.upper()
508
+ _headers.add('Content-Type', content_type)
509
+
510
+ if body is schemas.unset:
511
+ raise exceptions.ApiValueError(
512
+ 'The required body parameter has an invalid value of: unset. Set a valid value instead')
513
+ _fields = None
514
+ _body = None
406
515
  request_before_hook(
407
516
  resource_path=used_path,
408
517
  method=method,
409
518
  configuration=self.api_client.configuration,
410
- path_template='/accounts/{accountId}/orders/{brokerageOrderId}',
519
+ path_template='/accounts/{accountId}/orders/details',
520
+ body=body,
411
521
  auth_settings=_auth,
412
522
  headers=_headers,
413
523
  )
524
+ serialized_data = request_body_typing_any.serialize(body, content_type)
525
+ if 'fields' in serialized_data:
526
+ _fields = serialized_data['fields']
527
+ elif 'body' in serialized_data:
528
+ _body = serialized_data['body']
414
529
 
415
530
  response = self.api_client.call_api(
416
531
  resource_path=used_path,
417
532
  method=method,
418
533
  headers=_headers,
534
+ fields=_fields,
535
+ serialized_body=_body,
536
+ body=body,
419
537
  auth_settings=_auth,
420
538
  prefix_separator_iterator=prefix_separator_iterator,
421
539
  timeout=timeout,
@@ -450,10 +568,11 @@ class GetUserAccountOrderDetail(BaseApi):
450
568
 
451
569
  async def aget_user_account_order_detail(
452
570
  self,
571
+ body: typing.Optional[typing.Any] = None,
572
+ external_order_id: typing.Optional[str] = None,
573
+ account_id: typing.Optional[str] = None,
453
574
  user_id: typing.Optional[str] = None,
454
575
  user_secret: typing.Optional[str] = None,
455
- account_id: typing.Optional[str] = None,
456
- brokerage_order_id: typing.Optional[str] = None,
457
576
  query_params: typing.Optional[dict] = {},
458
577
  path_params: typing.Optional[dict] = {},
459
578
  **kwargs,
@@ -463,14 +582,16 @@ class GetUserAccountOrderDetail(BaseApi):
463
582
  AsyncGeneratorResponse,
464
583
  ]:
465
584
  args = self._get_user_account_order_detail_mapped_args(
585
+ body=body,
466
586
  query_params=query_params,
467
587
  path_params=path_params,
588
+ external_order_id=external_order_id,
589
+ account_id=account_id,
468
590
  user_id=user_id,
469
591
  user_secret=user_secret,
470
- account_id=account_id,
471
- brokerage_order_id=brokerage_order_id,
472
592
  )
473
593
  return await self._aget_user_account_order_detail_oapg(
594
+ body=args.body,
474
595
  query_params=args.query,
475
596
  path_params=args.path,
476
597
  **kwargs,
@@ -478,39 +599,43 @@ class GetUserAccountOrderDetail(BaseApi):
478
599
 
479
600
  def get_user_account_order_detail(
480
601
  self,
602
+ body: typing.Optional[typing.Any] = None,
603
+ external_order_id: typing.Optional[str] = None,
604
+ account_id: typing.Optional[str] = None,
481
605
  user_id: typing.Optional[str] = None,
482
606
  user_secret: typing.Optional[str] = None,
483
- account_id: typing.Optional[str] = None,
484
- brokerage_order_id: typing.Optional[str] = None,
485
607
  query_params: typing.Optional[dict] = {},
486
608
  path_params: typing.Optional[dict] = {},
487
609
  ) -> typing.Union[
488
610
  ApiResponseFor200,
489
611
  api_client.ApiResponseWithoutDeserialization,
490
612
  ]:
491
- """ Returns the detail of a single order in the specified account. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. """
613
+ """ Returns the detail of a single order using the external order ID provided in the request body. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. """
492
614
  args = self._get_user_account_order_detail_mapped_args(
615
+ body=body,
493
616
  query_params=query_params,
494
617
  path_params=path_params,
618
+ external_order_id=external_order_id,
619
+ account_id=account_id,
495
620
  user_id=user_id,
496
621
  user_secret=user_secret,
497
- account_id=account_id,
498
- brokerage_order_id=brokerage_order_id,
499
622
  )
500
623
  return self._get_user_account_order_detail_oapg(
624
+ body=args.body,
501
625
  query_params=args.query,
502
626
  path_params=args.path,
503
627
  )
504
628
 
505
- class ApiForget(BaseApi):
629
+ class ApiForpost(BaseApi):
506
630
  # this class is used by api classes that refer to endpoints by path and http method names
507
631
 
508
- async def aget(
632
+ async def apost(
509
633
  self,
634
+ body: typing.Optional[typing.Any] = None,
635
+ external_order_id: typing.Optional[str] = None,
636
+ account_id: typing.Optional[str] = None,
510
637
  user_id: typing.Optional[str] = None,
511
638
  user_secret: typing.Optional[str] = None,
512
- account_id: typing.Optional[str] = None,
513
- brokerage_order_id: typing.Optional[str] = None,
514
639
  query_params: typing.Optional[dict] = {},
515
640
  path_params: typing.Optional[dict] = {},
516
641
  **kwargs,
@@ -520,41 +645,46 @@ class ApiForget(BaseApi):
520
645
  AsyncGeneratorResponse,
521
646
  ]:
522
647
  args = self._get_user_account_order_detail_mapped_args(
648
+ body=body,
523
649
  query_params=query_params,
524
650
  path_params=path_params,
651
+ external_order_id=external_order_id,
652
+ account_id=account_id,
525
653
  user_id=user_id,
526
654
  user_secret=user_secret,
527
- account_id=account_id,
528
- brokerage_order_id=brokerage_order_id,
529
655
  )
530
656
  return await self._aget_user_account_order_detail_oapg(
657
+ body=args.body,
531
658
  query_params=args.query,
532
659
  path_params=args.path,
533
660
  **kwargs,
534
661
  )
535
662
 
536
- def get(
663
+ def post(
537
664
  self,
665
+ body: typing.Optional[typing.Any] = None,
666
+ external_order_id: typing.Optional[str] = None,
667
+ account_id: typing.Optional[str] = None,
538
668
  user_id: typing.Optional[str] = None,
539
669
  user_secret: typing.Optional[str] = None,
540
- account_id: typing.Optional[str] = None,
541
- brokerage_order_id: typing.Optional[str] = None,
542
670
  query_params: typing.Optional[dict] = {},
543
671
  path_params: typing.Optional[dict] = {},
544
672
  ) -> typing.Union[
545
673
  ApiResponseFor200,
546
674
  api_client.ApiResponseWithoutDeserialization,
547
675
  ]:
548
- """ Returns the detail of a single order in the specified account. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. """
676
+ """ Returns the detail of a single order using the external order ID provided in the request body. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint. """
549
677
  args = self._get_user_account_order_detail_mapped_args(
678
+ body=body,
550
679
  query_params=query_params,
551
680
  path_params=path_params,
681
+ external_order_id=external_order_id,
682
+ account_id=account_id,
552
683
  user_id=user_id,
553
684
  user_secret=user_secret,
554
- account_id=account_id,
555
- brokerage_order_id=brokerage_order_id,
556
685
  )
557
686
  return self._get_user_account_order_detail_oapg(
687
+ body=args.body,
558
688
  query_params=args.query,
559
689
  path_params=args.path,
560
690
  )