snaptrade-python-sdk 11.0.142__py3-none-any.whl → 11.0.144__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.
- snaptrade_client/__init__.py +1 -1
- snaptrade_client/api_client.py +1 -1
- snaptrade_client/apis/path_to_api.py +6 -0
- snaptrade_client/apis/paths/accounts_account_id_orders_v2.py +7 -0
- snaptrade_client/apis/paths/accounts_account_id_recent_orders_v2.py +7 -0
- snaptrade_client/apis/tag_to_api.py +3 -0
- snaptrade_client/apis/tags/__init__.py +1 -0
- snaptrade_client/apis/tags/experimental_endpoints_api.py +6 -0
- snaptrade_client/apis/tags/experimental_endpoints_api_generated.py +23 -0
- snaptrade_client/client.py +2 -0
- snaptrade_client/client.pyi +2 -0
- snaptrade_client/configuration.py +1 -1
- snaptrade_client/model/account_order_record_leg.py +252 -0
- snaptrade_client/model/account_order_record_leg.pyi +252 -0
- snaptrade_client/model/account_order_record_leg_instrument.py +137 -0
- snaptrade_client/model/account_order_record_leg_instrument.pyi +137 -0
- snaptrade_client/model/account_order_record_status.py +18 -0
- snaptrade_client/model/account_order_record_status.pyi +18 -0
- snaptrade_client/model/account_order_record_status_v2.py +90 -0
- snaptrade_client/model/account_order_record_status_v2.pyi +75 -0
- snaptrade_client/model/account_order_record_status_v2_nullable.py +105 -0
- snaptrade_client/model/account_order_record_status_v2_nullable.pyi +105 -0
- snaptrade_client/model/account_order_record_v2.py +309 -0
- snaptrade_client/model/account_order_record_v2.pyi +309 -0
- snaptrade_client/model/account_orders_v2_response.py +110 -0
- snaptrade_client/model/account_orders_v2_response.pyi +110 -0
- snaptrade_client/model/action_strict_v2.py +25 -0
- snaptrade_client/model/action_strict_v2.pyi +25 -0
- snaptrade_client/models/__init__.py +7 -0
- snaptrade_client/operation_parameter_map.py +35 -0
- snaptrade_client/paths/__init__.py +2 -0
- snaptrade_client/paths/accounts_account_id_orders_v2/__init__.py +7 -0
- snaptrade_client/paths/accounts_account_id_orders_v2/get.py +592 -0
- snaptrade_client/paths/accounts_account_id_orders_v2/get.pyi +569 -0
- snaptrade_client/paths/accounts_account_id_recent_orders_v2/__init__.py +7 -0
- snaptrade_client/paths/accounts_account_id_recent_orders_v2/get.py +561 -0
- snaptrade_client/paths/accounts_account_id_recent_orders_v2/get.pyi +549 -0
- snaptrade_client/type/account_order_record_leg.py +48 -0
- snaptrade_client/type/account_order_record_leg_instrument.py +39 -0
- snaptrade_client/type/account_order_record_status_v2.py +19 -0
- snaptrade_client/type/account_order_record_status_v2_nullable.py +19 -0
- snaptrade_client/type/account_order_record_v2.py +58 -0
- snaptrade_client/type/account_orders_v2_response.py +28 -0
- snaptrade_client/type/account_universal_activity.py +1 -1
- snaptrade_client/type/action_strict_v2.py +19 -0
- {snaptrade_python_sdk-11.0.142.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/METADATA +103 -4
- {snaptrade_python_sdk-11.0.142.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/RECORD +49 -18
- {snaptrade_python_sdk-11.0.142.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/LICENSE +0 -0
- {snaptrade_python_sdk-11.0.142.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,569 @@
|
|
|
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.account_orders_v2_response import AccountOrdersV2Response as AccountOrdersV2ResponseSchema
|
|
36
|
+
from snaptrade_client.model.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse as Model500UnexpectedExceptionResponseSchema
|
|
37
|
+
|
|
38
|
+
from snaptrade_client.type.account_orders_v2_response import AccountOrdersV2Response
|
|
39
|
+
from snaptrade_client.type.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse
|
|
40
|
+
|
|
41
|
+
# Query params
|
|
42
|
+
UserIdSchema = schemas.StrSchema
|
|
43
|
+
UserSecretSchema = schemas.StrSchema
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class StateSchema(
|
|
47
|
+
schemas.EnumBase,
|
|
48
|
+
schemas.StrSchema
|
|
49
|
+
):
|
|
50
|
+
|
|
51
|
+
@schemas.classproperty
|
|
52
|
+
def ALL(cls):
|
|
53
|
+
return cls("all")
|
|
54
|
+
|
|
55
|
+
@schemas.classproperty
|
|
56
|
+
def OPEN(cls):
|
|
57
|
+
return cls("open")
|
|
58
|
+
|
|
59
|
+
@schemas.classproperty
|
|
60
|
+
def EXECUTED(cls):
|
|
61
|
+
return cls("executed")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class DaysSchema(
|
|
65
|
+
schemas.Int32Schema
|
|
66
|
+
):
|
|
67
|
+
pass
|
|
68
|
+
RequestRequiredQueryParams = typing_extensions.TypedDict(
|
|
69
|
+
'RequestRequiredQueryParams',
|
|
70
|
+
{
|
|
71
|
+
'userId': typing.Union[UserIdSchema, str, ],
|
|
72
|
+
'userSecret': typing.Union[UserSecretSchema, str, ],
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
RequestOptionalQueryParams = typing_extensions.TypedDict(
|
|
76
|
+
'RequestOptionalQueryParams',
|
|
77
|
+
{
|
|
78
|
+
'state': typing.Union[StateSchema, str, ],
|
|
79
|
+
'days': typing.Union[DaysSchema, decimal.Decimal, int, ],
|
|
80
|
+
},
|
|
81
|
+
total=False
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams):
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
request_query_user_id = api_client.QueryParameter(
|
|
90
|
+
name="userId",
|
|
91
|
+
style=api_client.ParameterStyle.FORM,
|
|
92
|
+
schema=UserIdSchema,
|
|
93
|
+
required=True,
|
|
94
|
+
explode=True,
|
|
95
|
+
)
|
|
96
|
+
request_query_user_secret = api_client.QueryParameter(
|
|
97
|
+
name="userSecret",
|
|
98
|
+
style=api_client.ParameterStyle.FORM,
|
|
99
|
+
schema=UserSecretSchema,
|
|
100
|
+
required=True,
|
|
101
|
+
explode=True,
|
|
102
|
+
)
|
|
103
|
+
request_query_state = api_client.QueryParameter(
|
|
104
|
+
name="state",
|
|
105
|
+
style=api_client.ParameterStyle.FORM,
|
|
106
|
+
schema=StateSchema,
|
|
107
|
+
explode=True,
|
|
108
|
+
)
|
|
109
|
+
request_query_days = api_client.QueryParameter(
|
|
110
|
+
name="days",
|
|
111
|
+
style=api_client.ParameterStyle.FORM,
|
|
112
|
+
schema=DaysSchema,
|
|
113
|
+
explode=True,
|
|
114
|
+
)
|
|
115
|
+
# Path params
|
|
116
|
+
AccountIdSchema = schemas.UUIDSchema
|
|
117
|
+
RequestRequiredPathParams = typing_extensions.TypedDict(
|
|
118
|
+
'RequestRequiredPathParams',
|
|
119
|
+
{
|
|
120
|
+
'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
RequestOptionalPathParams = typing_extensions.TypedDict(
|
|
124
|
+
'RequestOptionalPathParams',
|
|
125
|
+
{
|
|
126
|
+
},
|
|
127
|
+
total=False
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams):
|
|
132
|
+
pass
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
request_path_account_id = api_client.PathParameter(
|
|
136
|
+
name="accountId",
|
|
137
|
+
style=api_client.ParameterStyle.SIMPLE,
|
|
138
|
+
schema=AccountIdSchema,
|
|
139
|
+
required=True,
|
|
140
|
+
)
|
|
141
|
+
SchemaFor200ResponseBodyApplicationJson = AccountOrdersV2ResponseSchema
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@dataclass
|
|
145
|
+
class ApiResponseFor200(api_client.ApiResponse):
|
|
146
|
+
body: AccountOrdersV2Response
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@dataclass
|
|
150
|
+
class ApiResponseFor200Async(api_client.AsyncApiResponse):
|
|
151
|
+
body: AccountOrdersV2Response
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
_response_for_200 = api_client.OpenApiResponse(
|
|
155
|
+
response_cls=ApiResponseFor200,
|
|
156
|
+
response_cls_async=ApiResponseFor200Async,
|
|
157
|
+
content={
|
|
158
|
+
'application/json': api_client.MediaType(
|
|
159
|
+
schema=SchemaFor200ResponseBodyApplicationJson),
|
|
160
|
+
},
|
|
161
|
+
)
|
|
162
|
+
SchemaFor500ResponseBodyApplicationJson = Model500UnexpectedExceptionResponseSchema
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@dataclass
|
|
166
|
+
class ApiResponseFor500(api_client.ApiResponse):
|
|
167
|
+
body: Model500UnexpectedExceptionResponse
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@dataclass
|
|
171
|
+
class ApiResponseFor500Async(api_client.AsyncApiResponse):
|
|
172
|
+
body: Model500UnexpectedExceptionResponse
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
_response_for_500 = api_client.OpenApiResponse(
|
|
176
|
+
response_cls=ApiResponseFor500,
|
|
177
|
+
response_cls_async=ApiResponseFor500Async,
|
|
178
|
+
content={
|
|
179
|
+
'application/json': api_client.MediaType(
|
|
180
|
+
schema=SchemaFor500ResponseBodyApplicationJson),
|
|
181
|
+
},
|
|
182
|
+
)
|
|
183
|
+
_all_accept_content_types = (
|
|
184
|
+
'application/json',
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class BaseApi(api_client.Api):
|
|
189
|
+
|
|
190
|
+
def _get_user_account_orders_v2_mapped_args(
|
|
191
|
+
self,
|
|
192
|
+
user_id: typing.Optional[str] = None,
|
|
193
|
+
user_secret: typing.Optional[str] = None,
|
|
194
|
+
account_id: typing.Optional[str] = None,
|
|
195
|
+
state: typing.Optional[str] = None,
|
|
196
|
+
days: typing.Optional[int] = None,
|
|
197
|
+
query_params: typing.Optional[dict] = {},
|
|
198
|
+
path_params: typing.Optional[dict] = {},
|
|
199
|
+
) -> api_client.MappedArgs:
|
|
200
|
+
args: api_client.MappedArgs = api_client.MappedArgs()
|
|
201
|
+
_query_params = {}
|
|
202
|
+
_path_params = {}
|
|
203
|
+
if user_id is not None:
|
|
204
|
+
_query_params["userId"] = user_id
|
|
205
|
+
if user_secret is not None:
|
|
206
|
+
_query_params["userSecret"] = user_secret
|
|
207
|
+
if state is not None:
|
|
208
|
+
_query_params["state"] = state
|
|
209
|
+
if days is not None:
|
|
210
|
+
_query_params["days"] = days
|
|
211
|
+
if account_id is not None:
|
|
212
|
+
_path_params["accountId"] = account_id
|
|
213
|
+
args.query = query_params if query_params else _query_params
|
|
214
|
+
args.path = path_params if path_params else _path_params
|
|
215
|
+
return args
|
|
216
|
+
|
|
217
|
+
async def _aget_user_account_orders_v2_oapg(
|
|
218
|
+
self,
|
|
219
|
+
query_params: typing.Optional[dict] = {},
|
|
220
|
+
path_params: typing.Optional[dict] = {},
|
|
221
|
+
skip_deserialization: bool = True,
|
|
222
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
223
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
224
|
+
stream: bool = False,
|
|
225
|
+
**kwargs,
|
|
226
|
+
) -> typing.Union[
|
|
227
|
+
ApiResponseFor200Async,
|
|
228
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
229
|
+
AsyncGeneratorResponse,
|
|
230
|
+
]:
|
|
231
|
+
"""
|
|
232
|
+
List account orders v2
|
|
233
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
234
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
235
|
+
class instances
|
|
236
|
+
"""
|
|
237
|
+
self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
|
|
238
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
239
|
+
used_path = path.value
|
|
240
|
+
|
|
241
|
+
_path_params = {}
|
|
242
|
+
for parameter in (
|
|
243
|
+
request_path_account_id,
|
|
244
|
+
):
|
|
245
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
246
|
+
if parameter_data is schemas.unset:
|
|
247
|
+
continue
|
|
248
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
249
|
+
_path_params.update(serialized_data)
|
|
250
|
+
|
|
251
|
+
for k, v in _path_params.items():
|
|
252
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
253
|
+
|
|
254
|
+
prefix_separator_iterator = None
|
|
255
|
+
for parameter in (
|
|
256
|
+
request_query_user_id,
|
|
257
|
+
request_query_user_secret,
|
|
258
|
+
request_query_state,
|
|
259
|
+
request_query_days,
|
|
260
|
+
):
|
|
261
|
+
parameter_data = query_params.get(parameter.name, schemas.unset)
|
|
262
|
+
if parameter_data is schemas.unset:
|
|
263
|
+
continue
|
|
264
|
+
if prefix_separator_iterator is None:
|
|
265
|
+
prefix_separator_iterator = parameter.get_prefix_separator_iterator()
|
|
266
|
+
serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
|
|
267
|
+
for serialized_value in serialized_data.values():
|
|
268
|
+
used_path += serialized_value
|
|
269
|
+
|
|
270
|
+
_headers = HTTPHeaderDict()
|
|
271
|
+
# TODO add cookie handling
|
|
272
|
+
if accept_content_types:
|
|
273
|
+
for accept_content_type in accept_content_types:
|
|
274
|
+
_headers.add('Accept', accept_content_type)
|
|
275
|
+
method = 'get'.upper()
|
|
276
|
+
request_before_hook(
|
|
277
|
+
resource_path=used_path,
|
|
278
|
+
method=method,
|
|
279
|
+
configuration=self.api_client.configuration,
|
|
280
|
+
path_template='/accounts/{accountId}/orders/v2',
|
|
281
|
+
auth_settings=_auth,
|
|
282
|
+
headers=_headers,
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
response = await self.api_client.async_call_api(
|
|
286
|
+
resource_path=used_path,
|
|
287
|
+
method=method,
|
|
288
|
+
headers=_headers,
|
|
289
|
+
auth_settings=_auth,
|
|
290
|
+
prefix_separator_iterator=prefix_separator_iterator,
|
|
291
|
+
timeout=timeout,
|
|
292
|
+
**kwargs
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
if stream:
|
|
296
|
+
if not 200 <= response.http_response.status <= 299:
|
|
297
|
+
body = (await response.http_response.content.read()).decode("utf-8")
|
|
298
|
+
raise exceptions.ApiStreamingException(
|
|
299
|
+
status=response.http_response.status,
|
|
300
|
+
reason=response.http_response.reason,
|
|
301
|
+
body=body,
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
async def stream_iterator():
|
|
305
|
+
"""
|
|
306
|
+
iterates over response.http_response.content and closes connection once iteration has finished
|
|
307
|
+
"""
|
|
308
|
+
async for line in response.http_response.content:
|
|
309
|
+
if line == b'\r\n':
|
|
310
|
+
continue
|
|
311
|
+
yield line
|
|
312
|
+
response.http_response.close()
|
|
313
|
+
await response.session.close()
|
|
314
|
+
return AsyncGeneratorResponse(
|
|
315
|
+
content=stream_iterator(),
|
|
316
|
+
headers=response.http_response.headers,
|
|
317
|
+
status=response.http_response.status,
|
|
318
|
+
response=response.http_response
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
response_for_status = _status_code_to_response.get(str(response.http_response.status))
|
|
322
|
+
if response_for_status:
|
|
323
|
+
api_response = await response_for_status.deserialize_async(
|
|
324
|
+
response,
|
|
325
|
+
self.api_client.configuration,
|
|
326
|
+
skip_deserialization=skip_deserialization
|
|
327
|
+
)
|
|
328
|
+
else:
|
|
329
|
+
# If response data is JSON then deserialize for SDK consumer convenience
|
|
330
|
+
is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
|
|
331
|
+
api_response = api_client.ApiResponseWithoutDeserializationAsync(
|
|
332
|
+
body=await response.http_response.json() if is_json else await response.http_response.text(),
|
|
333
|
+
response=response.http_response,
|
|
334
|
+
round_trip_time=response.round_trip_time,
|
|
335
|
+
status=response.http_response.status,
|
|
336
|
+
headers=response.http_response.headers,
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
if not 200 <= api_response.status <= 299:
|
|
340
|
+
raise exceptions.ApiException(api_response=api_response)
|
|
341
|
+
|
|
342
|
+
# cleanup session / response
|
|
343
|
+
response.http_response.close()
|
|
344
|
+
await response.session.close()
|
|
345
|
+
|
|
346
|
+
return api_response
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
def _get_user_account_orders_v2_oapg(
|
|
350
|
+
self,
|
|
351
|
+
query_params: typing.Optional[dict] = {},
|
|
352
|
+
path_params: typing.Optional[dict] = {},
|
|
353
|
+
skip_deserialization: bool = True,
|
|
354
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
355
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
356
|
+
stream: bool = False,
|
|
357
|
+
) -> typing.Union[
|
|
358
|
+
ApiResponseFor200,
|
|
359
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
360
|
+
]:
|
|
361
|
+
"""
|
|
362
|
+
List account orders v2
|
|
363
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
364
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
365
|
+
class instances
|
|
366
|
+
"""
|
|
367
|
+
self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
|
|
368
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
369
|
+
used_path = path.value
|
|
370
|
+
|
|
371
|
+
_path_params = {}
|
|
372
|
+
for parameter in (
|
|
373
|
+
request_path_account_id,
|
|
374
|
+
):
|
|
375
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
376
|
+
if parameter_data is schemas.unset:
|
|
377
|
+
continue
|
|
378
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
379
|
+
_path_params.update(serialized_data)
|
|
380
|
+
|
|
381
|
+
for k, v in _path_params.items():
|
|
382
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
383
|
+
|
|
384
|
+
prefix_separator_iterator = None
|
|
385
|
+
for parameter in (
|
|
386
|
+
request_query_user_id,
|
|
387
|
+
request_query_user_secret,
|
|
388
|
+
request_query_state,
|
|
389
|
+
request_query_days,
|
|
390
|
+
):
|
|
391
|
+
parameter_data = query_params.get(parameter.name, schemas.unset)
|
|
392
|
+
if parameter_data is schemas.unset:
|
|
393
|
+
continue
|
|
394
|
+
if prefix_separator_iterator is None:
|
|
395
|
+
prefix_separator_iterator = parameter.get_prefix_separator_iterator()
|
|
396
|
+
serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
|
|
397
|
+
for serialized_value in serialized_data.values():
|
|
398
|
+
used_path += serialized_value
|
|
399
|
+
|
|
400
|
+
_headers = HTTPHeaderDict()
|
|
401
|
+
# TODO add cookie handling
|
|
402
|
+
if accept_content_types:
|
|
403
|
+
for accept_content_type in accept_content_types:
|
|
404
|
+
_headers.add('Accept', accept_content_type)
|
|
405
|
+
method = 'get'.upper()
|
|
406
|
+
request_before_hook(
|
|
407
|
+
resource_path=used_path,
|
|
408
|
+
method=method,
|
|
409
|
+
configuration=self.api_client.configuration,
|
|
410
|
+
path_template='/accounts/{accountId}/orders/v2',
|
|
411
|
+
auth_settings=_auth,
|
|
412
|
+
headers=_headers,
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
response = self.api_client.call_api(
|
|
416
|
+
resource_path=used_path,
|
|
417
|
+
method=method,
|
|
418
|
+
headers=_headers,
|
|
419
|
+
auth_settings=_auth,
|
|
420
|
+
prefix_separator_iterator=prefix_separator_iterator,
|
|
421
|
+
timeout=timeout,
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
response_for_status = _status_code_to_response.get(str(response.http_response.status))
|
|
425
|
+
if response_for_status:
|
|
426
|
+
api_response = response_for_status.deserialize(
|
|
427
|
+
response,
|
|
428
|
+
self.api_client.configuration,
|
|
429
|
+
skip_deserialization=skip_deserialization
|
|
430
|
+
)
|
|
431
|
+
else:
|
|
432
|
+
# If response data is JSON then deserialize for SDK consumer convenience
|
|
433
|
+
is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
|
|
434
|
+
api_response = api_client.ApiResponseWithoutDeserialization(
|
|
435
|
+
body=json.loads(response.http_response.data) if is_json else response.http_response.data,
|
|
436
|
+
response=response.http_response,
|
|
437
|
+
round_trip_time=response.round_trip_time,
|
|
438
|
+
status=response.http_response.status,
|
|
439
|
+
headers=response.http_response.headers,
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
if not 200 <= api_response.status <= 299:
|
|
443
|
+
raise exceptions.ApiException(api_response=api_response)
|
|
444
|
+
|
|
445
|
+
return api_response
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
class GetUserAccountOrdersV2(BaseApi):
|
|
449
|
+
# this class is used by api classes that refer to endpoints with operationId fn names
|
|
450
|
+
|
|
451
|
+
async def aget_user_account_orders_v2(
|
|
452
|
+
self,
|
|
453
|
+
user_id: typing.Optional[str] = None,
|
|
454
|
+
user_secret: typing.Optional[str] = None,
|
|
455
|
+
account_id: typing.Optional[str] = None,
|
|
456
|
+
state: typing.Optional[str] = None,
|
|
457
|
+
days: typing.Optional[int] = None,
|
|
458
|
+
query_params: typing.Optional[dict] = {},
|
|
459
|
+
path_params: typing.Optional[dict] = {},
|
|
460
|
+
**kwargs,
|
|
461
|
+
) -> typing.Union[
|
|
462
|
+
ApiResponseFor200Async,
|
|
463
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
464
|
+
AsyncGeneratorResponse,
|
|
465
|
+
]:
|
|
466
|
+
args = self._get_user_account_orders_v2_mapped_args(
|
|
467
|
+
query_params=query_params,
|
|
468
|
+
path_params=path_params,
|
|
469
|
+
user_id=user_id,
|
|
470
|
+
user_secret=user_secret,
|
|
471
|
+
account_id=account_id,
|
|
472
|
+
state=state,
|
|
473
|
+
days=days,
|
|
474
|
+
)
|
|
475
|
+
return await self._aget_user_account_orders_v2_oapg(
|
|
476
|
+
query_params=args.query,
|
|
477
|
+
path_params=args.path,
|
|
478
|
+
**kwargs,
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
def get_user_account_orders_v2(
|
|
482
|
+
self,
|
|
483
|
+
user_id: typing.Optional[str] = None,
|
|
484
|
+
user_secret: typing.Optional[str] = None,
|
|
485
|
+
account_id: typing.Optional[str] = None,
|
|
486
|
+
state: typing.Optional[str] = None,
|
|
487
|
+
days: typing.Optional[int] = None,
|
|
488
|
+
query_params: typing.Optional[dict] = {},
|
|
489
|
+
path_params: typing.Optional[dict] = {},
|
|
490
|
+
) -> typing.Union[
|
|
491
|
+
ApiResponseFor200,
|
|
492
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
493
|
+
]:
|
|
494
|
+
""" Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection. """
|
|
495
|
+
args = self._get_user_account_orders_v2_mapped_args(
|
|
496
|
+
query_params=query_params,
|
|
497
|
+
path_params=path_params,
|
|
498
|
+
user_id=user_id,
|
|
499
|
+
user_secret=user_secret,
|
|
500
|
+
account_id=account_id,
|
|
501
|
+
state=state,
|
|
502
|
+
days=days,
|
|
503
|
+
)
|
|
504
|
+
return self._get_user_account_orders_v2_oapg(
|
|
505
|
+
query_params=args.query,
|
|
506
|
+
path_params=args.path,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
class ApiForget(BaseApi):
|
|
510
|
+
# this class is used by api classes that refer to endpoints by path and http method names
|
|
511
|
+
|
|
512
|
+
async def aget(
|
|
513
|
+
self,
|
|
514
|
+
user_id: typing.Optional[str] = None,
|
|
515
|
+
user_secret: typing.Optional[str] = None,
|
|
516
|
+
account_id: typing.Optional[str] = None,
|
|
517
|
+
state: typing.Optional[str] = None,
|
|
518
|
+
days: typing.Optional[int] = None,
|
|
519
|
+
query_params: typing.Optional[dict] = {},
|
|
520
|
+
path_params: typing.Optional[dict] = {},
|
|
521
|
+
**kwargs,
|
|
522
|
+
) -> typing.Union[
|
|
523
|
+
ApiResponseFor200Async,
|
|
524
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
525
|
+
AsyncGeneratorResponse,
|
|
526
|
+
]:
|
|
527
|
+
args = self._get_user_account_orders_v2_mapped_args(
|
|
528
|
+
query_params=query_params,
|
|
529
|
+
path_params=path_params,
|
|
530
|
+
user_id=user_id,
|
|
531
|
+
user_secret=user_secret,
|
|
532
|
+
account_id=account_id,
|
|
533
|
+
state=state,
|
|
534
|
+
days=days,
|
|
535
|
+
)
|
|
536
|
+
return await self._aget_user_account_orders_v2_oapg(
|
|
537
|
+
query_params=args.query,
|
|
538
|
+
path_params=args.path,
|
|
539
|
+
**kwargs,
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
def get(
|
|
543
|
+
self,
|
|
544
|
+
user_id: typing.Optional[str] = None,
|
|
545
|
+
user_secret: typing.Optional[str] = None,
|
|
546
|
+
account_id: typing.Optional[str] = None,
|
|
547
|
+
state: typing.Optional[str] = None,
|
|
548
|
+
days: typing.Optional[int] = None,
|
|
549
|
+
query_params: typing.Optional[dict] = {},
|
|
550
|
+
path_params: typing.Optional[dict] = {},
|
|
551
|
+
) -> typing.Union[
|
|
552
|
+
ApiResponseFor200,
|
|
553
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
554
|
+
]:
|
|
555
|
+
""" Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection. """
|
|
556
|
+
args = self._get_user_account_orders_v2_mapped_args(
|
|
557
|
+
query_params=query_params,
|
|
558
|
+
path_params=path_params,
|
|
559
|
+
user_id=user_id,
|
|
560
|
+
user_secret=user_secret,
|
|
561
|
+
account_id=account_id,
|
|
562
|
+
state=state,
|
|
563
|
+
days=days,
|
|
564
|
+
)
|
|
565
|
+
return self._get_user_account_orders_v2_oapg(
|
|
566
|
+
query_params=args.query,
|
|
567
|
+
path_params=args.path,
|
|
568
|
+
)
|
|
569
|
+
|
|
@@ -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.accounts_account_id_recent_orders_v2 import Api
|
|
4
|
+
|
|
5
|
+
from snaptrade_client.paths import PathValues
|
|
6
|
+
|
|
7
|
+
path = PathValues.ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS_V2
|