snaptrade-python-sdk 13.1.2__py3-none-any.whl → 13.1.3__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.
@@ -12,7 +12,7 @@
12
12
  Created by: https://snaptrade.com/
13
13
  """
14
14
 
15
- __version__ = "13.1.2"
15
+ __version__ = "13.1.3"
16
16
 
17
17
  # import ApiClient
18
18
  from snaptrade_client.api_client import ApiClient
@@ -1175,7 +1175,7 @@ class ApiClient(typing.Generic[TAuth]):
1175
1175
  self.default_headers[header_name] = header_value
1176
1176
  self.cookie = cookie
1177
1177
  # Set default User-Agent.
1178
- self.user_agent = 'Konfig/13.1.2/python'
1178
+ self.user_agent = 'Konfig/13.1.3/python'
1179
1179
 
1180
1180
  def __enter__(self):
1181
1181
  return self
@@ -52,6 +52,7 @@ from snaptrade_client.apis.paths.snap_trade_stats import SnapTradeStats
52
52
  from snaptrade_client.apis.paths.accounts_account_id_orders_v2 import AccountsAccountIdOrdersV2
53
53
  from snaptrade_client.apis.paths.accounts_account_id_orders_all import AccountsAccountIdOrdersAll
54
54
  from snaptrade_client.apis.paths.accounts_account_id_recent_orders_v2 import AccountsAccountIdRecentOrdersV2
55
+ from snaptrade_client.apis.paths.accounts_account_id_orders_recent import AccountsAccountIdOrdersRecent
55
56
  from snaptrade_client.apis.paths.accounts_account_id_symbols import AccountsAccountIdSymbols
56
57
  from snaptrade_client.apis.paths.brokerages import Brokerages
57
58
  from snaptrade_client.apis.paths.institutions import Institutions
@@ -117,6 +118,7 @@ PathToApi = typing_extensions.TypedDict(
117
118
  PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_V2: AccountsAccountIdOrdersV2,
118
119
  PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_ALL: AccountsAccountIdOrdersAll,
119
120
  PathValues.ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS_V2: AccountsAccountIdRecentOrdersV2,
121
+ PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT: AccountsAccountIdOrdersRecent,
120
122
  PathValues.ACCOUNTS_ACCOUNT_ID_SYMBOLS: AccountsAccountIdSymbols,
121
123
  PathValues.BROKERAGES: Brokerages,
122
124
  PathValues.INSTITUTIONS: Institutions,
@@ -183,6 +185,7 @@ path_to_api = PathToApi(
183
185
  PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_V2: AccountsAccountIdOrdersV2,
184
186
  PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_ALL: AccountsAccountIdOrdersAll,
185
187
  PathValues.ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS_V2: AccountsAccountIdRecentOrdersV2,
188
+ PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT: AccountsAccountIdOrdersRecent,
186
189
  PathValues.ACCOUNTS_ACCOUNT_ID_SYMBOLS: AccountsAccountIdSymbols,
187
190
  PathValues.BROKERAGES: Brokerages,
188
191
  PathValues.INSTITUTIONS: Institutions,
@@ -0,0 +1,7 @@
1
+ from snaptrade_client.paths.accounts_account_id_orders_recent.get import ApiForget
2
+
3
+
4
+ class AccountsAccountIdOrdersRecent(
5
+ ApiForget,
6
+ ):
7
+ pass
@@ -12,6 +12,7 @@
12
12
  from snaptrade_client.paths.snap_trade_trade_detection_subscriptions.post import AddSubscription
13
13
  from snaptrade_client.paths.snap_trade_trade_detection_subscriptions_cancel.post import CancelSubscription
14
14
  from snaptrade_client.paths.accounts_account_id_orders_all.get import GetAllAccountOrders
15
+ from snaptrade_client.paths.accounts_account_id_orders_recent.get import GetAllAccountRecentOrders
15
16
  from snaptrade_client.paths.accounts_account_id_orders_details_v2_brokerage_order_id.get import GetUserAccountOrderDetailV2
16
17
  from snaptrade_client.paths.accounts_account_id_orders_v2.get import GetUserAccountOrdersV2
17
18
  from snaptrade_client.paths.accounts_account_id_recent_orders_v2.get import GetUserAccountRecentOrdersV2
@@ -27,6 +28,7 @@ class ExperimentalEndpointsApiGenerated(
27
28
  AddSubscription[TAuth],
28
29
  CancelSubscription[TAuth],
29
30
  GetAllAccountOrders[TAuth],
31
+ GetAllAccountRecentOrders[TAuth],
30
32
  GetUserAccountOrderDetailV2[TAuth],
31
33
  GetUserAccountOrdersV2[TAuth],
32
34
  GetUserAccountRecentOrdersV2[TAuth],
@@ -519,7 +519,7 @@ conf = snaptrade_client.Configuration(
519
519
  "OS: {env}\n"\
520
520
  "Python Version: {pyversion}\n"\
521
521
  "Version of the API: 1.0.0\n"\
522
- "SDK Package Version: 13.1.2".\
522
+ "SDK Package Version: 13.1.3".\
523
523
  format(env=sys.platform, pyversion=sys.version)
524
524
 
525
525
  def get_host_settings(self):
@@ -30,7 +30,7 @@ class AllAccountOrdersResponse(
30
30
  """
