snaptrade-python-sdk 11.0.123__py3-none-any.whl → 11.0.125__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. snaptrade_client/__init__.py +1 -1
  2. snaptrade_client/api_client.py +1 -1
  3. snaptrade_client/apis/path_to_api.py +0 -9
  4. snaptrade_client/apis/tags/options_api_generated.py +0 -6
  5. snaptrade_client/configuration.py +1 -1
  6. snaptrade_client/operation_parameter_map.py +0 -63
  7. snaptrade_client/paths/__init__.py +0 -3
  8. snaptrade_client/paths/accounts_account_id_orders_brokerage_order_id/get.py +2 -2
  9. snaptrade_client/paths/accounts_account_id_orders_brokerage_order_id/get.pyi +2 -2
  10. snaptrade_client/paths/accounts_account_id_quotes/get.py +2 -2
  11. snaptrade_client/paths/accounts_account_id_quotes/get.pyi +2 -2
  12. {snaptrade_python_sdk-11.0.123.dist-info → snaptrade_python_sdk-11.0.125.dist-info}/METADATA +16 -158
  13. {snaptrade_python_sdk-11.0.123.dist-info → snaptrade_python_sdk-11.0.125.dist-info}/RECORD +15 -27
  14. snaptrade_client/apis/paths/accounts_account_id_option_strategy.py +0 -7
  15. snaptrade_client/apis/paths/accounts_account_id_option_strategy_option_strategy_id.py +0 -7
  16. snaptrade_client/apis/paths/accounts_account_id_option_strategy_option_strategy_id_execute.py +0 -7
  17. snaptrade_client/paths/accounts_account_id_option_strategy/__init__.py +0 -7
  18. snaptrade_client/paths/accounts_account_id_option_strategy/post.py +0 -731
  19. snaptrade_client/paths/accounts_account_id_option_strategy/post.pyi +0 -714
  20. snaptrade_client/paths/accounts_account_id_option_strategy_option_strategy_id/__init__.py +0 -7
  21. snaptrade_client/paths/accounts_account_id_option_strategy_option_strategy_id/get.py +0 -537
  22. snaptrade_client/paths/accounts_account_id_option_strategy_option_strategy_id/get.pyi +0 -526
  23. snaptrade_client/paths/accounts_account_id_option_strategy_option_strategy_id_execute/__init__.py +0 -7
  24. snaptrade_client/paths/accounts_account_id_option_strategy_option_strategy_id_execute/post.py +0 -723
  25. snaptrade_client/paths/accounts_account_id_option_strategy_option_strategy_id_execute/post.pyi +0 -712
  26. {snaptrade_python_sdk-11.0.123.dist-info → snaptrade_python_sdk-11.0.125.dist-info}/LICENSE +0 -0
  27. {snaptrade_python_sdk-11.0.123.dist-info → snaptrade_python_sdk-11.0.125.dist-info}/WHEEL +0 -0
