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