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