snaptrade-python-sdk 11.0.157__py3-none-any.whl → 11.0.158__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.
@@ -0,0 +1,678 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ SnapTrade
5
+
6
+ Connect brokerage accounts to your app for live positions and trading
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: api@snaptrade.com
10
+ Created by: https://snaptrade.com/
11
+ """
12
+
13
+ from dataclasses import dataclass
14
+ import typing_extensions
15
+ import urllib3
16
+ from snaptrade_client.request_before_hook import request_before_hook
17
+ import json
18
+ from urllib3._collections import HTTPHeaderDict
19
+
20
+ from snaptrade_client.api_response import AsyncGeneratorResponse
21
+ from snaptrade_client import api_client, exceptions
22
+ from datetime import date, datetime # noqa: F401
23
+ import decimal # noqa: F401
24
+ import functools # noqa: F401
25
+ import io # noqa: F401
26
+ import re # noqa: F401
27
+ import typing # noqa: F401
28
+ import typing_extensions # noqa: F401
29
+ import uuid # noqa: F401
30
+
31
+ import frozendict # noqa: F401
32
+
33
+ from snaptrade_client import schemas # noqa: F401
34
+
35
+ from snaptrade_client.model.model400_failed_request_response import Model400FailedRequestResponse as Model400FailedRequestResponseSchema
36
+ from snaptrade_client.model.account_order_record_v2 import AccountOrderRecordV2 as AccountOrderRecordV2Schema
37
+ from snaptrade_client.model.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse as Model500UnexpectedExceptionResponseSchema
38
+ from snaptrade_client.model.model404_failed_request_response import Model404FailedRequestResponse as Model404FailedRequestResponseSchema
39
+
40
+ from snaptrade_client.type.model400_failed_request_response import Model400FailedRequestResponse
41
+ from snaptrade_client.type.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse
42
+ from snaptrade_client.type.account_order_record_v2 import AccountOrderRecordV2
43
+ from snaptrade_client.type.model404_failed_request_response import Model404FailedRequestResponse
44
+
45
+ # Query params
46
+ UserIdSchema = schemas.StrSchema
47
+ UserSecretSchema = schemas.StrSchema
48
+ RequestRequiredQueryParams = typing_extensions.TypedDict(
49
+ 'RequestRequiredQueryParams',
50
+ {
51
+ 'userId': typing.Union[UserIdSchema, str, ],
52
+ 'userSecret': typing.Union[UserSecretSchema, str, ],
53
+ }
54
+ )
55
+ RequestOptionalQueryParams = typing_extensions.TypedDict(
56
+ 'RequestOptionalQueryParams',
57
+ {
58
+ },
59
+ total=False
60
+ )
61
+
62
+
63
+ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams):
64
+ pass
65
+
66
+
67
+ request_query_user_id = api_client.QueryParameter(
68
+ name="userId",
69
+ style=api_client.ParameterStyle.FORM,
70
+ schema=UserIdSchema,
71
+ required=True,
72
+ explode=True,
73
+ )
74
+ request_query_user_secret = api_client.QueryParameter(
75
+ name="userSecret",
76
+ style=api_client.ParameterStyle.FORM,
77
+ schema=UserSecretSchema,
78
+ required=True,
79
+ explode=True,
80
+ )
81
+ # Path params
82
+ AccountIdSchema = schemas.UUIDSchema
83
+ RequestRequiredPathParams = typing_extensions.TypedDict(
84
+ 'RequestRequiredPathParams',
85
+ {
86
+ 'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
87
+ }
88
+ )
89
+ RequestOptionalPathParams = typing_extensions.TypedDict(
90
+ 'RequestOptionalPathParams',
91
+ {
92
+ },
93
+ total=False
94
+ )
95
+
96
+
97
+ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams):
98
+ pass
99
+
100
+
101
+ request_path_account_id = api_client.PathParameter(
102
+ name="accountId",
103
+ style=api_client.ParameterStyle.SIMPLE,
104
+ schema=AccountIdSchema,
105
+ required=True,
106
+ )
107
+ # body param
108
+
109
+
110
+ class SchemaForRequestBodyApplicationJson(
111
+ schemas.DictSchema
112
+ ):
113
+
114
+
115
+ class MetaOapg:
116
+ required = {
117
+ "brokerage_order_id",
118
+ }
119
+
120
+ class properties:
121
+ brokerage_order_id = schemas.StrSchema
122
+ __annotations__ = {
123
+ "brokerage_order_id": brokerage_order_id,
124
+ }
125
+
126
+ brokerage_order_id: MetaOapg.properties.brokerage_order_id
127
+
128
+ @typing.overload
129
+ def __getitem__(self, name: typing_extensions.Literal["brokerage_order_id"]) -> MetaOapg.properties.brokerage_order_id: ...
130
+
131
+ @typing.overload
132
+ def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
133
+
134
+ def __getitem__(self, name: typing.Union[typing_extensions.Literal["brokerage_order_id", ], str]):
135
+ # dict_instance[name] accessor
136
+ return super().__getitem__(name)
137
+
138
+
139
+ @typing.overload
140
+ def get_item_oapg(self, name: typing_extensions.Literal["brokerage_order_id"]) -> MetaOapg.properties.brokerage_order_id: ...
141
+
142
+ @typing.overload
143
+ def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
144
+
145
+ def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["brokerage_order_id", ], str]):
146
+ return super().get_item_oapg(name)
147
+
148
+
149
+ def __new__(
150
+ cls,
151
+ *args: typing.Union[dict, frozendict.frozendict, ],
152
+ brokerage_order_id: typing.Union[MetaOapg.properties.brokerage_order_id, str, ],
153
+ _configuration: typing.Optional[schemas.Configuration] = None,
154
+ **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
155
+ ) -> 'SchemaForRequestBodyApplicationJson':
156
+ return super().__new__(
157
+ cls,
158
+ *args,
159
+ brokerage_order_id=brokerage_order_id,
160
+ _configuration=_configuration,
161
+ **kwargs,
162
+ )
163
+
164
+
165
+ request_body_typing_any = api_client.RequestBody(
166
+ content={
167
+ 'application/json': api_client.MediaType(
168
+ schema=SchemaForRequestBodyApplicationJson),
169
+ },
170
+ required=True,
171
+ )
172
+ SchemaFor200ResponseBodyApplicationJson = AccountOrderRecordV2Schema
173
+
174
+
175
+ @dataclass
176
+ class ApiResponseFor200(api_client.ApiResponse):
177
+ body: AccountOrderRecordV2
178
+
179
+
180
+ @dataclass
181
+ class ApiResponseFor200Async(api_client.AsyncApiResponse):
182
+ body: AccountOrderRecordV2
183
+
184
+
185
+ _response_for_200 = api_client.OpenApiResponse(
186
+ response_cls=ApiResponseFor200,
187
+ response_cls_async=ApiResponseFor200Async,
188
+ content={
189
+ 'application/json': api_client.MediaType(
190
+ schema=SchemaFor200ResponseBodyApplicationJson),
191
+ },
192
+ )
193
+ SchemaFor400ResponseBodyApplicationJson = Model400FailedRequestResponseSchema
194
+
195
+
196
+ @dataclass
197
+ class ApiResponseFor400(api_client.ApiResponse):
198
+ body: Model400FailedRequestResponse
199
+
200
+
201
+ @dataclass
202
+ class ApiResponseFor400Async(api_client.AsyncApiResponse):
203
+ body: Model400FailedRequestResponse
204
+
205
+
206
+ _response_for_400 = api_client.OpenApiResponse(
207
+ response_cls=ApiResponseFor400,
208
+ response_cls_async=ApiResponseFor400Async,
209
+ content={
210
+ 'application/json': api_client.MediaType(
211
+ schema=SchemaFor400ResponseBodyApplicationJson),
212
+ },
213
+ )
214
+ SchemaFor404ResponseBodyApplicationJson = Model404FailedRequestResponseSchema
215
+
216
+
217
+ @dataclass
218
+ class ApiResponseFor404(api_client.ApiResponse):
219
+ body: Model404FailedRequestResponse
220
+
221
+
222
+ @dataclass
223
+ class ApiResponseFor404Async(api_client.AsyncApiResponse):
224
+ body: Model404FailedRequestResponse
225
+
226
+
227
+ _response_for_404 = api_client.OpenApiResponse(
228
+ response_cls=ApiResponseFor404,
229
+ response_cls_async=ApiResponseFor404Async,
230
+ content={
231
+ 'application/json': api_client.MediaType(
232
+ schema=SchemaFor404ResponseBodyApplicationJson),
233
+ },
234
+ )
235
+ SchemaFor500ResponseBodyApplicationJson = Model500UnexpectedExceptionResponseSchema
236
+
237
+
238
+ @dataclass
239
+ class ApiResponseFor500(api_client.ApiResponse):
240
+ body: Model500UnexpectedExceptionResponse
241
+
242
+
243
+ @dataclass
244
+ class ApiResponseFor500Async(api_client.AsyncApiResponse):
245
+ body: Model500UnexpectedExceptionResponse
246
+
247
+
248
+ _response_for_500 = api_client.OpenApiResponse(
249
+ response_cls=ApiResponseFor500,
250
+ response_cls_async=ApiResponseFor500Async,
251
+ content={
252
+ 'application/json': api_client.MediaType(
253
+ schema=SchemaFor500ResponseBodyApplicationJson),
254
+ },
255
+ )
256
+ _all_accept_content_types = (
257
+ 'application/json',
258
+ )
259
+
260
+
261
+ class BaseApi(api_client.Api):
262
+
263
+ def _get_user_account_order_detail_v2_mapped_args(
264
+ self,
265
+ body: typing.Optional[typing.Any] = None,
266
+ brokerage_order_id: typing.Optional[str] = None,
267
+ account_id: typing.Optional[str] = None,
268
+ user_id: typing.Optional[str] = None,
269
+ user_secret: typing.Optional[str] = None,
270
+ query_params: typing.Optional[dict] = {},
271
+ path_params: typing.Optional[dict] = {},
272
+ ) -> api_client.MappedArgs:
273
+ args: api_client.MappedArgs = api_client.MappedArgs()
274
+ _query_params = {}
275
+ _path_params = {}
276
+ _body = {}
277
+ if brokerage_order_id is not None:
278
+ _body["brokerage_order_id"] = brokerage_order_id
279
+ args.body = body if body is not None else _body
280
+ if user_id is not None:
281
+ _query_params["userId"] = user_id
282
+ if user_secret is not None:
283
+ _query_params["userSecret"] = user_secret
284
+ if account_id is not None:
285
+ _path_params["accountId"] = account_id
286
+ args.query = query_params if query_params else _query_params
287
+ args.path = path_params if path_params else _path_params
288
+ return args
289
+
290
+ async def _aget_user_account_order_detail_v2_oapg(
291
+ self,
292
+ body: typing.Any = None,
293
+ query_params: typing.Optional[dict] = {},
294
+ path_params: typing.Optional[dict] = {},
295
+ skip_deserialization: bool = True,
296
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
297
+ accept_content_types: typing.Tuple[str] = _all_accept_content_types,
298
+ content_type: str = 'application/json',
299
+ stream: bool = False,
300
+ **kwargs,
301
+ ) -> typing.Union[
302
+ ApiResponseFor200Async,
303
+ api_client.ApiResponseWithoutDeserializationAsync,
304
+ AsyncGeneratorResponse,
305
+ ]:
306
+ """
307
+ Get account order detail (V2)
308
+ :param skip_deserialization: If true then api_response.response will be set but
309
+ api_response.body and api_response.headers will not be deserialized into schema
310
+ class instances
311
+ """
312
+ self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
313
+ self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
314
+ used_path = path.value
315
+
316
+ _path_params = {}
317
+ for parameter in (
318
+ request_path_account_id,
319
+ ):
320
+ parameter_data = path_params.get(parameter.name, schemas.unset)
321
+ if parameter_data is schemas.unset:
322
+ continue
323
+ serialized_data = parameter.serialize(parameter_data)
324
+ _path_params.update(serialized_data)
325
+
326
+ for k, v in _path_params.items():
327
+ used_path = used_path.replace('{%s}' % k, v)
328
+
329
+ prefix_separator_iterator = None
330
+ for parameter in (
331
+ request_query_user_id,
332
+ request_query_user_secret,
333
+ ):
334
+ parameter_data = query_params.get(parameter.name, schemas.unset)
335
+ if parameter_data is schemas.unset:
336
+ continue
337
+ if prefix_separator_iterator is None:
338
+ prefix_separator_iterator = parameter.get_prefix_separator_iterator()
339
+ serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
340
+ for serialized_value in serialized_data.values():
341
+ used_path += serialized_value
342
+
343
+ _headers = HTTPHeaderDict()
344
+ # TODO add cookie handling
345
+ if accept_content_types:
346
+ for accept_content_type in accept_content_types:
347
+ _headers.add('Accept', accept_content_type)
348
+ method = 'post'.upper()
349
+ _headers.add('Content-Type', content_type)
350
+
351
+ if body is schemas.unset:
352
+ raise exceptions.ApiValueError(
353
+ 'The required body parameter has an invalid value of: unset. Set a valid value instead')
354
+ _fields = None
355
+ _body = None
356
+ request_before_hook(
357
+ resource_path=used_path,
358
+ method=method,
359
+ configuration=self.api_client.configuration,
360
+ path_template='/accounts/{accountId}/orders/details/v2',
361
+ body=body,
362
+ auth_settings=_auth,
363
+ headers=_headers,
364
+ )
365
+ serialized_data = request_body_typing_any.serialize(body, content_type)
366
+ if 'fields' in serialized_data:
367
+ _fields = serialized_data['fields']
368
+ elif 'body' in serialized_data:
369
+ _body = serialized_data['body']
370
+
371
+ response = await self.api_client.async_call_api(
372
+ resource_path=used_path,
373
+ method=method,
374
+ headers=_headers,
375
+ fields=_fields,
376
+ serialized_body=_body,
377
+ body=body,
378
+ auth_settings=_auth,
379
+ prefix_separator_iterator=prefix_separator_iterator,
380
+ timeout=timeout,
381
+ **kwargs
382
+ )
383
+
384
+ if stream:
385
+ if not 200 <= response.http_response.status <= 299:
386
+ body = (await response.http_response.content.read()).decode("utf-8")
387
+ raise exceptions.ApiStreamingException(
388
+ status=response.http_response.status,
389
+ reason=response.http_response.reason,
390
+ body=body,
391
+ )
392
+
393
+ async def stream_iterator():
394
+ """
395
+ iterates over response.http_response.content and closes connection once iteration has finished
396
+ """
397
+ async for line in response.http_response.content:
398
+ if line == b'\r\n':
399
+ continue
400
+ yield line
401
+ response.http_response.close()
402
+ await response.session.close()
403
+ return AsyncGeneratorResponse(
404
+ content=stream_iterator(),
405
+ headers=response.http_response.headers,
406
+ status=response.http_response.status,
407
+ response=response.http_response
408
+ )
409
+
410
+ response_for_status = _status_code_to_response.get(str(response.http_response.status))
411
+ if response_for_status:
412
+ api_response = await response_for_status.deserialize_async(
413
+ response,
414
+ self.api_client.configuration,
415
+ skip_deserialization=skip_deserialization
416
+ )
417
+ else:
418
+ # If response data is JSON then deserialize for SDK consumer convenience
419
+ is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
420
+ api_response = api_client.ApiResponseWithoutDeserializationAsync(
421
+ body=await response.http_response.json() if is_json else await response.http_response.text(),
422
+ response=response.http_response,
423
+ round_trip_time=response.round_trip_time,
424
+ status=response.http_response.status,
425
+ headers=response.http_response.headers,
426
+ )
427
+
428
+ if not 200 <= api_response.status <= 299:
429
+ raise exceptions.ApiException(api_response=api_response)
430
+
431
+ # cleanup session / response
432
+ response.http_response.close()
433
+ await response.session.close()
434
+
435
+ return api_response
436
+
437
+
438
+ def _get_user_account_order_detail_v2_oapg(
439
+ self,
440
+ body: typing.Any = None,
441
+ query_params: typing.Optional[dict] = {},
442
+ path_params: typing.Optional[dict] = {},
443
+ skip_deserialization: bool = True,
444
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
445
+ accept_content_types: typing.Tuple[str] = _all_accept_content_types,
446
+ content_type: str = 'application/json',
447
+ stream: bool = False,
448
+ ) -> typing.Union[
449
+ ApiResponseFor200,
450
+ api_client.ApiResponseWithoutDeserialization,
451
+ ]:
452
+ """
453
+ Get account order detail (V2)
454
+ :param skip_deserialization: If true then api_response.response will be set but
455
+ api_response.body and api_response.headers will not be deserialized into schema
456
+ class instances
457
+ """
458
+ self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
459
+ self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
460
+ used_path = path.value
461
+
462
+ _path_params = {}
463
+ for parameter in (
464
+ request_path_account_id,
465
+ ):
466
+ parameter_data = path_params.get(parameter.name, schemas.unset)
467
+ if parameter_data is schemas.unset:
468
+ continue
469
+ serialized_data = parameter.serialize(parameter_data)
470
+ _path_params.update(serialized_data)
471
+
472
+ for k, v in _path_params.items():
473
+ used_path = used_path.replace('{%s}' % k, v)
474
+
475
+ prefix_separator_iterator = None
476
+ for parameter in (
477
+ request_query_user_id,
478
+ request_query_user_secret,
479
+ ):
480
+ parameter_data = query_params.get(parameter.name, schemas.unset)
481
+ if parameter_data is schemas.unset:
482
+ continue
483
+ if prefix_separator_iterator is None:
484
+ prefix_separator_iterator = parameter.get_prefix_separator_iterator()
485
+ serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
486
+ for serialized_value in serialized_data.values():
487
+ used_path += serialized_value
488
+
489
+ _headers = HTTPHeaderDict()
490
+ # TODO add cookie handling
491
+ if accept_content_types:
492
+ for accept_content_type in accept_content_types:
493
+ _headers.add('Accept', accept_content_type)
494
+ method = 'post'.upper()
495
+ _headers.add('Content-Type', content_type)
496
+
497
+ if body is schemas.unset:
498
+ raise exceptions.ApiValueError(
499
+ 'The required body parameter has an invalid value of: unset. Set a valid value instead')
500
+ _fields = None
501
+ _body = None
502
+ request_before_hook(
503
+ resource_path=used_path,
504
+ method=method,
505
+ configuration=self.api_client.configuration,
506
+ path_template='/accounts/{accountId}/orders/details/v2',
507
+ body=body,
508
+ auth_settings=_auth,
509
+ headers=_headers,
510
+ )
511
+ serialized_data = request_body_typing_any.serialize(body, content_type)
512
+ if 'fields' in serialized_data:
513
+ _fields = serialized_data['fields']
514
+ elif 'body' in serialized_data:
515
+ _body = serialized_data['body']
516
+
517
+ response = self.api_client.call_api(
518
+ resource_path=used_path,
519
+ method=method,
520
+ headers=_headers,
521
+ fields=_fields,
522
+ serialized_body=_body,
523
+ body=body,
524
+ auth_settings=_auth,
525
+ prefix_separator_iterator=prefix_separator_iterator,
526
+ timeout=timeout,
527
+ )
528
+
529
+ response_for_status = _status_code_to_response.get(str(response.http_response.status))
530
+ if response_for_status:
531
+ api_response = response_for_status.deserialize(
532
+ response,
533
+ self.api_client.configuration,
534
+ skip_deserialization=skip_deserialization
535
+ )
536
+ else:
537
+ # If response data is JSON then deserialize for SDK consumer convenience
538
+ is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
539
+ api_response = api_client.ApiResponseWithoutDeserialization(
540
+ body=json.loads(response.http_response.data) if is_json else response.http_response.data,
541
+ response=response.http_response,
542
+ round_trip_time=response.round_trip_time,
543
+ status=response.http_response.status,
544
+ headers=response.http_response.headers,
545
+ )
546
+
547
+ if not 200 <= api_response.status <= 299:
548
+ raise exceptions.ApiException(api_response=api_response)
549
+
550
+ return api_response
551
+
552
+
553
+ class GetUserAccountOrderDetailV2(BaseApi):
554
+ # this class is used by api classes that refer to endpoints with operationId fn names
555
+
556
+ async def aget_user_account_order_detail_v2(
557
+ self,
558
+ body: typing.Optional[typing.Any] = None,
559
+ brokerage_order_id: typing.Optional[str] = None,
560
+ account_id: typing.Optional[str] = None,
561
+ user_id: typing.Optional[str] = None,
562
+ user_secret: typing.Optional[str] = None,
563
+ query_params: typing.Optional[dict] = {},
564
+ path_params: typing.Optional[dict] = {},
565
+ **kwargs,
566
+ ) -> typing.Union[
567
+ ApiResponseFor200Async,
568
+ api_client.ApiResponseWithoutDeserializationAsync,
569
+ AsyncGeneratorResponse,
570
+ ]:
571
+ args = self._get_user_account_order_detail_v2_mapped_args(
572
+ body=body,
573
+ query_params=query_params,
574
+ path_params=path_params,
575
+ brokerage_order_id=brokerage_order_id,
576
+ account_id=account_id,
577
+ user_id=user_id,
578
+ user_secret=user_secret,
579
+ )
580
+ return await self._aget_user_account_order_detail_v2_oapg(
581
+ body=args.body,
582
+ query_params=args.query,
583
+ path_params=args.path,
584
+ **kwargs,
585
+ )
586
+
587
+ def get_user_account_order_detail_v2(
588
+ self,
589
+ body: typing.Optional[typing.Any] = None,
590
+ brokerage_order_id: typing.Optional[str] = None,
591
+ account_id: typing.Optional[str] = None,
592
+ user_id: typing.Optional[str] = None,
593
+ user_secret: typing.Optional[str] = None,
594
+ query_params: typing.Optional[dict] = {},
595
+ path_params: typing.Optional[dict] = {},
596
+ ) -> typing.Union[
597
+ ApiResponseFor200,
598
+ api_client.ApiResponseWithoutDeserialization,
599
+ ]:
600
+ """ Returns the detail of a single order using the external order ID provided in the request body. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. 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. """
601
+ args = self._get_user_account_order_detail_v2_mapped_args(
602
+ body=body,
603
+ query_params=query_params,
604
+ path_params=path_params,
605
+ brokerage_order_id=brokerage_order_id,
606
+ account_id=account_id,
607
+ user_id=user_id,
608
+ user_secret=user_secret,
609
+ )
610
+ return self._get_user_account_order_detail_v2_oapg(
611
+ body=args.body,
612
+ query_params=args.query,
613
+ path_params=args.path,
614
+ )
615
+
616
+ class ApiForpost(BaseApi):
617
+ # this class is used by api classes that refer to endpoints by path and http method names
618
+
619
+ async def apost(
620
+ self,
621
+ body: typing.Optional[typing.Any] = None,
622
+ brokerage_order_id: typing.Optional[str] = None,
623
+ account_id: typing.Optional[str] = None,
624
+ user_id: typing.Optional[str] = None,
625
+ user_secret: typing.Optional[str] = None,
626
+ query_params: typing.Optional[dict] = {},
627
+ path_params: typing.Optional[dict] = {},
628
+ **kwargs,
629
+ ) -> typing.Union[
630
+ ApiResponseFor200Async,
631
+ api_client.ApiResponseWithoutDeserializationAsync,
632
+ AsyncGeneratorResponse,
633
+ ]:
634
+ args = self._get_user_account_order_detail_v2_mapped_args(
635
+ body=body,
636
+ query_params=query_params,
637
+ path_params=path_params,
638
+ brokerage_order_id=brokerage_order_id,
639
+ account_id=account_id,
640
+ user_id=user_id,
641
+ user_secret=user_secret,
642
+ )
643
+ return await self._aget_user_account_order_detail_v2_oapg(
644
+ body=args.body,
645
+ query_params=args.query,
646
+ path_params=args.path,
647
+ **kwargs,
648
+ )
649
+
650
+ def post(
651
+ self,
652
+ body: typing.Optional[typing.Any] = None,
653
+ brokerage_order_id: typing.Optional[str] = None,
654
+ account_id: typing.Optional[str] = None,
655
+ user_id: typing.Optional[str] = None,
656
+ user_secret: typing.Optional[str] = None,
657
+ query_params: typing.Optional[dict] = {},
658
+ path_params: typing.Optional[dict] = {},
659
+ ) -> typing.Union[
660
+ ApiResponseFor200,
661
+ api_client.ApiResponseWithoutDeserialization,
662
+ ]:
663
+ """ Returns the detail of a single order using the external order ID provided in the request body. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. 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. """
664
+ args = self._get_user_account_order_detail_v2_mapped_args(
665
+ body=body,
666
+ query_params=query_params,
667
+ path_params=path_params,
668
+ brokerage_order_id=brokerage_order_id,
669
+ account_id=account_id,
670
+ user_id=user_id,
671
+ user_secret=user_secret,
672
+ )
673
+ return self._get_user_account_order_detail_v2_oapg(
674
+ body=args.body,
675
+ query_params=args.query,
676
+ path_params=args.path,
677
+ )
678
+