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