@@ -1,526 +0,0 @@
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.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse as Model500UnexpectedExceptionResponseSchema
36
- from snaptrade_client.model.strategy_quotes import StrategyQuotes as StrategyQuotesSchema
37
-
38
- from snaptrade_client.type.strategy_quotes import StrategyQuotes
39
- from snaptrade_client.type.model500_unexpected_exception_response import Model500UnexpectedExceptionResponse
40
-
41
- # Query params
42
- UserIdSchema = schemas.StrSchema
43
- UserSecretSchema = schemas.StrSchema
44
- RequestRequiredQueryParams = typing_extensions.TypedDict(
45
- 'RequestRequiredQueryParams',
46
- {
47
- 'userId': typing.Union[UserIdSchema, str, ],
48
- 'userSecret': typing.Union[UserSecretSchema, str, ],
49
- }
50
- )
51
- RequestOptionalQueryParams = typing_extensions.TypedDict(
52
- 'RequestOptionalQueryParams',
53
- {
54
- },
55
- total=False
56
- )
57
-
58
-
59
- class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams):
60
- pass
61
-
62
-
63
- request_query_user_id = api_client.QueryParameter(
64
- name="userId",
65
- style=api_client.ParameterStyle.FORM,
66
- schema=UserIdSchema,
67
- required=True,
68
- explode=True,
69
- )
70
- request_query_user_secret = api_client.QueryParameter(
71
- name="userSecret",
72
- style=api_client.ParameterStyle.FORM,
73
- schema=UserSecretSchema,
74
- required=True,
75
- explode=True,
76
- )
77
- # Path params
78
- AccountIdSchema = schemas.UUIDSchema
79
- OptionStrategyIdSchema = schemas.UUIDSchema
80
- RequestRequiredPathParams = typing_extensions.TypedDict(
81
- 'RequestRequiredPathParams',
82
- {
83
- 'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
84
- 'optionStrategyId': typing.Union[OptionStrategyIdSchema, str, uuid.UUID, ],
85
- }
86
- )
87
- RequestOptionalPathParams = typing_extensions.TypedDict(
88
- 'RequestOptionalPathParams',
89
- {
90
- },
91
- total=False
92
- )
93
-
94
-
95
- class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams):
96
- pass
97
-
98
-
99
- request_path_account_id = api_client.PathParameter(
100
- name="accountId",
101
- style=api_client.ParameterStyle.SIMPLE,
102
- schema=AccountIdSchema,
103
- required=True,
104
- )
105
- request_path_option_strategy_id = api_client.PathParameter(
106
- name="optionStrategyId",
107
- style=api_client.ParameterStyle.SIMPLE,
108
- schema=OptionStrategyIdSchema,
109
- required=True,
110
- )
111
- SchemaFor200ResponseBodyApplicationJson = StrategyQuotesSchema
112
-
113
-
114
- @dataclass
115
- class ApiResponseFor200(api_client.ApiResponse):
116
- body: StrategyQuotes
117
-
118
-
119
- @dataclass
120
- class ApiResponseFor200Async(api_client.AsyncApiResponse):
121
- body: StrategyQuotes
122
-
123
-
124
- _response_for_200 = api_client.OpenApiResponse(
125
- response_cls=ApiResponseFor200,
126
- response_cls_async=ApiResponseFor200Async,
127
- content={
128
- 'application/json': api_client.MediaType(
129
- schema=SchemaFor200ResponseBodyApplicationJson),
130
- },
131
- )
132
- SchemaFor500ResponseBodyApplicationJson = Model500UnexpectedExceptionResponseSchema
133
-
134
-
135
- @dataclass
136
- class ApiResponseFor500(api_client.ApiResponse):
137
- body: Model500UnexpectedExceptionResponse
138
-
139
-
140
- @dataclass
141
- class ApiResponseFor500Async(api_client.AsyncApiResponse):
142
- body: Model500UnexpectedExceptionResponse
143
-
144
-
145
- _response_for_500 = api_client.OpenApiResponse(
146
- response_cls=ApiResponseFor500,
147
- response_cls_async=ApiResponseFor500Async,
148
- content={
149
- 'application/json': api_client.MediaType(
150
- schema=SchemaFor500ResponseBodyApplicationJson),
151
- },
152
- )
153
- _all_accept_content_types = (
154
- 'application/json',
155
- )
156
-
157
-
158
- class BaseApi(api_client.Api):
159
-
160
- def _get_options_strategy_quote_mapped_args(
161
- self,
162
- user_id: typing.Optional[str] = None,
163
- user_secret: typing.Optional[str] = None,
164
- account_id: typing.Optional[str] = None,
165
- option_strategy_id: typing.Optional[str] = None,
166
- query_params: typing.Optional[dict] = {},
167
- path_params: typing.Optional[dict] = {},
168
- ) -> api_client.MappedArgs:
169
- args: api_client.MappedArgs = api_client.MappedArgs()
170
- _query_params = {}
171
- _path_params = {}
172
- if user_id is not None:
173
- _query_params["userId"] = user_id
174
- if user_secret is not None:
175
- _query_params["userSecret"] = user_secret
176
- if account_id is not None:
177
- _path_params["accountId"] = account_id
178
- if option_strategy_id is not None:
179
- _path_params["optionStrategyId"] = option_strategy_id
180
- args.query = query_params if query_params else _query_params
181
- args.path = path_params if path_params else _path_params
182
- return args
183
-
184
- async def _aget_options_strategy_quote_oapg(
185
- self,
186
- query_params: typing.Optional[dict] = {},
187
- path_params: typing.Optional[dict] = {},
188
- skip_deserialization: bool = True,
189
- timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
190
- accept_content_types: typing.Tuple[str] = _all_accept_content_types,
191
- stream: bool = False,
192
- **kwargs,
193
- ) -> typing.Union[
194
- ApiResponseFor200Async,
195
- api_client.ApiResponseWithoutDeserializationAsync,
196
- AsyncGeneratorResponse,
197
- ]:
198
- """
199
- Get options strategy quotes
200
- :param skip_deserialization: If true then api_response.response will be set but
201
- api_response.body and api_response.headers will not be deserialized into schema
202
- class instances
203
- """
204
- self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
205
- self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
206
- used_path = path.value
207
-
208
- _path_params = {}
209
- for parameter in (
210
- request_path_account_id,
211
- request_path_option_strategy_id,
212
- ):
213
- parameter_data = path_params.get(parameter.name, schemas.unset)
214
- if parameter_data is schemas.unset:
215
- continue
216
- serialized_data = parameter.serialize(parameter_data)
217
- _path_params.update(serialized_data)
218
-
219
- for k, v in _path_params.items():
220
- used_path = used_path.replace('{%s}' % k, v)
221
-
222
- prefix_separator_iterator = None
223
- for parameter in (
224
- request_query_user_id,
225
- request_query_user_secret,
226
- ):
227
- parameter_data = query_params.get(parameter.name, schemas.unset)
228
- if parameter_data is schemas.unset:
229
- continue
230
- if prefix_separator_iterator is None:
231
- prefix_separator_iterator = parameter.get_prefix_separator_iterator()
232
- serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
233
- for serialized_value in serialized_data.values():
234
- used_path += serialized_value
235
-
236
- _headers = HTTPHeaderDict()
237
- # TODO add cookie handling
238
- if accept_content_types:
239
- for accept_content_type in accept_content_types:
240
- _headers.add('Accept', accept_content_type)
241
- method = 'get'.upper()
242
- request_before_hook(
243
- resource_path=used_path,
244
- method=method,
245
- configuration=self.api_client.configuration,
246
- path_template='/accounts/{accountId}/optionStrategy/{optionStrategyId}',
247
- auth_settings=_auth,
248
- headers=_headers,
249
- )
250
-
251
- response = await self.api_client.async_call_api(
252
- resource_path=used_path,
253
- method=method,
254
- headers=_headers,
255
- auth_settings=_auth,
256
- prefix_separator_iterator=prefix_separator_iterator,
257
- timeout=timeout,
258
- **kwargs
259
- )
260
-
261
- if stream:
262
- if not 200 <= response.http_response.status <= 299:
263
- body = (await response.http_response.content.read()).decode("utf-8")
264
- raise exceptions.ApiStreamingException(
265
- status=response.http_response.status,
266
- reason=response.http_response.reason,
267
- body=body,
268
- )
269
-
270
- async def stream_iterator():
271
- """
272
- iterates over response.http_response.content and closes connection once iteration has finished
273
- """
274
- async for line in response.http_response.content:
275
- if line == b'\r\n':
276
- continue
277
- yield line
278
- response.http_response.close()
279
- await response.session.close()
280
- return AsyncGeneratorResponse(
281
- content=stream_iterator(),
282
- headers=response.http_response.headers,
283
- status=response.http_response.status,
284
- response=response.http_response
285
- )
286
-
287
- response_for_status = _status_code_to_response.get(str(response.http_response.status))
288
- if response_for_status:
289
- api_response = await response_for_status.deserialize_async(
290
- response,
291
- self.api_client.configuration,
292
- skip_deserialization=skip_deserialization
293
- )
294
- else:
295
- # If response data is JSON then deserialize for SDK consumer convenience
296
- is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
297
- api_response = api_client.ApiResponseWithoutDeserializationAsync(
298
- body=await response.http_response.json() if is_json else await response.http_response.text(),
299
- response=response.http_response,
300
- round_trip_time=response.round_trip_time,
301
- status=response.http_response.status,
302
- headers=response.http_response.headers,
303
- )
304
-
305
- if not 200 <= api_response.status <= 299:
306
- raise exceptions.ApiException(api_response=api_response)
307
-
308
- # cleanup session / response
309
- response.http_response.close()
310
- await response.session.close()
311
-
312
- return api_response
313
-
314
-
315
- def _get_options_strategy_quote_oapg(
316
- self,
317
- query_params: typing.Optional[dict] = {},
318
- path_params: typing.Optional[dict] = {},
319
- skip_deserialization: bool = True,
320
- timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
321
- accept_content_types: typing.Tuple[str] = _all_accept_content_types,
322
- stream: bool = False,
323
- ) -> typing.Union[
324
- ApiResponseFor200,
325
- api_client.ApiResponseWithoutDeserialization,
326
- ]:
327
- """
328
- Get options strategy quotes
329
- :param skip_deserialization: If true then api_response.response will be set but
330
- api_response.body and api_response.headers will not be deserialized into schema
331
- class instances
332
- """
333
- self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
334
- self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
335
- used_path = path.value
336
-
337
- _path_params = {}
338
- for parameter in (
339
- request_path_account_id,
340
- request_path_option_strategy_id,
341
- ):
342
- parameter_data = path_params.get(parameter.name, schemas.unset)
343
- if parameter_data is schemas.unset:
344
- continue
345
- serialized_data = parameter.serialize(parameter_data)
346
- _path_params.update(serialized_data)
347
-
348
- for k, v in _path_params.items():
349
- used_path = used_path.replace('{%s}' % k, v)
350
-
351
- prefix_separator_iterator = None
352
- for parameter in (
353
- request_query_user_id,
354
- request_query_user_secret,
355
- ):
356
- parameter_data = query_params.get(parameter.name, schemas.unset)
357
- if parameter_data is schemas.unset:
358
- continue
359
- if prefix_separator_iterator is None:
360
- prefix_separator_iterator = parameter.get_prefix_separator_iterator()
361
- serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator)
362
- for serialized_value in serialized_data.values():
363
- used_path += serialized_value
364
-
365
- _headers = HTTPHeaderDict()
366
- # TODO add cookie handling
367
- if accept_content_types:
368
- for accept_content_type in accept_content_types:
369
- _headers.add('Accept', accept_content_type)
370
- method = 'get'.upper()
371
- request_before_hook(
372
- resource_path=used_path,
373
- method=method,
374
- configuration=self.api_client.configuration,
375
- path_template='/accounts/{accountId}/optionStrategy/{optionStrategyId}',
376
- auth_settings=_auth,
377
- headers=_headers,
378
- )
379
-
380
- response = self.api_client.call_api(
381
- resource_path=used_path,
382
- method=method,
383
- headers=_headers,
384
- auth_settings=_auth,
385
- prefix_separator_iterator=prefix_separator_iterator,
386
- timeout=timeout,
387
- )
388
-
389
- response_for_status = _status_code_to_response.get(str(response.http_response.status))
390
- if response_for_status:
391
- api_response = response_for_status.deserialize(
392
- response,
393
- self.api_client.configuration,
394
- skip_deserialization=skip_deserialization
395
- )
396
- else:
397
- # If response data is JSON then deserialize for SDK consumer convenience
398
- is_json = api_client.JSONDetector._content_type_is_json(response.http_response.headers.get('Content-Type', ''))
399
- api_response = api_client.ApiResponseWithoutDeserialization(
400
- body=json.loads(response.http_response.data) if is_json else response.http_response.data,
401
- response=response.http_response,
402
- round_trip_time=response.round_trip_time,
403
- status=response.http_response.status,
404
- headers=response.http_response.headers,
405
- )
406
-
407
- if not 200 <= api_response.status <= 299:
408
- raise exceptions.ApiException(api_response=api_response)
409
-
410
- return api_response
411
-
412
-
413
- class GetOptionsStrategyQuote(BaseApi):
414
- # this class is used by api classes that refer to endpoints with operationId fn names
415
-
416
- async def aget_options_strategy_quote(
417
- self,
418
- user_id: typing.Optional[str] = None,
419
- user_secret: typing.Optional[str] = None,
420
- account_id: typing.Optional[str] = None,
421
- option_strategy_id: typing.Optional[str] = None,
422
- query_params: typing.Optional[dict] = {},
423
- path_params: typing.Optional[dict] = {},
424
- **kwargs,
425
- ) -> typing.Union[
426
- ApiResponseFor200Async,
427
- api_client.ApiResponseWithoutDeserializationAsync,
428
- AsyncGeneratorResponse,
429
- ]:
430
- args = self._get_options_strategy_quote_mapped_args(
431
- query_params=query_params,
432
- path_params=path_params,
433
- user_id=user_id,
434
- user_secret=user_secret,
435
- account_id=account_id,
436
- option_strategy_id=option_strategy_id,
437
- )
438
- return await self._aget_options_strategy_quote_oapg(
439
- query_params=args.query,
440
- path_params=args.path,
441
- **kwargs,
442
- )
443
-
444
- def get_options_strategy_quote(
445
- self,
446
- user_id: typing.Optional[str] = None,
447
- user_secret: typing.Optional[str] = None,
448
- account_id: typing.Optional[str] = None,
449
- option_strategy_id: typing.Optional[str] = None,
450
- query_params: typing.Optional[dict] = {},
451
- path_params: typing.Optional[dict] = {},
452
- ) -> typing.Union[
453
- ApiResponseFor200,
454
- api_client.ApiResponseWithoutDeserialization,
455
- ]:
456
- """ Returns a Strategy Quotes object which has latest market data of the specified option strategy. """
457
- args = self._get_options_strategy_quote_mapped_args(
458
- query_params=query_params,
459
- path_params=path_params,
460
- user_id=user_id,
461
- user_secret=user_secret,
462
- account_id=account_id,
463
- option_strategy_id=option_strategy_id,
464
- )
465
- return self._get_options_strategy_quote_oapg(
466
- query_params=args.query,
467
- path_params=args.path,
468
- )
469
-
470
- class ApiForget(BaseApi):
471
- # this class is used by api classes that refer to endpoints by path and http method names
472
-
473
- async def aget(
474
- self,
475
- user_id: typing.Optional[str] = None,
476
- user_secret: typing.Optional[str] = None,
477
- account_id: typing.Optional[str] = None,
478
- option_strategy_id: typing.Optional[str] = None,
479
- query_params: typing.Optional[dict] = {},
480
- path_params: typing.Optional[dict] = {},
481
- **kwargs,
482
- ) -> typing.Union[
483
- ApiResponseFor200Async,
484
- api_client.ApiResponseWithoutDeserializationAsync,
485
- AsyncGeneratorResponse,
486
- ]:
487
- args = self._get_options_strategy_quote_mapped_args(
488
- query_params=query_params,
489
- path_params=path_params,
490
- user_id=user_id,
491
- user_secret=user_secret,
492
- account_id=account_id,
493
- option_strategy_id=option_strategy_id,
494
- )
495
- return await self._aget_options_strategy_quote_oapg(
496
- query_params=args.query,
497
- path_params=args.path,
498
- **kwargs,
499
- )
500
-
501
- def get(
502
- self,
503
- user_id: typing.Optional[str] = None,
504
- user_secret: typing.Optional[str] = None,
505
- account_id: typing.Optional[str] = None,
506
- option_strategy_id: typing.Optional[str] = None,
507
- query_params: typing.Optional[dict] = {},
508
- path_params: typing.Optional[dict] = {},
509
- ) -> typing.Union[
510
- ApiResponseFor200,
511
- api_client.ApiResponseWithoutDeserialization,
512
- ]:
513
- """ Returns a Strategy Quotes object which has latest market data of the specified option strategy. """
514
- args = self._get_options_strategy_quote_mapped_args(
515
- query_params=query_params,
516
- path_params=path_params,
517
- user_id=user_id,
518
- user_secret=user_secret,
519
- account_id=account_id,
520
- option_strategy_id=option_strategy_id,
521
- )
522
- return self._get_options_strategy_quote_oapg(
523
- query_params=args.query,
524
- path_params=args.path,
525
- )
526
-
@@ -1,7 +0,0 @@
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_option_strategy_option_strategy_id_execute import Api
4
-
5
- from snaptrade_client.paths import PathValues
6
-
7
- path = PathValues.ACCOUNTS_ACCOUNT_ID_OPTION_STRATEGY_OPTION_STRATEGY_ID_EXECUTE