31
31
  This class is auto generated by Konfig (https://konfigthis.com)
32
32
 
33
- Orders in the `kind`-discriminated format returned by `/accounts/{accountId}/orders/all`.
33
+ A list of account orders together with the freshness of the returned data.
34
34
  """
35
35
 
36
36
 
@@ -30,7 +30,7 @@ class AllAccountOrdersResponse(
30
30
  """
31
31
  This class is auto generated by Konfig (https://konfigthis.com)
32
32
 
33
- Orders in the `kind`-discriminated format returned by `/accounts/{accountId}/orders/all`.
33
+ A list of account orders together with the freshness of the returned data.
34
34
  """
35
35
 
36
36
 
@@ -281,6 +281,16 @@ operation_parameter_map = {
281
281
  },
282
282
  ]
283
283
  },
284
+ '/accounts/{accountId}/orders/recent-GET': {
285
+ 'parameters': [
286
+ {
287
+ 'name': 'accountId'
288
+ },
289
+ {
290
+ 'name': 'only_executed'
291
+ },
292
+ ]
293
+ },
284
294
  '/accounts/{accountId}/orders/details/v2/{brokerageOrderId}-GET': {
285
295
  'parameters': [
286
296
  {
@@ -57,6 +57,7 @@ class PathValues(str, enum.Enum):
57
57
  ACCOUNTS_ACCOUNT_ID_ORDERS_V2 = "/accounts/{accountId}/orders/v2"
58
58
  ACCOUNTS_ACCOUNT_ID_ORDERS_ALL = "/accounts/{accountId}/orders/all"
59
59
  ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS_V2 = "/accounts/{accountId}/recentOrders/v2"
60
+ ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT = "/accounts/{accountId}/orders/recent"
60
61
  ACCOUNTS_ACCOUNT_ID_SYMBOLS = "/accounts/{accountId}/symbols"
61
62
  BROKERAGES = "/brokerages"
62
63
  INSTITUTIONS = "/institutions"
@@ -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_orders_recent import Api
4
+
5
+ from snaptrade_client.paths import PathValues
6
+
7
+ path = PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT
@@ -0,0 +1,781 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ SnapTrade
5
+
6
+ Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
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
15
+ import typing_extensions
16
+ import urllib3
17
+ from snaptrade_client.request_before_hook import request_before_hook
18
+ import json
19
+ from urllib3._collections import HTTPHeaderDict
20
+
21
+ from snaptrade_client.api_response import AsyncGeneratorResponse
22
+ from snaptrade_client import api_client, exceptions
23
+ from snaptrade_client.auth import AuthMode
24
+
25
+ TAuth = typing.TypeVar("TAuth", bound=AuthMode)
26
+ from datetime import date, datetime # noqa: F401
27
+ import decimal # noqa: F401
28
+ import functools # noqa: F401
29
+ import io # noqa: F401
30
+ import re # noqa: F401
31
+ import typing # noqa: F401
32
+ import typing_extensions # noqa: F401
33
+ import uuid # noqa: F401
34
+
35
+ import frozendict # noqa: F401
36
+
37
+ from snaptrade_client import schemas # noqa: F401
38
+
39
+ from snaptrade_client.model.all_account_orders_response import AllAccountOrdersResponse as AllAccountOrdersResponseSchema
40
+ from snaptrade_client.model.model503_brokerage_request_response import Model503BrokerageRequestResponse as Model503BrokerageRequestResponseSchema
41
+ from snaptrade_client.model.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse as Model500UnexpectedExceptionResponseSchema
42
+ from snaptrade_client.model.model501_not_implemented_response import Model501NotImplementedResponse as Model501NotImplementedResponseSchema
43
+ from snaptrade_client.model.model429_too_many_requests_response import Model429TooManyRequestsResponse as Model429TooManyRequestsResponseSchema
44
+ from snaptrade_client.model.model403_feature_not_enabled_response import Model403FeatureNotEnabledResponse as Model403FeatureNotEnabledResponseSchema
45
+
46
+ from snaptrade_client.type.all_account_orders_response import AllAccountOrdersResponse
47
+ from snaptrade_client.type.model503_brokerage_request_response import Model503BrokerageRequestResponse
48
+ from snaptrade_client.type.model429_too_many_requests_response import Model429TooManyRequestsResponse
49
+ from snaptrade_client.type.model403_feature_not_enabled_response import Model403FeatureNotEnabledResponse
50
+ from snaptrade_client.type.model501_not_implemented_response import Model501NotImplementedResponse
51
+ from snaptrade_client.type.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse
52
+
53
+ from . import path
54
+
55
+ # Query params
56
+ OnlyExecutedSchema = schemas.BoolSchema
57
+ RequestRequiredQueryParams = typing_extensions.TypedDict(
58
+ 'RequestRequiredQueryParams',
59
+ {
60
+ }
61
+ )
62
+ RequestOptionalQueryParams = typing_extensions.TypedDict(
63
+ 'RequestOptionalQueryParams',
64
+ {
65
+ 'only_executed': typing.Union[OnlyExecutedSchema, bool, ],
66
+ 'userId': str,
67
+ 'userSecret': str,
68
+ },
69
+ total=False
70
+ )
71
+
72
+
73
+ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams):
74
+ pass
75
+
76
+
77
+ request_query_only_executed = api_client.QueryParameter(
78
+ name="only_executed",
79
+ style=api_client.ParameterStyle.FORM,
80
+ schema=OnlyExecutedSchema,
81
+ explode=True,
82
+ )
83
+ # Path params
84
+ AccountIdSchema = schemas.UUIDSchema
85
+ RequestRequiredPathParams = typing_extensions.TypedDict(
86
+ 'RequestRequiredPathParams',
87
+ {
88
+ 'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
89
+ }
90
+ )
91
+ RequestOptionalPathParams = typing_extensions.TypedDict(
92
+ 'RequestOptionalPathParams',
93
+ {
94
+ },
95
+ total=False
96
+ )
97
+
98
+
99
+ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams):
100
+ pass
101
+
102
+
103
+ request_path_account_id = api_client.PathParameter(
104
+ name="accountId",
105
+ style=api_client.ParameterStyle.SIMPLE,
106
+ schema=AccountIdSchema,
107
+ required=True,
108
+ )
109
+ _auth_modes = {
110
+ "commercialApiKey": [
111
+ "PartnerClientId",
112
+ "PartnerTimestamp",
113
+ "userId",
114
+ "userSecret",
115
+ ],
116
+ "personalApiKey": [
117
+ "PersonalClientId",
118
+ "PersonalTimestamp",
119
+ ],
120
+ }
121
+ _operation_auth_context = {
122
+ "auth_modes": [
123
+ "commercialApiKey",
124
+ "personalApiKey",
125
+ ],
126
+ "request_signing_by_auth_mode": {
127
+ "commercialApiKey": {
128
+ "secret_parameter": "consumer_key",
129
+ "signed_security_schemes": [
130
+ "PartnerSignature",
131
+ "PartnerTimestamp",
132
+ ],
133
+ },
134
+ "personalApiKey": {
135
+ "secret_parameter": "consumer_key",
136
+ "signed_security_schemes": [
137
+ "PersonalSignature",
138
+ "PersonalTimestamp",
139
+ ],
140
+ },
141
+ },
142
+ }
143
+ _legacy_auth = [
144
+ 'PartnerClientId',
145
+ 'PartnerSignature',
146
+ 'PartnerTimestamp',
147
+ 'PersonalClientId',
148
+ 'PersonalSignature',
149
+ 'PersonalTimestamp',
150
+ 'userId',
151
+ 'userSecret',
152
+ ]
153
+ _auth = None
154
+ SchemaFor200ResponseBodyApplicationJson = AllAccountOrdersResponseSchema
155
+
156
+
157
+ @dataclass
158
+ class ApiResponseFor200(api_client.ApiResponse):
159
+ body: AllAccountOrdersResponse
160
+
161
+
162
+ @dataclass
163
+ class ApiResponseFor200Async(api_client.AsyncApiResponse):
164
+ body: AllAccountOrdersResponse
165
+
166
+
167
+ _response_for_200 = api_client.OpenApiResponse(
168
+ response_cls=ApiResponseFor200,
169
+ response_cls_async=ApiResponseFor200Async,
170
+ content={
171
+ 'application/json': api_client.MediaType(
172
+ schema=SchemaFor200ResponseBodyApplicationJson),
173
+ },
174
+ )
175
+ SchemaFor403ResponseBodyApplicationJson = Model403FeatureNotEnabledResponseSchema
176
+
177
+
178
+ @dataclass
179
+ class ApiResponseFor403(api_client.ApiResponse):
180
+ body: Model403FeatureNotEnabledResponse
181
+
182
+
183
+ @dataclass
184
+ class ApiResponseFor403Async(api_client.AsyncApiResponse):
185
+ body: Model403FeatureNotEnabledResponse
186
+
187
+
188
+ _response_for_403 = api_client.OpenApiResponse(
189
+ response_cls=ApiResponseFor403,
190
+ response_cls_async=ApiResponseFor403Async,
191
+ content={
192
+ 'application/json': api_client.MediaType(
193
+ schema=SchemaFor403ResponseBodyApplicationJson),
194
+ },
195
+ )
196
+ RetryAfterSchema = schemas.IntSchema
197
+ retry_after_parameter = api_client.HeaderParameter(
198
+ name="Retry-After",
199
+ style=api_client.ParameterStyle.SIMPLE,
200
+ schema=RetryAfterSchema,
201
+ )
202
+ XRateLimitLimitSchema = schemas.IntSchema
203
+ x_rate_limit_limit_parameter = api_client.HeaderParameter(
204
+ name="X-RateLimit-Limit",
205
+ style=api_client.ParameterStyle.SIMPLE,
206
+ schema=XRateLimitLimitSchema,
207
+ )
208
+ XRateLimitRemainingSchema = schemas.IntSchema
209
+ x_rate_limit_remaining_parameter = api_client.HeaderParameter(
210
+ name="X-RateLimit-Remaining",
211
+ style=api_client.ParameterStyle.SIMPLE,
212
+ schema=XRateLimitRemainingSchema,
213
+ )
214
+ XRateLimitResetSchema = schemas.IntSchema
215
+ x_rate_limit_reset_parameter = api_client.HeaderParameter(
216
+ name="X-RateLimit-Reset",
217
+ style=api_client.ParameterStyle.SIMPLE,
218
+ schema=XRateLimitResetSchema,
219
+ )
220
+ XRateLimitAccountLimitSchema = schemas.IntSchema
221
+ x_rate_limit_account_limit_parameter = api_client.HeaderParameter(
222
+ name="X-RateLimit-Account-Limit",
223
+ style=api_client.ParameterStyle.SIMPLE,
224
+ schema=XRateLimitAccountLimitSchema,
225
+ )
226
+ XRateLimitAccountRemainingSchema = schemas.IntSchema
227
+ x_rate_limit_account_remaining_parameter = api_client.HeaderParameter(
228
+ name="X-RateLimit-Account-Remaining",
229
+ style=api_client.ParameterStyle.SIMPLE,
230
+ schema=XRateLimitAccountRemainingSchema,
231
+ )
232
+ XRateLimitAccountResetSchema = schemas.IntSchema
233
+ x_rate_limit_account_reset_parameter = api_client.HeaderParameter(
234
+ name="X-RateLimit-Account-Reset",
235
+ style=api_client.ParameterStyle.SIMPLE,
236
+ schema=XRateLimitAccountResetSchema,
237
+ )
238
+ SchemaFor429ResponseBodyApplicationJson = Model429TooManyRequestsResponseSchema
239
+ ResponseHeadersFor429 = typing_extensions.TypedDict(
240
+ 'ResponseHeadersFor429',
241
+ {
242
+ 'Retry-After': RetryAfterSchema,
243
+ 'X-RateLimit-Limit': XRateLimitLimitSchema,
244
+ 'X-RateLimit-Remaining': XRateLimitRemainingSchema,
245
+ 'X-RateLimit-Reset': XRateLimitResetSchema,
246
+ 'X-RateLimit-Account-Limit': XRateLimitAccountLimitSchema,
247
+ 'X-RateLimit-Account-Remaining': XRateLimitAccountRemainingSchema,
248
+ 'X-RateLimit-Account-Reset': XRateLimitAccountResetSchema,
249
+ }
250
+ )
251
+
252
+
253
+ @dataclass
254
+ class ApiResponseFor429(api_client.ApiResponse):
255
+ body: Model429TooManyRequestsResponse
256
+
257
+
258
+ @dataclass
259
+ class ApiResponseFor429Async(api_client.AsyncApiResponse):
260
+ body: Model429TooManyRequestsResponse
261
+
262
+
263
+ _response_for_429 = api_client.OpenApiResponse(
264
+ response_cls=ApiResponseFor429,
265
+ response_cls_async=ApiResponseFor429Async,
266
+ content={
267
+ 'application/json': api_client.MediaType(
268
+ schema=SchemaFor429ResponseBodyApplicationJson),
269
+ },
270
+ headers=[
271
+ retry_after_parameter,
272
+ x_rate_limit_limit_parameter,
273
+ x_rate_limit_remaining_parameter,
274
+ x_rate_limit_reset_parameter,
275
+ x_rate_limit_account_limit_parameter,
276
+ x_rate_limit_account_remaining_parameter,
277
+ x_rate_limit_account_reset_parameter,
278
+ ]
279
+ )
280
+ SchemaFor500ResponseBodyApplicationJson = Model500UnexpectedExceptionResponseSchema
281
+
282
+
283
+ @dataclass
284
+ class ApiResponseFor500(api_client.ApiResponse):
285
+ body: Model500UnexpectedExceptionResponse
286
+
287
+
288
+ @dataclass
289
+ class ApiResponseFor500Async(api_client.AsyncApiResponse):
290
+ body: Model500UnexpectedExceptionResponse
291
+
292
+
293
+ _response_for_500 = api_client.OpenApiResponse(
294
+ response_cls=ApiResponseFor500,
295
+ response_cls_async=ApiResponseFor500Async,
296
+ content={
297
+ 'application/json': api_client.MediaType(
298
+ schema=SchemaFor500ResponseBodyApplicationJson),
299
+ },
300
+ )
301
+ SchemaFor501ResponseBodyApplicationJson = Model501NotImplementedResponseSchema
302
+
303
+
304
+ @dataclass
305
+ class ApiResponseFor501(api_client.ApiResponse):
306
+ body: Model501NotImplementedResponse
307
+
308
+
309
+ @dataclass
310
+ class ApiResponseFor501Async(api_client.AsyncApiResponse):
311
+ body: Model501NotImplementedResponse
312
+
313
+
314
+ _response_for_501 = api_client.OpenApiResponse(
315
+ response_cls=ApiResponseFor501,
316
+ response_cls_async=ApiResponseFor501Async,
317
+ content={
318
+ 'application/json': api_client.MediaType(
319
+ schema=SchemaFor501ResponseBodyApplicationJson),
320
+ },
321
+ )
322
+ SchemaFor503ResponseBodyApplicationJson = Model503BrokerageRequestResponseSchema
323
+
324
+
325
+ @dataclass
326
+ class ApiResponseFor503(api_client.ApiResponse):
327
+ body: Model503BrokerageRequestResponse
328
+
329
+
330
+ @dataclass
331
+ class ApiResponseFor503Async(api_client.AsyncApiResponse):
332
+ body: Model503BrokerageRequestResponse
333
+
334
+
335
+ _response_for_503 = api_client.OpenApiResponse(
336
+ response_cls=ApiResponseFor503,
337
+ response_cls_async=ApiResponseFor503Async,
338
+ content={
339
+ 'application/json': api_client.MediaType(
340
+ schema=SchemaFor503ResponseBodyApplicationJson),
341
+ },
342
+ )
343
+ _status_code_to_response = {
344
+ '200': _response_for_200,
345
+ '403': _response_for_403,
346
+ '429': _response_for_429,
347
+ '500': _response_for_500,
348
+ '501': _response_for_501,
349
+ '503': _response_for_503,
350
+ }
351
+ _all_accept_content_types = (
352
+ 'application/json',
353
+ )
354
+
355
+
356
+ class BaseApi(api_client.Api):
357
+
358
+ def _get_all_account_recent_orders_mapped_args(
359
+ self,
360
+ account_id: typing.Optional[str] = None,
361
+ only_executed: typing.Optional[bool] = None,
362
+ user_id: typing.Optional[str] = None,
363
+ user_secret: typing.Optional[str] = None,
364
+ query_params: typing.Optional[dict] = {},
365
+ header_params: typing.Optional[dict] = {},
366
+ path_params: typing.Optional[dict] = {},
367
+ ) -> api_client.MappedArgs:
368
+ args: api_client.MappedArgs = api_client.MappedArgs()
369
+ _query_params = {}
370
+ _header_params = {}
371
+ _path_params = {}
372
+ if only_executed is not None:
373
+ _query_params["only_executed"] = only_executed
374
+ if user_id is not None:
375
+ _query_params["userId"] = user_id
376
+ if user_secret is not None:
377
+ _query_params["userSecret"] = user_secret
378
+ if account_id is not None:
379
+ _path_params["accountId"] = account_id
380
+ args.query = query_params if query_params else _query_params
381
+ args.header = _header_params
382
+ args.path = path_params if path_params else _path_params
383
+ return args
384
+
385
+ async def _aget_all_account_recent_orders_oapg(
386
+ self,
387
+ query_params: typing.Optional[dict] = {},
388
+ header_params: typing.Optional[dict] = {},
389
+ path_params: typing.Optional[dict] = {},
390
+ skip_deserialization: bool = True,
391
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
392
+ accept_content_types: typing.Tuple[str] = _all_accept_content_types,
393
+ stream: bool = False,
394
+ **kwargs,
395
+ ) -> typing.Union[
396
+ ApiResponseFor200Async,
397
+ api_client.ApiResponseWithoutDeserializationAsync,
398
+ AsyncGeneratorResponse,
399
+ ]:
400
+ """
401
+ List all account recent orders (last 24 hours only)
402
+ :param skip_deserialization: If true then api_response.response will be set but
403
+ api_response.body and api_response.headers will not be deserialized into schema
404
+ class instances
405
+ """
406
+ self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
407
+ self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
408
+ used_path = path.value
409
+
410
+ _path_params = {}
411
+ for parameter in (
412
+ request_path_account_id,
413
+ ):
414
+ parameter_data = path_params.get(parameter.name, schemas.unset)
415
+ if parameter_data is schemas.unset:
416
+ continue
417
+ serialized_data = parameter.serialize(parameter_data)
418
+ _path_params.update(serialized_data)
419
+
420
+ for k, v in _path_params.items():
421
+ used_path = used_path.replace('{%s}' % k, v)
422
+
423
+ prefix_separator_iterator = None
424
+ for parameter in (
425
+ request_query_only_executed,
426
+ ):
427
+ parameter_data = query_params.get(parameter.name, schemas.unset)
428
+ if parameter_data is schemas.unset:
429
+ continue
430
+ if prefix_separator_iterator is None:
431
+ prefix_separator_iterator = parameter.get_prefix_separator_iterator()
432
+ serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
433
+ for serialized_value in serialized_data.values():
434
+ used_path += serialized_value
435
+ if query_params.get("userId", schemas.unset) is not schemas.unset:
436
+ if prefix_separator_iterator is None:
437
+ prefix_separator_iterator = api_client.PrefixSeparatorIterator("?", "&")
438
+ used_path += api_client.ParameterSerializerBase._query_auth_parameter_expansion(
439
+ variable_name="userId",
440
+ in_data=query_params["userId"],
441
+ prefix_separator_iterator=prefix_separator_iterator
442
+ )
443
+ if query_params.get("userSecret", schemas.unset) is not schemas.unset:
444
+ if prefix_separator_iterator is None:
445
+ prefix_separator_iterator = api_client.PrefixSeparatorIterator("?", "&")
446
+ used_path += api_client.ParameterSerializerBase._query_auth_parameter_expansion(
447
+ variable_name="userSecret",
448
+ in_data=query_params["userSecret"],
449
+ prefix_separator_iterator=prefix_separator_iterator
450
+ )
451
+
452
+ _headers = HTTPHeaderDict()
453
+ # TODO add cookie handling
454
+ if accept_content_types:
455
+ for accept_content_type in accept_content_types:
456
+ _headers.add('Accept', accept_content_type)
457
+ method = 'get'.upper()
458
+ _auth = self.api_client.configuration.auth_settings_for_auth_modes(
459
+ _auth_modes,
460
+ _legacy_auth,
461
+ )
462
+ request_before_hook(
463
+ resource_path=used_path,
464
+ method=method,
465
+ configuration=self.api_client.configuration,
466
+ path_template='/accounts/{accountId}/orders/recent',
467
+ auth_settings=_auth,
468
+ operation_auth_context=_operation_auth_context,
469
+ headers=_headers,
470
+ )
471
+
472
+ response = await self.api_client.async_call_api(
473
+ resource_path=used_path,
474
+ method=method,
475
+ headers=_headers,
476
+ auth_settings=_auth,
477
+ operation_auth_context=_operation_auth_context,
478
+ prefix_separator_iterator=prefix_separator_iterator,
479
+ timeout=timeout,
480
+ **kwargs
481
+ )
482
+
483
+ if stream:
484
+ if not 200 <= response.http_response.status <= 299:
485
+ body = (await response.http_response.content.read()).decode("utf-8")
486
+ raise exceptions.ApiStreamingException(
487
+ status=response.http_response.status,
488
+ reason=response.http_response.reason,
489
+ body=body,
490
+ )
491
+
492
+ async def stream_iterator():
493
+ """
494
+ iterates over response.http_response.content and closes connection once iteration has finished
495
+ """
496
+ async for line in response.http_response.content:
497
+ if line == b'\r\n':
498
+ continue
499
+ yield line
500
+ response.http_response.close()
501
+ await response.session.close()
502
+ return AsyncGeneratorResponse(
503
+ content=stream_iterator(),
504
+ headers=response.http_response.headers,
505
+ status=response.http_response.status,
506
+ response=response.http_response
507
+ )
508
+
509
+ response_for_status = _status_code_to_response.get(str(response.http_response.status))
510
+ if response_for_status:
511
+ api_response = await response_for_status.deserialize_async(
512
+ response,
513
+ self.api_client.configuration,
514
+ skip_deserialization=skip_deserialization
515
+ )
516
+ else:
517
+ # If response data is JSON then deserialize for SDK consumer convenience
518
+ is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
519
+ api_response = api_client.ApiResponseWithoutDeserializationAsync(
520
+ body=await response.http_response.json() if is_json else await response.http_response.text(),
521
+ response=response.http_response,
522
+ round_trip_time=response.round_trip_time,
523
+ status=response.http_response.status,
524
+ headers=response.http_response.headers,
525
+ )
526
+
527
+ if not 200 <= api_response.status <= 299:
528
+ raise exceptions.ApiException(api_response=api_response)
529
+
530
+ # cleanup session / response
531
+ response.http_response.close()
532
+ await response.session.close()
533
+
534
+ return api_response
535
+
536
+
537
+ def _get_all_account_recent_orders_oapg(
538
+ self,
539
+ query_params: typing.Optional[dict] = {},
540
+ header_params: typing.Optional[dict] = {},
541
+ path_params: typing.Optional[dict] = {},
542
+ skip_deserialization: bool = True,
543
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
544
+ accept_content_types: typing.Tuple[str] = _all_accept_content_types,
545
+ stream: bool = False,
546
+ ) -> typing.Union[
547
+ ApiResponseFor200,
548
+ api_client.ApiResponseWithoutDeserialization,
549
+ ]:
550
+ """
551
+ List all account recent orders (last 24 hours only)
552
+ :param skip_deserialization: If true then api_response.response will be set but
553
+ api_response.body and api_response.headers will not be deserialized into schema
554
+ class instances
555
+ """
556
+ self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
557
+ self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
558
+ used_path = path.value
559
+
560
+ _path_params = {}
561
+ for parameter in (
562
+ request_path_account_id,
563
+ ):
564
+ parameter_data = path_params.get(parameter.name, schemas.unset)
565
+ if parameter_data is schemas.unset:
566
+ continue
567
+ serialized_data = parameter.serialize(parameter_data)
568
+ _path_params.update(serialized_data)
569
+
570
+ for k, v in _path_params.items():
571
+ used_path = used_path.replace('{%s}' % k, v)
572
+
573
+ prefix_separator_iterator = None
574
+ for parameter in (
575
+ request_query_only_executed,
576
+ ):
577
+ parameter_data = query_params.get(parameter.name, schemas.unset)
578
+ if parameter_data is schemas.unset:
579
+ continue
580
+ if prefix_separator_iterator is None:
581
+ prefix_separator_iterator = parameter.get_prefix_separator_iterator()
582
+ serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
583
+ for serialized_value in serialized_data.values():
584
+ used_path += serialized_value
585
+ if query_params.get("userId", schemas.unset) is not schemas.unset:
586
+ if prefix_separator_iterator is None:
587
+ prefix_separator_iterator = api_client.PrefixSeparatorIterator("?", "&")
588
+ used_path += api_client.ParameterSerializerBase._query_auth_parameter_expansion(
589
+ variable_name="userId",
590
+ in_data=query_params["userId"],
591
+ prefix_separator_iterator=prefix_separator_iterator
592
+ )
593
+ if query_params.get("userSecret", schemas.unset) is not schemas.unset:
594
+ if prefix_separator_iterator is None:
595
+ prefix_separator_iterator = api_client.PrefixSeparatorIterator("?", "&")
596
+ used_path += api_client.ParameterSerializerBase._query_auth_parameter_expansion(
597
+ variable_name="userSecret",
598
+ in_data=query_params["userSecret"],
599
+ prefix_separator_iterator=prefix_separator_iterator
600
+ )
601
+
602
+ _headers = HTTPHeaderDict()
603
+ # TODO add cookie handling
604
+ if accept_content_types:
605
+ for accept_content_type in accept_content_types:
606
+ _headers.add('Accept', accept_content_type)
607
+ method = 'get'.upper()
608
+ _auth = self.api_client.configuration.auth_settings_for_auth_modes(
609
+ _auth_modes,
610
+ _legacy_auth,
611
+ )
612
+ request_before_hook(
613
+ resource_path=used_path,
614
+ method=method,
615
+ configuration=self.api_client.configuration,
616
+ path_template='/accounts/{accountId}/orders/recent',
617
+ auth_settings=_auth,
618
+ operation_auth_context=_operation_auth_context,
619
+ headers=_headers,
620
+ )
621
+
622
+ response = self.api_client.call_api(
623
+ resource_path=used_path,
624
+ method=method,
625
+ headers=_headers,
626
+ auth_settings=_auth,
627
+ operation_auth_context=_operation_auth_context,
628
+ prefix_separator_iterator=prefix_separator_iterator,
629
+ timeout=timeout,
630
+ )
631
+
632
+ response_for_status = _status_code_to_response.get(str(response.http_response.status))
633
+ if response_for_status:
634
+ api_response = response_for_status.deserialize(
635
+ response,
636
+ self.api_client.configuration,
637
+ skip_deserialization=skip_deserialization
638
+ )
639
+ else:
640
+ # If response data is JSON then deserialize for SDK consumer convenience
641
+ is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
642
+ api_response = api_client.ApiResponseWithoutDeserialization(
643
+ body=json.loads(response.http_response.data) if is_json else response.http_response.data,
644
+ response=response.http_response,
645
+ round_trip_time=response.round_trip_time,
646
+ status=response.http_response.status,
647
+ headers=response.http_response.headers,
648
+ )
649
+
650
+ if not 200 <= api_response.status <= 299:
651
+ raise exceptions.ApiException(api_response=api_response)
652
+
653
+ return api_response
654
+
655
+
656
+ class GetAllAccountRecentOrders(BaseApi, typing.Generic[TAuth]):
657
+ # this class is used by api classes that refer to endpoints with operationId fn names
658
+
659
+ async def aget_all_account_recent_orders(
660
+ self,
661
+ account_id: typing.Optional[str] = None,
662
+ only_executed: typing.Optional[bool] = None,
663
+ user_id: typing.Optional[str] = None,
664
+ user_secret: typing.Optional[str] = None,
665
+ query_params: typing.Optional[dict] = {},
666
+ header_params: typing.Optional[dict] = {},
667
+ path_params: typing.Optional[dict] = {},
668
+ **kwargs,
669
+ ) -> typing.Union[
670
+ ApiResponseFor200Async,
671
+ api_client.ApiResponseWithoutDeserializationAsync,
672
+ AsyncGeneratorResponse,
673
+ ]:
674
+ args = self._get_all_account_recent_orders_mapped_args(
675
+ query_params=query_params,
676
+ path_params=path_params,
677
+ account_id=account_id,
678
+ only_executed=only_executed,
679
+ user_id=user_id,
680
+ user_secret=user_secret,
681
+ )
682
+ return await self._aget_all_account_recent_orders_oapg(
683
+ query_params=args.query,
684
+ header_params=args.header,
685
+ path_params=args.path,
686
+ **kwargs,
687
+ )
688
+
689
+ def get_all_account_recent_orders(
690
+ self,
691
+ account_id: typing.Optional[str] = None,
692
+ only_executed: typing.Optional[bool] = None,
693
+ user_id: typing.Optional[str] = None,
694
+ user_secret: typing.Optional[str] = None,
695
+ query_params: typing.Optional[dict] = {},
696
+ header_params: typing.Optional[dict] = {},
697
+ path_params: typing.Optional[dict] = {},
698
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
699
+ ) -> typing.Union[
700
+ ApiResponseFor200,
701
+ api_client.ApiResponseWithoutDeserialization,
702
+ ]:
703
+ """ A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. 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 `/accounts/{accountId}/orders/all` in that it is always 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. Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request. **Experimental:** this endpoint may change without notice. **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)** """
704
+ args = self._get_all_account_recent_orders_mapped_args(
705
+ query_params=query_params,
706
+ path_params=path_params,
707
+ account_id=account_id,
708
+ only_executed=only_executed,
709
+ user_id=user_id,
710
+ user_secret=user_secret,
711
+ )
712
+ return self._get_all_account_recent_orders_oapg(
713
+ query_params=args.query,
714
+ header_params=args.header,
715
+ path_params=args.path,
716
+ timeout=timeout,
717
+ )
718
+
719
+ class ApiForget(BaseApi, typing.Generic[TAuth]):
720
+ # this class is used by api classes that refer to endpoints by path and http method names
721
+
722
+ async def aget(
723
+ self,
724
+ account_id: typing.Optional[str] = None,
725
+ only_executed: typing.Optional[bool] = None,
726
+ user_id: typing.Optional[str] = None,
727
+ user_secret: typing.Optional[str] = None,
728
+ query_params: typing.Optional[dict] = {},
729
+ header_params: typing.Optional[dict] = {},
730
+ path_params: typing.Optional[dict] = {},
731
+ **kwargs,
732
+ ) -> typing.Union[
733
+ ApiResponseFor200Async,
734
+ api_client.ApiResponseWithoutDeserializationAsync,
735
+ AsyncGeneratorResponse,
736
+ ]:
737
+ args = self._get_all_account_recent_orders_mapped_args(
738
+ query_params=query_params,
739
+ path_params=path_params,
740
+ account_id=account_id,
741
+ only_executed=only_executed,
742
+ user_id=user_id,
743
+ user_secret=user_secret,
744
+ )
745
+ return await self._aget_all_account_recent_orders_oapg(
746
+ query_params=args.query,
747
+ header_params=args.header,
748
+ path_params=args.path,
749
+ **kwargs,
750
+ )
751
+
752
+ def get(
753
+ self,
754
+ account_id: typing.Optional[str] = None,
755
+ only_executed: typing.Optional[bool] = None,
756
+ user_id: typing.Optional[str] = None,
757
+ user_secret: typing.Optional[str] = None,
758
+ query_params: typing.Optional[dict] = {},
759
+ header_params: typing.Optional[dict] = {},
760
+ path_params: typing.Optional[dict] = {},
761
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
762
+ ) -> typing.Union[
763
+ ApiResponseFor200,
764
+ api_client.ApiResponseWithoutDeserialization,
765
+ ]:
766
+ """ A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. 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 `/accounts/{accountId}/orders/all` in that it is always 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. Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request. **Experimental:** this endpoint may change without notice. **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)** """
767
+ args = self._get_all_account_recent_orders_mapped_args(
768
+ query_params=query_params,
769
+ path_params=path_params,
770
+ account_id=account_id,
771
+ only_executed=only_executed,
772
+ user_id=user_id,
773
+ user_secret=user_secret,
774
+ )
775
+ return self._get_all_account_recent_orders_oapg(
776
+ query_params=args.query,
777
+ header_params=args.header,
778
+ path_params=args.path,
779
+ timeout=timeout,
780
+ )
781
+
@@ -0,0 +1,83 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ SnapTrade
5
+
6
+ Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
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
+ import typing
14
+ import typing_extensions
15
+ from snaptrade_client import api_client
16
+ from snaptrade_client.auth import AuthMode
17
+ from snaptrade_client.auth import CommercialApiKeyAuth
18
+ from snaptrade_client.auth import PersonalApiKeyAuth
19
+
20
+ TAuth = typing.TypeVar("TAuth", bound=AuthMode)
21
+
22
+
23
+ class BaseApi(api_client.Api):
24
+ pass
25
+
26
+
27
+ class GetAllAccountRecentOrders(BaseApi, typing.Generic[TAuth]):
28
+ @typing.overload
29
+ def get_all_account_recent_orders(
30
+ self: "GetAllAccountRecentOrders[CommercialApiKeyAuth]",
31
+ account_id: str,
32
+ user_id: str,
33
+ user_secret: str,
34
+ only_executed: typing.Optional[bool] = None,
35
+ query_params: typing.Optional[dict] = ...,
36
+ header_params: typing.Optional[dict] = ...,
37
+ path_params: typing.Optional[dict] = ...,
38
+ validate: bool = ...,
39
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
40
+ ) -> typing.Any: ...
41
+ @typing.overload
42
+ def get_all_account_recent_orders(
43
+ self: "GetAllAccountRecentOrders[PersonalApiKeyAuth]",
44
+ account_id: str,
45
+ only_executed: typing.Optional[bool] = None,
46
+ user_id: typing.Optional[typing_extensions.Never] = None,
47
+ user_secret: typing.Optional[typing_extensions.Never] = None,
48
+ query_params: typing.Optional[dict] = ...,
49
+ header_params: typing.Optional[dict] = ...,
50
+ path_params: typing.Optional[dict] = ...,
51
+ validate: bool = ...,
52
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
53
+ ) -> typing.Any: ...
54
+
55
+
56
+ class ApiForget(GetAllAccountRecentOrders[TAuth]):
57
+ @typing.overload
58
+ def get(
59
+ self: "ApiForget[CommercialApiKeyAuth]",
60
+ account_id: str,
61
+ user_id: str,
62
+ user_secret: str,
63
+ only_executed: typing.Optional[bool] = None,
64
+ query_params: typing.Optional[dict] = ...,
65
+ header_params: typing.Optional[dict] = ...,
66
+ path_params: typing.Optional[dict] = ...,
67
+ validate: bool = ...,
68
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
69
+ ) -> typing.Any: ...
70
+ @typing.overload
71
+ def get(
72
+ self: "ApiForget[PersonalApiKeyAuth]",
73
+ account_id: str,
74
+ only_executed: typing.Optional[bool] = None,
75
+ user_id: typing.Optional[typing_extensions.Never] = None,
76
+ user_secret: typing.Optional[typing_extensions.Never] = None,
77
+ query_params: typing.Optional[dict] = ...,
78
+ header_params: typing.Optional[dict] = ...,
79
+ path_params: typing.Optional[dict] = ...,
80
+ validate: bool = ...,
81
+ timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
82
+ ) -> typing.Any: ...
83
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snaptrade-python-sdk
3
- Version: 13.1.2
3
+ Version: 13.1.3
4
4
  Summary: Client for SnapTrade
5
5
  License: MIT
6
6
  Author: SnapTrade
@@ -87,7 +87,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
87
87
 
88
88
 
89
89
 
90
- [![PyPI](https://img.shields.io/badge/PyPI-v13.1.2-blue)](https://pypi.org/project/snaptrade-python-sdk/13.1.2)
90
+ [![PyPI](https://img.shields.io/badge/PyPI-v13.1.3-blue)](https://pypi.org/project/snaptrade-python-sdk/13.1.3)
91
91
  [![README.md](https://img.shields.io/badge/README-Click%20Here-green)](https://github.com/passiv/snaptrade-sdks/tree/master/sdks/python#readme)
92
92
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
93
93
 
@@ -139,6 +139,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
139
139
  * [`snaptrade.experimental_endpoints.add_subscription`](#snaptradeexperimental_endpointsadd_subscription)
140
140
  * [`snaptrade.experimental_endpoints.cancel_subscription`](#snaptradeexperimental_endpointscancel_subscription)
141
141
  * [`snaptrade.experimental_endpoints.get_all_account_orders`](#snaptradeexperimental_endpointsget_all_account_orders)
142
+ * [`snaptrade.experimental_endpoints.get_all_account_recent_orders`](#snaptradeexperimental_endpointsget_all_account_recent_orders)
142
143
  * [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
143
144
  * [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
144
145
  * [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
@@ -179,7 +180,7 @@ Python >=3.8
179
180
  ## Installation<a id="installation"></a>
180
181
 
181
182
  ```sh
182
- pip install snaptrade-python-sdk==13.1.2
183
+ pip install snaptrade-python-sdk==13.1.3
183
184
  ```
184
185
 
185
186
  ## Authentication<a id="authentication"></a>
@@ -2254,6 +2255,75 @@ Number of days in the past to fetch the most recent orders. Defaults to the last
2254
2255
 
2255
2256
  ---
2256
2257
 
2258
+ ### `snaptrade.experimental_endpoints.get_all_account_recent_orders`<a id="snaptradeexperimental_endpointsget_all_account_recent_orders"></a>
2259
+
2260
+ A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
2261
+ 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.
2262
+ Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
2263
+ By default only returns executed orders, but that can be changed by setting *only_executed* to false.
2264
+
2265
+ Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
2266
+
2267
+ **Experimental:** this endpoint may change without notice.
2268
+
2269
+ **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)**
2270
+
2271
+
2272
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
2273
+
2274
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2275
+
2276
+ ```python
2277
+ get_all_account_recent_orders_response = (
2278
+ commercial_api_key_client.experimental_endpoints.get_all_account_recent_orders(
2279
+ account_id="917c8734-8470-4a3e-a18f-57c3f2ee6631",
2280
+ only_executed=True,
2281
+ user_id="snaptrade-user-123",
2282
+ user_secret="adf2aa34-8219-40f7-a6b3-60156985cc61",
2283
+ )
2284
+ )
2285
+ ```
2286
+
2287
+ Required credentials for this mode:
2288
+
2289
+ - `user_id` (str, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2290
+
2291
+ - `user_secret` (str, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2292
+
2293
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2294
+
2295
+ ```python
2296
+ get_all_account_recent_orders_response = (
2297
+ personal_api_key_client.experimental_endpoints.get_all_account_recent_orders(
2298
+ account_id="917c8734-8470-4a3e-a18f-57c3f2ee6631",
2299
+ only_executed=True,
2300
+ )
2301
+ )
2302
+ ```
2303
+
2304
+ The client identifies the user in this mode. Do not pass `user_id` `user_secret` to this method.
2305
+
2306
+
2307
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2308
+
2309
+ ##### account_id: `str`<a id="account_id-str"></a>
2310
+
2311
+ ##### only_executed: `bool`<a id="only_executed-bool"></a>
2312
+
2313
+ Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
2314
+
2315
+ #### 🔄 Return<a id="🔄-return"></a>
2316
+
2317
+ [`AllAccountOrdersResponse`](./snaptrade_client/type/all_account_orders_response.py)
2318
+
2319
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2320
+
2321
+ `/accounts/{accountId}/orders/recent` `get`
2322
+
2323
+ [🔙 **Back to Table of Contents**](#table-of-contents)
2324
+
2325
+ ---
2326
+
2257
2327
  ### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
2258
2328
 
2259
2329
  Returns the detail of a single order using the brokerage order ID provided as a path parameter.
@@ -1,8 +1,8 @@
1
- snaptrade_client/__init__.py,sha256=zfehoRPUuiVLcadE6CK-0er7WVL31QAYCDZjm092Vro,4104
2
- snaptrade_client/api_client.py,sha256=VRT_L4dRF55rPPDowZomg-x2LisafN_MpqpDopo2gaE,78308
1
+ snaptrade_client/__init__.py,sha256=t1tgpqe4yA3ImLgjMZCtfTGDfjIK5P-hPVleqrVToIs,4104
2
+ snaptrade_client/api_client.py,sha256=pPmPBTZ1FSd0sjqEe6Ggi2wuGfmsMxs_QQwfFd29KTs,78308
3
3
  snaptrade_client/api_response.py,sha256=mZn18p_TNr6OY0HXTZW5InL9iXfqsJWstYGeGD-euPA,663
4
4
  snaptrade_client/apis/__init__.py,sha256=RTosXhMn41tMsKPUjIy-VK-_efOWzhkKiuGggJ3A6E0,214
5
- snaptrade_client/apis/path_to_api.py,sha256=O-9NG1wqi_xMgOZeFfBreErWnNBhd4t1BnFromOQSf0,15555
5
+ snaptrade_client/apis/path_to_api.py,sha256=hJLg-JBDAOoltRp2jVuHzARy_ptlL5QYyeSoBeLF0SQ,15829
6
6
  snaptrade_client/apis/paths/__init__.py,sha256=oIb-tz_ei5m0RWOOB0qXTkBKu61nYtwOUlWvQbD5gFE,243
7
7
  snaptrade_client/apis/paths/accounts.py,sha256=aHSwrwNqPSa2ikmR-WP0dg2LbRBSNBB3n3_2OTCcxs4,103
8
8
  snaptrade_client/apis/paths/accounts_account_id.py,sha256=Xv0hHwov50tVcdtqCS-Np0BmqMhUwrvjIQLaa9yPF3U,207
@@ -16,6 +16,7 @@ snaptrade_client/apis/paths/accounts_account_id_orders.py,sha256=2rP-vnv9VQm1Acd
16
16
  snaptrade_client/apis/paths/accounts_account_id_orders_all.py,sha256=kPqOkLe40U68LFnXiuLFGxlMlU4iWwsfL1ZTSx1oU8M,143
17
17
  snaptrade_client/apis/paths/accounts_account_id_orders_details.py,sha256=CN3IJK-lgcfT00uJIQjJMu82S58fFGwg3gR7QRNnOn0,154
18
18
  snaptrade_client/apis/paths/accounts_account_id_orders_details_v2_brokerage_order_id.py,sha256=T_YfPqOzxk0W98Vp0tXrwe4jMvjHuYrODv_O9GXj7jE,191
19
+ snaptrade_client/apis/paths/accounts_account_id_orders_recent.py,sha256=HBGkSMLpsScSlY0noTQ6DB2lQKHmNikCsXNDFI4peS4,149
19
20
  snaptrade_client/apis/paths/accounts_account_id_orders_v2.py,sha256=M3R_rOJ8LnyOyomildPh38bBSba1B3giWrK0FqvuBXc,141
20
21
  snaptrade_client/apis/paths/accounts_account_id_positions_all.py,sha256=lFi2-wkoZlpsx_giBe7vvojtX1xxMTENE5n87MNrnO4,149
21
22
  snaptrade_client/apis/paths/accounts_account_id_quotes.py,sha256=_2v0DiUngr6a-Mi1EUrCfOn94e45pDhnH5Q9RdquIMA,136
@@ -76,7 +77,7 @@ snaptrade_client/apis/tags/authentication_api_generated.py,sha256=nbbBY2PGHhU2UK
76
77
  snaptrade_client/apis/tags/connections_api.py,sha256=t86vVzfjvfs8LOL2pVi0oR1a5hH1QH3Nq6T50XfeNlU,241
77
78
  snaptrade_client/apis/tags/connections_api_generated.py,sha256=fDuHH28sO9CAM5rd50KyuF2-rBdDINhKhS_d5wVYhug,4932
78
79
  snaptrade_client/apis/tags/experimental_endpoints_api.py,sha256=5n1j4_VE0jK9O7w843GRWWaVNuU3K1OSyLVvMl06fvY,293
79
- snaptrade_client/apis/tags/experimental_endpoints_api_generated.py,sha256=mWROg2P3gWSDHkmw1hOIC2T3AjswewsgMB5tCFdFoj4,4739
80
+ snaptrade_client/apis/tags/experimental_endpoints_api_generated.py,sha256=SB8Y4_5mFSFycLxGC-oRdUx_gy9A_w1k8J8EeGrgm_s,4876
80
81
  snaptrade_client/apis/tags/management_api.py,sha256=22txFcxw3RXf2m3jgcfbxESS1bzJJwuHssTP-Sin1sw,236
81
82
  snaptrade_client/apis/tags/management_api_generated.py,sha256=J1k9WBE4KuafLJ9lbdnpzSytdJzPx5xzULoCPP_y6L4,3841
82
83
  snaptrade_client/apis/tags/reference_data_api.py,sha256=GLUSSZXz9T4i_v-I3g3pODinjZA06cOw0KO-vQ1fhZg,253
@@ -87,7 +88,7 @@ snaptrade_client/auth.py,sha256=K0Ha_rrEQmqhyss-W15e14EX7R4lXxNuwIvhTbBFd0c,4428
87
88
  snaptrade_client/client.py,sha256=-oGctm7tqysXXG9f6iOZJc0O7_ftQgbTspTpFQVbNgI,6134
88
89
  snaptrade_client/client.pyi,sha256=Ac61coHF047SZOfGog4shB7g1enclZzYE3AMbYQ5V6o,5874
89
90
  snaptrade_client/client_custom.py,sha256=hNQMRFrY_KWEOCgf36fsZBs3sBU2SQtnZin8dAEVyYo,3931
90
- snaptrade_client/configuration.py,sha256=Rn_lQwZgI153wuv8HiSRknv3M0qnAey_zzpG0A_Wslc,25814
91
+ snaptrade_client/configuration.py,sha256=IdeKdYTkusigXvh-U5ZLqC0Gw-DBL2WvZQaLCFjW5hc,25814
91
92
  snaptrade_client/exceptions.py,sha256=pRlZiy1hSulcXfTCqqBU5Jys0hRBkxljOiv212M_yeo,10957
92
93
  snaptrade_client/exceptions_base.py,sha256=LAQkaC5C61-SdBLfyMjb0K7AYJkWVuLmg2uCvHa71FM,2274
93
94
  snaptrade_client/model/__init__.py,sha256=ayi2MIzcf0eAIsY13ToiNplV9tW-pMBFrC0I9yckGM8,350
@@ -169,8 +170,8 @@ snaptrade_client/model/action_strict_with_options.py,sha256=y4m6_Ou-Ik0TVXJA9USi
169
170
  snaptrade_client/model/action_strict_with_options.pyi,sha256=mPiFKSNl9OtnrJ38yJ-cqCO8cWFvwCTrVuBqKPAq3A4,4637
170
171
  snaptrade_client/model/adr_instrument.py,sha256=rLxrtNkxFQhWrj_vsLkURQ6x3pDqeXWt8t-XWgHI388,12201
171
172
  snaptrade_client/model/adr_instrument.pyi,sha256=LRBONaFhHQRKVlYDuX1XJfXhFpJMymz-fHyHQKxClx0,12040
172
- snaptrade_client/model/all_account_orders_response.py,sha256=AQBeQaCJ2UJ6Urs0EEiyfagQW65ozC_Vn_znsAZiUMM,7689
173
- snaptrade_client/model/all_account_orders_response.pyi,sha256=AQBeQaCJ2UJ6Urs0EEiyfagQW65ozC_Vn_znsAZiUMM,7689
173
+ snaptrade_client/model/all_account_orders_response.py,sha256=mmyGZu_TJAbSlPQuB2iGkxey_kueuvZi4trx6FyA_bo,7674
174
+ snaptrade_client/model/all_account_orders_response.pyi,sha256=mmyGZu_TJAbSlPQuB2iGkxey_kueuvZi4trx6FyA_bo,7674
174
175
  snaptrade_client/model/all_account_orders_response_data_freshness.py,sha256=IaLw_So2WpAGVmIWd21VRsocVFiNO51iftGG32KY8ec,5781
175
176
  snaptrade_client/model/all_account_orders_response_data_freshness.pyi,sha256=IaLw_So2WpAGVmIWd21VRsocVFiNO51iftGG32KY8ec,5781
176
177
  snaptrade_client/model/all_account_positions_response.py,sha256=FMPkAPwp-nuNPZ1eQxkbZmbWId16oIlciIT3TvHsG_U,7691
@@ -662,8 +663,8 @@ snaptrade_client/model/user_secret.pyi,sha256=BiF8M99Os_WXMHiGaivayDrU53MNuyr2Zj
662
663
  snaptrade_client/model/validated_trade_body.py,sha256=KOObe8mGtKr29bjV0l7cdiqKJQn3E22WqNIfHG-1Kig,6271
663
664
  snaptrade_client/model/validated_trade_body.pyi,sha256=KOObe8mGtKr29bjV0l7cdiqKJQn3E22WqNIfHG-1Kig,6271
664
665
  snaptrade_client/models/__init__.py,sha256=PeeZNHP6LK9MvkS7VixV5MsenwR1w-XuwYwnVXBKtoo,23093
665
- snaptrade_client/operation_parameter_map.py,sha256=PrE5HueqiFnZbtajk5P2iP9Zi7j3U1I4zKNZjNW060I,15870
666
- snaptrade_client/paths/__init__.py,sha256=0KBTczaFlcsepmG_W9xi3T1H1cda7Bp03KzBwQHx0DA,4494
666
+ snaptrade_client/operation_parameter_map.py,sha256=lvMNKHsBLOqICLCAbvfeD-_j0gYH6lApJh6QFmVLz2o,16094
667
+ snaptrade_client/paths/__init__.py,sha256=3_D75I6XcfpVlLa4sfnYsguHM3-IxlbXPJbDwDsfasM,4572
667
668
  snaptrade_client/paths/accounts/__init__.py,sha256=_Bqi6B13A-kgd0AOpqmcE1vTxJDfoz-r3Hwf-AmwW6A,307
668
669
  snaptrade_client/paths/accounts/get.py,sha256=wWhqshKso5U7Mgm4N1nPAXRsuSFFg46eax0ITLbriB0,23166
669
670
  snaptrade_client/paths/accounts/get.pyi,sha256=yi_d7rKzfQHa00tn5pDL7A5AjiMl9qzoVscp4XUfNiw,5519
@@ -702,6 +703,9 @@ snaptrade_client/paths/accounts_account_id_orders_details/post.pyi,sha256=b4WSrw
702
703
  snaptrade_client/paths/accounts_account_id_orders_details_v2_brokerage_order_id/__init__.py,sha256=4DxEVXZT1VYQdKHhlkQeGvjNkA2qL6OFX6QtWZ6a7HY,403
703
704
  snaptrade_client/paths/accounts_account_id_orders_details_v2_brokerage_order_id/get.py,sha256=t_ZvTKLbZz9eQXvJUccbnLV5GudgA8kZKrYW68ctvus,30446
704
705
  snaptrade_client/paths/accounts_account_id_orders_details_v2_brokerage_order_id/get.pyi,sha256=2BDomULZTspQiq9TkRhnz0yDjb7-9XhFErBX04kDHb4,6023
706
+ snaptrade_client/paths/accounts_account_id_orders_recent/__init__.py,sha256=SjULL4ef2jdpEAiMolNfdIgpBtONl96XUD7LKn-yMG0,357
707
+ snaptrade_client/paths/accounts_account_id_orders_recent/get.py,sha256=_HfxVrHRwRzbZYG6V8IQmmVkkkEB_dCz3LTHy3G0Gis,34467
708
+ snaptrade_client/paths/accounts_account_id_orders_recent/get.pyi,sha256=XKKO5n-c078UYGK6psqynWrr_evXHtLAg_XOIQRNhx0,6089
705
709
  snaptrade_client/paths/accounts_account_id_orders_v2/__init__.py,sha256=bLxvW4BvuS8smxB8nP-1X0-OjS-Mcty5RRl1Bbe2AVE,349
706
710
  snaptrade_client/paths/accounts_account_id_orders_v2/get.py,sha256=PQ7pvpwKYEfSBYBnyXqN3BjARabZmPwG__yORLKnn4g,32218
707
711
  snaptrade_client/paths/accounts_account_id_orders_v2/get.pyi,sha256=lNZXU4OhS-A5_pexGEybQsUZW9xW1Z3MdFb2Gb42c6Y,6207
@@ -1146,7 +1150,7 @@ snaptrade_client/type/user_secret.py,sha256=B6gpY5ECG6fV4aCV7XH9TK9uW9UsZYZlng56
1146
1150
  snaptrade_client/type/validated_trade_body.py,sha256=3d5fH-7GtjtWxBTBDyjK2RSmoFcMQpr7Sv6MXgCfKQc,4076
1147
1151
  snaptrade_client/type_util.py,sha256=y93VO77G7QTwguvfc3HnevIWtLat__tNZXfpSCSxHoU,3749
1148
1152
  snaptrade_client/validation_metadata.py,sha256=VTN5y-NudHXok1X468J4PnGze_tGEAcs1v3gsXmcrb0,3172
1149
- snaptrade_python_sdk-13.1.2.dist-info/LICENSE,sha256=GxvPdqYTCDLPwtMD70oHKcnAL8Os4eOjPVhERWpJ5Cs,1081
1150
- snaptrade_python_sdk-13.1.2.dist-info/METADATA,sha256=3Tiw1pGdDWff7smQIjYg2e8INDUBsqwdx5k6OJkCZGU,182908
1151
- snaptrade_python_sdk-13.1.2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1152
- snaptrade_python_sdk-13.1.2.dist-info/RECORD,,
1153
+ snaptrade_python_sdk-13.1.3.dist-info/LICENSE,sha256=GxvPdqYTCDLPwtMD70oHKcnAL8Os4eOjPVhERWpJ5Cs,1081
1154
+ snaptrade_python_sdk-13.1.3.dist-info/METADATA,sha256=pzfUe5cI6iLAmuVLRIcPzj6N_PYZfwHnfmB9fz3f-2Y,186390
1155
+ snaptrade_python_sdk-13.1.3.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1156
+ snaptrade_python_sdk-13.1.3.dist-info/RECORD,,