snaptrade-python-sdk 11.0.143__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_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/action_strict_v2.py +19 -0
- {snaptrade_python_sdk-11.0.143.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/METADATA +102 -3
- {snaptrade_python_sdk-11.0.143.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/RECORD +46 -15
- {snaptrade_python_sdk-11.0.143.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/LICENSE +0 -0
- {snaptrade_python_sdk-11.0.143.dist-info → snaptrade_python_sdk-11.0.144.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,561 @@
|
|
|
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
|
+
from snaptrade_client.model.model403_feature_not_enabled_response import Model403FeatureNotEnabledResponse as Model403FeatureNotEnabledResponseSchema
|
|
38
|
+
|
|
39
|
+
from snaptrade_client.type.account_orders_v2_response import AccountOrdersV2Response
|
|
40
|
+
from snaptrade_client.type.model403_feature_not_enabled_response import Model403FeatureNotEnabledResponse
|
|
41
|
+
from snaptrade_client.type.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse
|
|
42
|
+
|
|
43
|
+
from . import path
|
|
44
|
+
|
|
45
|
+
# Query params
|
|
46
|
+
UserIdSchema = schemas.StrSchema
|
|
47
|
+
UserSecretSchema = schemas.StrSchema
|
|
48
|
+
OnlyExecutedSchema = schemas.BoolSchema
|
|
49
|
+
RequestRequiredQueryParams = typing_extensions.TypedDict(
|
|
50
|
+
'RequestRequiredQueryParams',
|
|
51
|
+
{
|
|
52
|
+
'userId': typing.Union[UserIdSchema, str, ],
|
|
53
|
+
'userSecret': typing.Union[UserSecretSchema, str, ],
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
RequestOptionalQueryParams = typing_extensions.TypedDict(
|
|
57
|
+
'RequestOptionalQueryParams',
|
|
58
|
+
{
|
|
59
|
+
'only_executed': typing.Union[OnlyExecutedSchema, bool, ],
|
|
60
|
+
},
|
|
61
|
+
total=False
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
request_query_user_id = api_client.QueryParameter(
|
|
70
|
+
name="userId",
|
|
71
|
+
style=api_client.ParameterStyle.FORM,
|
|
72
|
+
schema=UserIdSchema,
|
|
73
|
+
required=True,
|
|
74
|
+
explode=True,
|
|
75
|
+
)
|
|
76
|
+
request_query_user_secret = api_client.QueryParameter(
|
|
77
|
+
name="userSecret",
|
|
78
|
+
style=api_client.ParameterStyle.FORM,
|
|
79
|
+
schema=UserSecretSchema,
|
|
80
|
+
required=True,
|
|
81
|
+
explode=True,
|
|
82
|
+
)
|
|
83
|
+
request_query_only_executed = api_client.QueryParameter(
|
|
84
|
+
name="only_executed",
|
|
85
|
+
style=api_client.ParameterStyle.FORM,
|
|
86
|
+
schema=OnlyExecutedSchema,
|
|
87
|
+
explode=True,
|
|
88
|
+
)
|
|
89
|
+
# Path params
|
|
90
|
+
AccountIdSchema = schemas.UUIDSchema
|
|
91
|
+
RequestRequiredPathParams = typing_extensions.TypedDict(
|
|
92
|
+
'RequestRequiredPathParams',
|
|
93
|
+
{
|
|
94
|
+
'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
RequestOptionalPathParams = typing_extensions.TypedDict(
|
|
98
|
+
'RequestOptionalPathParams',
|
|
99
|
+
{
|
|
100
|
+
},
|
|
101
|
+
total=False
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams):
|
|
106
|
+
pass
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
request_path_account_id = api_client.PathParameter(
|
|
110
|
+
name="accountId",
|
|
111
|
+
style=api_client.ParameterStyle.SIMPLE,
|
|
112
|
+
schema=AccountIdSchema,
|
|
113
|
+
required=True,
|
|
114
|
+
)
|
|
115
|
+
_auth = [
|
|
116
|
+
'PartnerClientId',
|
|
117
|
+
'PartnerSignature',
|
|
118
|
+
'PartnerTimestamp',
|
|
119
|
+
]
|
|
120
|
+
SchemaFor200ResponseBodyApplicationJson = AccountOrdersV2ResponseSchema
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass
|
|
124
|
+
class ApiResponseFor200(api_client.ApiResponse):
|
|
125
|
+
body: AccountOrdersV2Response
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@dataclass
|
|
129
|
+
class ApiResponseFor200Async(api_client.AsyncApiResponse):
|
|
130
|
+
body: AccountOrdersV2Response
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
_response_for_200 = api_client.OpenApiResponse(
|
|
134
|
+
response_cls=ApiResponseFor200,
|
|
135
|
+
response_cls_async=ApiResponseFor200Async,
|
|
136
|
+
content={
|
|
137
|
+
'application/json': api_client.MediaType(
|
|
138
|
+
schema=SchemaFor200ResponseBodyApplicationJson),
|
|
139
|
+
},
|
|
140
|
+
)
|
|
141
|
+
SchemaFor403ResponseBodyApplicationJson = Model403FeatureNotEnabledResponseSchema
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@dataclass
|
|
145
|
+
class ApiResponseFor403(api_client.ApiResponse):
|
|
146
|
+
body: Model403FeatureNotEnabledResponse
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@dataclass
|
|
150
|
+
class ApiResponseFor403Async(api_client.AsyncApiResponse):
|
|
151
|
+
body: Model403FeatureNotEnabledResponse
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
_response_for_403 = api_client.OpenApiResponse(
|
|
155
|
+
response_cls=ApiResponseFor403,
|
|
156
|
+
response_cls_async=ApiResponseFor403Async,
|
|
157
|
+
content={
|
|
158
|
+
'application/json': api_client.MediaType(
|
|
159
|
+
schema=SchemaFor403ResponseBodyApplicationJson),
|
|
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
|
+
_status_code_to_response = {
|
|
184
|
+
'200': _response_for_200,
|
|
185
|
+
'403': _response_for_403,
|
|
186
|
+
'500': _response_for_500,
|
|
187
|
+
}
|
|
188
|
+
_all_accept_content_types = (
|
|
189
|
+
'application/json',
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class BaseApi(api_client.Api):
|
|
194
|
+
|
|
195
|
+
def _get_user_account_recent_orders_v2_mapped_args(
|
|
196
|
+
self,
|
|
197
|
+
user_id: typing.Optional[str] = None,
|
|
198
|
+
user_secret: typing.Optional[str] = None,
|
|
199
|
+
account_id: typing.Optional[str] = None,
|
|
200
|
+
only_executed: typing.Optional[bool] = None,
|
|
201
|
+
query_params: typing.Optional[dict] = {},
|
|
202
|
+
path_params: typing.Optional[dict] = {},
|
|
203
|
+
) -> api_client.MappedArgs:
|
|
204
|
+
args: api_client.MappedArgs = api_client.MappedArgs()
|
|
205
|
+
_query_params = {}
|
|
206
|
+
_path_params = {}
|
|
207
|
+
if user_id is not None:
|
|
208
|
+
_query_params["userId"] = user_id
|
|
209
|
+
if user_secret is not None:
|
|
210
|
+
_query_params["userSecret"] = user_secret
|
|
211
|
+
if only_executed is not None:
|
|
212
|
+
_query_params["only_executed"] = only_executed
|
|
213
|
+
if account_id is not None:
|
|
214
|
+
_path_params["accountId"] = account_id
|
|
215
|
+
args.query = query_params if query_params else _query_params
|
|
216
|
+
args.path = path_params if path_params else _path_params
|
|
217
|
+
return args
|
|
218
|
+
|
|
219
|
+
async def _aget_user_account_recent_orders_v2_oapg(
|
|
220
|
+
self,
|
|
221
|
+
query_params: typing.Optional[dict] = {},
|
|
222
|
+
path_params: typing.Optional[dict] = {},
|
|
223
|
+
skip_deserialization: bool = True,
|
|
224
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
225
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
226
|
+
stream: bool = False,
|
|
227
|
+
**kwargs,
|
|
228
|
+
) -> typing.Union[
|
|
229
|
+
ApiResponseFor200Async,
|
|
230
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
231
|
+
AsyncGeneratorResponse,
|
|
232
|
+
]:
|
|
233
|
+
"""
|
|
234
|
+
List account recent orders (V2, last 24 hours only)
|
|
235
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
236
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
237
|
+
class instances
|
|
238
|
+
"""
|
|
239
|
+
self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
|
|
240
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
241
|
+
used_path = path.value
|
|
242
|
+
|
|
243
|
+
_path_params = {}
|
|
244
|
+
for parameter in (
|
|
245
|
+
request_path_account_id,
|
|
246
|
+
):
|
|
247
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
248
|
+
if parameter_data is schemas.unset:
|
|
249
|
+
continue
|
|
250
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
251
|
+
_path_params.update(serialized_data)
|
|
252
|
+
|
|
253
|
+
for k, v in _path_params.items():
|
|
254
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
255
|
+
|
|
256
|
+
prefix_separator_iterator = None
|
|
257
|
+
for parameter in (
|
|
258
|
+
request_query_user_id,
|
|
259
|
+
request_query_user_secret,
|
|
260
|
+
request_query_only_executed,
|
|
261
|
+
):
|
|
262
|
+
parameter_data = query_params.get(parameter.name, schemas.unset)
|
|
263
|
+
if parameter_data is schemas.unset:
|
|
264
|
+
continue
|
|
265
|
+
if prefix_separator_iterator is None:
|
|
266
|
+
prefix_separator_iterator = parameter.get_prefix_separator_iterator()
|
|
267
|
+
serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
|
|
268
|
+
for serialized_value in serialized_data.values():
|
|
269
|
+
used_path += serialized_value
|
|
270
|
+
|
|
271
|
+
_headers = HTTPHeaderDict()
|
|
272
|
+
# TODO add cookie handling
|
|
273
|
+
if accept_content_types:
|
|
274
|
+
for accept_content_type in accept_content_types:
|
|
275
|
+
_headers.add('Accept', accept_content_type)
|
|
276
|
+
method = 'get'.upper()
|
|
277
|
+
request_before_hook(
|
|
278
|
+
resource_path=used_path,
|
|
279
|
+
method=method,
|
|
280
|
+
configuration=self.api_client.configuration,
|
|
281
|
+
path_template='/accounts/{accountId}/recentOrders/v2',
|
|
282
|
+
auth_settings=_auth,
|
|
283
|
+
headers=_headers,
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
response = await self.api_client.async_call_api(
|
|
287
|
+
resource_path=used_path,
|
|
288
|
+
method=method,
|
|
289
|
+
headers=_headers,
|
|
290
|
+
auth_settings=_auth,
|
|
291
|
+
prefix_separator_iterator=prefix_separator_iterator,
|
|
292
|
+
timeout=timeout,
|
|
293
|
+
**kwargs
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
if stream:
|
|
297
|
+
if not 200 <= response.http_response.status <= 299:
|
|
298
|
+
body = (await response.http_response.content.read()).decode("utf-8")
|
|
299
|
+
raise exceptions.ApiStreamingException(
|
|
300
|
+
status=response.http_response.status,
|
|
301
|
+
reason=response.http_response.reason,
|
|
302
|
+
body=body,
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
async def stream_iterator():
|
|
306
|
+
"""
|
|
307
|
+
iterates over response.http_response.content and closes connection once iteration has finished
|
|
308
|
+
"""
|
|
309
|
+
async for line in response.http_response.content:
|
|
310
|
+
if line == b'\r\n':
|
|
311
|
+
continue
|
|
312
|
+
yield line
|
|
313
|
+
response.http_response.close()
|
|
314
|
+
await response.session.close()
|
|
315
|
+
return AsyncGeneratorResponse(
|
|
316
|
+
content=stream_iterator(),
|
|
317
|
+
headers=response.http_response.headers,
|
|
318
|
+
status=response.http_response.status,
|
|
319
|
+
response=response.http_response
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
response_for_status = _status_code_to_response.get(str(response.http_response.status))
|
|
323
|
+
if response_for_status:
|
|
324
|
+
api_response = await response_for_status.deserialize_async(
|
|
325
|
+
response,
|
|
326
|
+
self.api_client.configuration,
|
|
327
|
+
skip_deserialization=skip_deserialization
|
|
328
|
+
)
|
|
329
|
+
else:
|
|
330
|
+
# If response data is JSON then deserialize for SDK consumer convenience
|
|
331
|
+
is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
|
|
332
|
+
api_response = api_client.ApiResponseWithoutDeserializationAsync(
|
|
333
|
+
body=await response.http_response.json() if is_json else await response.http_response.text(),
|
|
334
|
+
response=response.http_response,
|
|
335
|
+
round_trip_time=response.round_trip_time,
|
|
336
|
+
status=response.http_response.status,
|
|
337
|
+
headers=response.http_response.headers,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
if not 200 <= api_response.status <= 299:
|
|
341
|
+
raise exceptions.ApiException(api_response=api_response)
|
|
342
|
+
|
|
343
|
+
# cleanup session / response
|
|
344
|
+
response.http_response.close()
|
|
345
|
+
await response.session.close()
|
|
346
|
+
|
|
347
|
+
return api_response
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def _get_user_account_recent_orders_v2_oapg(
|
|
351
|
+
self,
|
|
352
|
+
query_params: typing.Optional[dict] = {},
|
|
353
|
+
path_params: typing.Optional[dict] = {},
|
|
354
|
+
skip_deserialization: bool = True,
|
|
355
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
356
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
357
|
+
stream: bool = False,
|
|
358
|
+
) -> typing.Union[
|
|
359
|
+
ApiResponseFor200,
|
|
360
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
361
|
+
]:
|
|
362
|
+
"""
|
|
363
|
+
List account recent orders (V2, last 24 hours only)
|
|
364
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
365
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
366
|
+
class instances
|
|
367
|
+
"""
|
|
368
|
+
self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
|
|
369
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
370
|
+
used_path = path.value
|
|
371
|
+
|
|
372
|
+
_path_params = {}
|
|
373
|
+
for parameter in (
|
|
374
|
+
request_path_account_id,
|
|
375
|
+
):
|
|
376
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
377
|
+
if parameter_data is schemas.unset:
|
|
378
|
+
continue
|
|
379
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
380
|
+
_path_params.update(serialized_data)
|
|
381
|
+
|
|
382
|
+
for k, v in _path_params.items():
|
|
383
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
384
|
+
|
|
385
|
+
prefix_separator_iterator = None
|
|
386
|
+
for parameter in (
|
|
387
|
+
request_query_user_id,
|
|
388
|
+
request_query_user_secret,
|
|
389
|
+
request_query_only_executed,
|
|
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}/recentOrders/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 GetUserAccountRecentOrdersV2(BaseApi):
|
|
449
|
+
# this class is used by api classes that refer to endpoints with operationId fn names
|
|
450
|
+
|
|
451
|
+
async def aget_user_account_recent_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
|
+
only_executed: typing.Optional[bool] = None,
|
|
457
|
+
query_params: typing.Optional[dict] = {},
|
|
458
|
+
path_params: typing.Optional[dict] = {},
|
|
459
|
+
**kwargs,
|
|
460
|
+
) -> typing.Union[
|
|
461
|
+
ApiResponseFor200Async,
|
|
462
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
463
|
+
AsyncGeneratorResponse,
|
|
464
|
+
]:
|
|
465
|
+
args = self._get_user_account_recent_orders_v2_mapped_args(
|
|
466
|
+
query_params=query_params,
|
|
467
|
+
path_params=path_params,
|
|
468
|
+
user_id=user_id,
|
|
469
|
+
user_secret=user_secret,
|
|
470
|
+
account_id=account_id,
|
|
471
|
+
only_executed=only_executed,
|
|
472
|
+
)
|
|
473
|
+
return await self._aget_user_account_recent_orders_v2_oapg(
|
|
474
|
+
query_params=args.query,
|
|
475
|
+
path_params=args.path,
|
|
476
|
+
**kwargs,
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
def get_user_account_recent_orders_v2(
|
|
480
|
+
self,
|
|
481
|
+
user_id: typing.Optional[str] = None,
|
|
482
|
+
user_secret: typing.Optional[str] = None,
|
|
483
|
+
account_id: typing.Optional[str] = None,
|
|
484
|
+
only_executed: typing.Optional[bool] = None,
|
|
485
|
+
query_params: typing.Optional[dict] = {},
|
|
486
|
+
path_params: typing.Optional[dict] = {},
|
|
487
|
+
) -> typing.Union[
|
|
488
|
+
ApiResponseFor200,
|
|
489
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
490
|
+
]:
|
|
491
|
+
""" A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)** """
|
|
492
|
+
args = self._get_user_account_recent_orders_v2_mapped_args(
|
|
493
|
+
query_params=query_params,
|
|
494
|
+
path_params=path_params,
|
|
495
|
+
user_id=user_id,
|
|
496
|
+
user_secret=user_secret,
|
|
497
|
+
account_id=account_id,
|
|
498
|
+
only_executed=only_executed,
|
|
499
|
+
)
|
|
500
|
+
return self._get_user_account_recent_orders_v2_oapg(
|
|
501
|
+
query_params=args.query,
|
|
502
|
+
path_params=args.path,
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
class ApiForget(BaseApi):
|
|
506
|
+
# this class is used by api classes that refer to endpoints by path and http method names
|
|
507
|
+
|
|
508
|
+
async def aget(
|
|
509
|
+
self,
|
|
510
|
+
user_id: typing.Optional[str] = None,
|
|
511
|
+
user_secret: typing.Optional[str] = None,
|
|
512
|
+
account_id: typing.Optional[str] = None,
|
|
513
|
+
only_executed: typing.Optional[bool] = None,
|
|
514
|
+
query_params: typing.Optional[dict] = {},
|
|
515
|
+
path_params: typing.Optional[dict] = {},
|
|
516
|
+
**kwargs,
|
|
517
|
+
) -> typing.Union[
|
|
518
|
+
ApiResponseFor200Async,
|
|
519
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
520
|
+
AsyncGeneratorResponse,
|
|
521
|
+
]:
|
|
522
|
+
args = self._get_user_account_recent_orders_v2_mapped_args(
|
|
523
|
+
query_params=query_params,
|
|
524
|
+
path_params=path_params,
|
|
525
|
+
user_id=user_id,
|
|
526
|
+
user_secret=user_secret,
|
|
527
|
+
account_id=account_id,
|
|
528
|
+
only_executed=only_executed,
|
|
529
|
+
)
|
|
530
|
+
return await self._aget_user_account_recent_orders_v2_oapg(
|
|
531
|
+
query_params=args.query,
|
|
532
|
+
path_params=args.path,
|
|
533
|
+
**kwargs,
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
def get(
|
|
537
|
+
self,
|
|
538
|
+
user_id: typing.Optional[str] = None,
|
|
539
|
+
user_secret: typing.Optional[str] = None,
|
|
540
|
+
account_id: typing.Optional[str] = None,
|
|
541
|
+
only_executed: typing.Optional[bool] = None,
|
|
542
|
+
query_params: typing.Optional[dict] = {},
|
|
543
|
+
path_params: typing.Optional[dict] = {},
|
|
544
|
+
) -> typing.Union[
|
|
545
|
+
ApiResponseFor200,
|
|
546
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
547
|
+
]:
|
|
548
|
+
""" A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)** """
|
|
549
|
+
args = self._get_user_account_recent_orders_v2_mapped_args(
|
|
550
|
+
query_params=query_params,
|
|
551
|
+
path_params=path_params,
|
|
552
|
+
user_id=user_id,
|
|
553
|
+
user_secret=user_secret,
|
|
554
|
+
account_id=account_id,
|
|
555
|
+
only_executed=only_executed,
|
|
556
|
+
)
|
|
557
|
+
return self._get_user_account_recent_orders_v2_oapg(
|
|
558
|
+
query_params=args.query,
|
|
559
|
+
path_params=args.path,
|
|
560
|
+
)
|
|
561
|
+
|