snaptrade-python-sdk 11.0.114__py3-none-any.whl → 11.0.116__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.
- snaptrade_client/__init__.py +1 -1
- snaptrade_client/api_client.py +1 -1
- snaptrade_client/apis/path_to_api.py +3 -3
- snaptrade_client/apis/paths/accounts_account_id_trading_cancel.py +7 -0
- snaptrade_client/apis/tags/trading_api_generated.py +1 -1
- snaptrade_client/configuration.py +1 -1
- snaptrade_client/model/cancel_order_response.py +96 -0
- snaptrade_client/model/cancel_order_response.pyi +96 -0
- snaptrade_client/model/cancel_order_response_raw_response.py +62 -0
- snaptrade_client/model/cancel_order_response_raw_response.pyi +62 -0
- snaptrade_client/model/mleg_price_effect_strict.py +22 -1
- snaptrade_client/model/mleg_price_effect_strict.pyi +22 -1
- snaptrade_client/model/mleg_price_effect_strict_nullable.py +22 -1
- snaptrade_client/model/mleg_price_effect_strict_nullable.pyi +22 -1
- snaptrade_client/models/__init__.py +2 -0
- snaptrade_client/operation_parameter_map.py +2 -2
- snaptrade_client/paths/__init__.py +1 -1
- snaptrade_client/paths/{accounts_account_id_trading_simple_brokerage_order_id_cancel → accounts_account_id_trading_cancel}/__init__.py +2 -2
- snaptrade_client/paths/{accounts_account_id_trading_simple_brokerage_order_id_cancel → accounts_account_id_trading_cancel}/post.py +120 -19
- snaptrade_client/paths/{accounts_account_id_trading_simple_brokerage_order_id_cancel → accounts_account_id_trading_cancel}/post.pyi +120 -19
- snaptrade_client/type/cancel_order_response.py +29 -0
- snaptrade_client/type/cancel_order_response_raw_response.py +19 -0
- snaptrade_client/type/mleg_price_effect_strict.py +1 -1
- snaptrade_client/type/mleg_price_effect_strict_nullable.py +1 -1
- snaptrade_client/type/mleg_trade_form.py +1 -1
- {snaptrade_python_sdk-11.0.114.dist-info → snaptrade_python_sdk-11.0.116.dist-info}/METADATA +10 -5
- {snaptrade_python_sdk-11.0.114.dist-info → snaptrade_python_sdk-11.0.116.dist-info}/RECORD +29 -23
- snaptrade_client/apis/paths/accounts_account_id_trading_simple_brokerage_order_id_cancel.py +0 -7
- {snaptrade_python_sdk-11.0.114.dist-info → snaptrade_python_sdk-11.0.116.dist-info}/LICENSE +0 -0
- {snaptrade_python_sdk-11.0.114.dist-info → snaptrade_python_sdk-11.0.116.dist-info}/WHEEL +0 -0
|
@@ -33,10 +33,10 @@ import frozendict # noqa: F401
|
|
|
33
33
|
from snaptrade_client import schemas # noqa: F401
|
|
34
34
|
|
|
35
35
|
from snaptrade_client.model.model400_failed_request_response import Model400FailedRequestResponse as Model400FailedRequestResponseSchema
|
|
36
|
-
from snaptrade_client.model.
|
|
36
|
+
from snaptrade_client.model.cancel_order_response import CancelOrderResponse as CancelOrderResponseSchema
|
|
37
37
|
|
|
38
|
+
from snaptrade_client.type.cancel_order_response import CancelOrderResponse
|
|
38
39
|
from snaptrade_client.type.model400_failed_request_response import Model400FailedRequestResponse
|
|
39
|
-
from snaptrade_client.type.order_updated_response import OrderUpdatedResponse
|
|
40
40
|
|
|
41
41
|
from . import path
|
|
42
42
|
|
|
@@ -78,12 +78,10 @@ request_query_user_secret = api_client.QueryParameter(
|
|
|
78
78
|
)
|
|
79
79
|
# Path params
|
|
80
80
|
AccountIdSchema = schemas.UUIDSchema
|
|
81
|
-
BrokerageOrderIdSchema = schemas.StrSchema
|
|
82
81
|
RequestRequiredPathParams = typing_extensions.TypedDict(
|
|
83
82
|
'RequestRequiredPathParams',
|
|
84
83
|
{
|
|
85
84
|
'accountId': typing.Union[AccountIdSchema, str, uuid.UUID, ],
|
|
86
|
-
'brokerageOrderId': typing.Union[BrokerageOrderIdSchema, str, ],
|
|
87
85
|
}
|
|
88
86
|
)
|
|
89
87
|
RequestOptionalPathParams = typing_extensions.TypedDict(
|
|
@@ -104,10 +102,64 @@ request_path_account_id = api_client.PathParameter(
|
|
|
104
102
|
schema=AccountIdSchema,
|
|
105
103
|
required=True,
|
|
106
104
|
)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
# body param
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class SchemaForRequestBodyApplicationJson(
|
|
109
|
+
schemas.DictSchema
|
|
110
|
+
):
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class MetaOapg:
|
|
114
|
+
|
|
115
|
+
class properties:
|
|
116
|
+
brokerage_order_id = schemas.StrSchema
|
|
117
|
+
__annotations__ = {
|
|
118
|
+
"brokerage_order_id": brokerage_order_id,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@typing.overload
|
|
122
|
+
def __getitem__(self, name: typing_extensions.Literal["brokerage_order_id"]) -> MetaOapg.properties.brokerage_order_id: ...
|
|
123
|
+
|
|
124
|
+
@typing.overload
|
|
125
|
+
def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ...
|
|
126
|
+
|
|
127
|
+
def __getitem__(self, name: typing.Union[typing_extensions.Literal["brokerage_order_id", ], str]):
|
|
128
|
+
# dict_instance[name] accessor
|
|
129
|
+
return super().__getitem__(name)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@typing.overload
|
|
133
|
+
def get_item_oapg(self, name: typing_extensions.Literal["brokerage_order_id"]) -> typing.Union[MetaOapg.properties.brokerage_order_id, schemas.Unset]: ...
|
|
134
|
+
|
|
135
|
+
@typing.overload
|
|
136
|
+
def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ...
|
|
137
|
+
|
|
138
|
+
def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["brokerage_order_id", ], str]):
|
|
139
|
+
return super().get_item_oapg(name)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def __new__(
|
|
143
|
+
cls,
|
|
144
|
+
*args: typing.Union[dict, frozendict.frozendict, ],
|
|
145
|
+
brokerage_order_id: typing.Union[MetaOapg.properties.brokerage_order_id, str, schemas.Unset] = schemas.unset,
|
|
146
|
+
_configuration: typing.Optional[schemas.Configuration] = None,
|
|
147
|
+
**kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
|
|
148
|
+
) -> 'SchemaForRequestBodyApplicationJson':
|
|
149
|
+
return super().__new__(
|
|
150
|
+
cls,
|
|
151
|
+
*args,
|
|
152
|
+
brokerage_order_id=brokerage_order_id,
|
|
153
|
+
_configuration=_configuration,
|
|
154
|
+
**kwargs,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
request_body_typing_any = api_client.RequestBody(
|
|
159
|
+
content={
|
|
160
|
+
'application/json': api_client.MediaType(
|
|
161
|
+
schema=SchemaForRequestBodyApplicationJson),
|
|
162
|
+
},
|
|
111
163
|
required=True,
|
|
112
164
|
)
|
|
113
165
|
_auth = [
|
|
@@ -115,17 +167,17 @@ _auth = [
|
|
|
115
167
|
'PartnerSignature',
|
|
116
168
|
'PartnerTimestamp',
|
|
117
169
|
]
|
|
118
|
-
SchemaFor200ResponseBodyApplicationJson =
|
|
170
|
+
SchemaFor200ResponseBodyApplicationJson = CancelOrderResponseSchema
|
|
119
171
|
|
|
120
172
|
|
|
121
173
|
@dataclass
|
|
122
174
|
class ApiResponseFor200(api_client.ApiResponse):
|
|
123
|
-
body:
|
|
175
|
+
body: CancelOrderResponse
|
|
124
176
|
|
|
125
177
|
|
|
126
178
|
@dataclass
|
|
127
179
|
class ApiResponseFor200Async(api_client.AsyncApiResponse):
|
|
128
|
-
body:
|
|
180
|
+
body: CancelOrderResponse
|
|
129
181
|
|
|
130
182
|
|
|
131
183
|
_response_for_200 = api_client.OpenApiResponse(
|
|
@@ -187,6 +239,7 @@ class BaseApi(api_client.Api):
|
|
|
187
239
|
|
|
188
240
|
def _cancel_order_mapped_args(
|
|
189
241
|
self,
|
|
242
|
+
body: typing.Optional[typing.Any] = None,
|
|
190
243
|
user_id: typing.Optional[str] = None,
|
|
191
244
|
user_secret: typing.Optional[str] = None,
|
|
192
245
|
account_id: typing.Optional[str] = None,
|
|
@@ -197,25 +250,29 @@ class BaseApi(api_client.Api):
|
|
|
197
250
|
args: api_client.MappedArgs = api_client.MappedArgs()
|
|
198
251
|
_query_params = {}
|
|
199
252
|
_path_params = {}
|
|
253
|
+
_body = {}
|
|
254
|
+
if brokerage_order_id is not None:
|
|
255
|
+
_body["brokerage_order_id"] = brokerage_order_id
|
|
256
|
+
args.body = body if body is not None else _body
|
|
200
257
|
if user_id is not None:
|
|
201
258
|
_query_params["userId"] = user_id
|
|
202
259
|
if user_secret is not None:
|
|
203
260
|
_query_params["userSecret"] = user_secret
|
|
204
261
|
if account_id is not None:
|
|
205
262
|
_path_params["accountId"] = account_id
|
|
206
|
-
if brokerage_order_id is not None:
|
|
207
|
-
_path_params["brokerageOrderId"] = brokerage_order_id
|
|
208
263
|
args.query = query_params if query_params else _query_params
|
|
209
264
|
args.path = path_params if path_params else _path_params
|
|
210
265
|
return args
|
|
211
266
|
|
|
212
267
|
async def _acancel_order_oapg(
|
|
213
268
|
self,
|
|
269
|
+
body: typing.Any = None,
|
|
214
270
|
query_params: typing.Optional[dict] = {},
|
|
215
271
|
path_params: typing.Optional[dict] = {},
|
|
216
272
|
skip_deserialization: bool = True,
|
|
217
273
|
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
218
274
|
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
275
|
+
content_type: str = 'application/json',
|
|
219
276
|
stream: bool = False,
|
|
220
277
|
**kwargs,
|
|
221
278
|
) -> typing.Union[
|
|
@@ -224,7 +281,7 @@ class BaseApi(api_client.Api):
|
|
|
224
281
|
AsyncGeneratorResponse,
|
|
225
282
|
]:
|
|
226
283
|
"""
|
|
227
|
-
Cancel
|
|
284
|
+
Cancel order
|
|
228
285
|
:param skip_deserialization: If true then api_response.response will be set but
|
|
229
286
|
api_response.body and api_response.headers will not be deserialized into schema
|
|
230
287
|
class instances
|
|
@@ -236,7 +293,6 @@ class BaseApi(api_client.Api):
|
|
|
236
293
|
_path_params = {}
|
|
237
294
|
for parameter in (
|
|
238
295
|
request_path_account_id,
|
|
239
|
-
request_path_brokerage_order_id,
|
|
240
296
|
):
|
|
241
297
|
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
242
298
|
if parameter_data is schemas.unset:
|
|
@@ -267,19 +323,35 @@ class BaseApi(api_client.Api):
|
|
|
267
323
|
for accept_content_type in accept_content_types:
|
|
268
324
|
_headers.add('Accept', accept_content_type)
|
|
269
325
|
method = 'post'.upper()
|
|
326
|
+
_headers.add('Content-Type', content_type)
|
|
327
|
+
|
|
328
|
+
if body is schemas.unset:
|
|
329
|
+
raise exceptions.ApiValueError(
|
|
330
|
+
'The required body parameter has an invalid value of: unset. Set a valid value instead')
|
|
331
|
+
_fields = None
|
|
332
|
+
_body = None
|
|
270
333
|
request_before_hook(
|
|
271
334
|
resource_path=used_path,
|
|
272
335
|
method=method,
|
|
273
336
|
configuration=self.api_client.configuration,
|
|
274
|
-
path_template='/accounts/{accountId}/trading/
|
|
337
|
+
path_template='/accounts/{accountId}/trading/cancel',
|
|
338
|
+
body=body,
|
|
275
339
|
auth_settings=_auth,
|
|
276
340
|
headers=_headers,
|
|
277
341
|
)
|
|
342
|
+
serialized_data = request_body_typing_any.serialize(body, content_type)
|
|
343
|
+
if 'fields' in serialized_data:
|
|
344
|
+
_fields = serialized_data['fields']
|
|
345
|
+
elif 'body' in serialized_data:
|
|
346
|
+
_body = serialized_data['body']
|
|
278
347
|
|
|
279
348
|
response = await self.api_client.async_call_api(
|
|
280
349
|
resource_path=used_path,
|
|
281
350
|
method=method,
|
|
282
351
|
headers=_headers,
|
|
352
|
+
fields=_fields,
|
|
353
|
+
serialized_body=_body,
|
|
354
|
+
body=body,
|
|
283
355
|
auth_settings=_auth,
|
|
284
356
|
prefix_separator_iterator=prefix_separator_iterator,
|
|
285
357
|
timeout=timeout,
|
|
@@ -342,18 +414,20 @@ class BaseApi(api_client.Api):
|
|
|
342
414
|
|
|
343
415
|
def _cancel_order_oapg(
|
|
344
416
|
self,
|
|
417
|
+
body: typing.Any = None,
|
|
345
418
|
query_params: typing.Optional[dict] = {},
|
|
346
419
|
path_params: typing.Optional[dict] = {},
|
|
347
420
|
skip_deserialization: bool = True,
|
|
348
421
|
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
349
422
|
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
423
|
+
content_type: str = 'application/json',
|
|
350
424
|
stream: bool = False,
|
|
351
425
|
) -> typing.Union[
|
|
352
426
|
ApiResponseFor200,
|
|
353
427
|
api_client.ApiResponseWithoutDeserialization,
|
|
354
428
|
]:
|
|
355
429
|
"""
|
|
356
|
-
Cancel
|
|
430
|
+
Cancel order
|
|
357
431
|
:param skip_deserialization: If true then api_response.response will be set but
|
|
358
432
|
api_response.body and api_response.headers will not be deserialized into schema
|
|
359
433
|
class instances
|
|
@@ -365,7 +439,6 @@ class BaseApi(api_client.Api):
|
|
|
365
439
|
_path_params = {}
|
|
366
440
|
for parameter in (
|
|
367
441
|
request_path_account_id,
|
|
368
|
-
request_path_brokerage_order_id,
|
|
369
442
|
):
|
|
370
443
|
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
371
444
|
if parameter_data is schemas.unset:
|
|
@@ -396,19 +469,35 @@ class BaseApi(api_client.Api):
|
|
|
396
469
|
for accept_content_type in accept_content_types:
|
|
397
470
|
_headers.add('Accept', accept_content_type)
|
|
398
471
|
method = 'post'.upper()
|
|
472
|
+
_headers.add('Content-Type', content_type)
|
|
473
|
+
|
|
474
|
+
if body is schemas.unset:
|
|
475
|
+
raise exceptions.ApiValueError(
|
|
476
|
+
'The required body parameter has an invalid value of: unset. Set a valid value instead')
|
|
477
|
+
_fields = None
|
|
478
|
+
_body = None
|
|
399
479
|
request_before_hook(
|
|
400
480
|
resource_path=used_path,
|
|
401
481
|
method=method,
|
|
402
482
|
configuration=self.api_client.configuration,
|
|
403
|
-
path_template='/accounts/{accountId}/trading/
|
|
483
|
+
path_template='/accounts/{accountId}/trading/cancel',
|
|
484
|
+
body=body,
|
|
404
485
|
auth_settings=_auth,
|
|
405
486
|
headers=_headers,
|
|
406
487
|
)
|
|
488
|
+
serialized_data = request_body_typing_any.serialize(body, content_type)
|
|
489
|
+
if 'fields' in serialized_data:
|
|
490
|
+
_fields = serialized_data['fields']
|
|
491
|
+
elif 'body' in serialized_data:
|
|
492
|
+
_body = serialized_data['body']
|
|
407
493
|
|
|
408
494
|
response = self.api_client.call_api(
|
|
409
495
|
resource_path=used_path,
|
|
410
496
|
method=method,
|
|
411
497
|
headers=_headers,
|
|
498
|
+
fields=_fields,
|
|
499
|
+
serialized_body=_body,
|
|
500
|
+
body=body,
|
|
412
501
|
auth_settings=_auth,
|
|
413
502
|
prefix_separator_iterator=prefix_separator_iterator,
|
|
414
503
|
timeout=timeout,
|
|
@@ -443,6 +532,7 @@ class CancelOrder(BaseApi):
|
|
|
443
532
|
|
|
444
533
|
async def acancel_order(
|
|
445
534
|
self,
|
|
535
|
+
body: typing.Optional[typing.Any] = None,
|
|
446
536
|
user_id: typing.Optional[str] = None,
|
|
447
537
|
user_secret: typing.Optional[str] = None,
|
|
448
538
|
account_id: typing.Optional[str] = None,
|
|
@@ -456,6 +546,7 @@ class CancelOrder(BaseApi):
|
|
|
456
546
|
AsyncGeneratorResponse,
|
|
457
547
|
]:
|
|
458
548
|
args = self._cancel_order_mapped_args(
|
|
549
|
+
body=body,
|
|
459
550
|
query_params=query_params,
|
|
460
551
|
path_params=path_params,
|
|
461
552
|
user_id=user_id,
|
|
@@ -464,6 +555,7 @@ class CancelOrder(BaseApi):
|
|
|
464
555
|
brokerage_order_id=brokerage_order_id,
|
|
465
556
|
)
|
|
466
557
|
return await self._acancel_order_oapg(
|
|
558
|
+
body=args.body,
|
|
467
559
|
query_params=args.query,
|
|
468
560
|
path_params=args.path,
|
|
469
561
|
**kwargs,
|
|
@@ -471,6 +563,7 @@ class CancelOrder(BaseApi):
|
|
|
471
563
|
|
|
472
564
|
def cancel_order(
|
|
473
565
|
self,
|
|
566
|
+
body: typing.Optional[typing.Any] = None,
|
|
474
567
|
user_id: typing.Optional[str] = None,
|
|
475
568
|
user_secret: typing.Optional[str] = None,
|
|
476
569
|
account_id: typing.Optional[str] = None,
|
|
@@ -483,6 +576,7 @@ class CancelOrder(BaseApi):
|
|
|
483
576
|
]:
|
|
484
577
|
""" Cancels an order in the specified account. """
|
|
485
578
|
args = self._cancel_order_mapped_args(
|
|
579
|
+
body=body,
|
|
486
580
|
query_params=query_params,
|
|
487
581
|
path_params=path_params,
|
|
488
582
|
user_id=user_id,
|
|
@@ -491,6 +585,7 @@ class CancelOrder(BaseApi):
|
|
|
491
585
|
brokerage_order_id=brokerage_order_id,
|
|
492
586
|
)
|
|
493
587
|
return self._cancel_order_oapg(
|
|
588
|
+
body=args.body,
|
|
494
589
|
query_params=args.query,
|
|
495
590
|
path_params=args.path,
|
|
496
591
|
)
|
|
@@ -500,6 +595,7 @@ class ApiForpost(BaseApi):
|
|
|
500
595
|
|
|
501
596
|
async def apost(
|
|
502
597
|
self,
|
|
598
|
+
body: typing.Optional[typing.Any] = None,
|
|
503
599
|
user_id: typing.Optional[str] = None,
|
|
504
600
|
user_secret: typing.Optional[str] = None,
|
|
505
601
|
account_id: typing.Optional[str] = None,
|
|
@@ -513,6 +609,7 @@ class ApiForpost(BaseApi):
|
|
|
513
609
|
AsyncGeneratorResponse,
|
|
514
610
|
]:
|
|
515
611
|
args = self._cancel_order_mapped_args(
|
|
612
|
+
body=body,
|
|
516
613
|
query_params=query_params,
|
|
517
614
|
path_params=path_params,
|
|
518
615
|
user_id=user_id,
|
|
@@ -521,6 +618,7 @@ class ApiForpost(BaseApi):
|
|
|
521
618
|
brokerage_order_id=brokerage_order_id,
|
|
522
619
|
)
|
|
523
620
|
return await self._acancel_order_oapg(
|
|
621
|
+
body=args.body,
|
|
524
622
|
query_params=args.query,
|
|
525
623
|
path_params=args.path,
|
|
526
624
|
**kwargs,
|
|
@@ -528,6 +626,7 @@ class ApiForpost(BaseApi):
|
|
|
528
626
|
|
|
529
627
|
def post(
|
|
530
628
|
self,
|
|
629
|
+
body: typing.Optional[typing.Any] = None,
|
|
531
630
|
user_id: typing.Optional[str] = None,
|
|
532
631
|
user_secret: typing.Optional[str] = None,
|
|
533
632
|
account_id: typing.Optional[str] = None,
|
|
@@ -540,6 +639,7 @@ class ApiForpost(BaseApi):
|
|
|
540
639
|
]:
|
|
541
640
|
""" Cancels an order in the specified account. """
|
|
542
641
|
args = self._cancel_order_mapped_args(
|
|
642
|
+
body=body,
|
|
543
643
|
query_params=query_params,
|
|
544
644
|
path_params=path_params,
|
|
545
645
|
user_id=user_id,
|
|
@@ -548,6 +648,7 @@ class ApiForpost(BaseApi):
|
|
|
548
648
|
brokerage_order_id=brokerage_order_id,
|
|
549
649
|
)
|
|
550
650
|
return self._cancel_order_oapg(
|
|
651
|
+
body=args.body,
|
|
551
652
|
query_params=args.query,
|
|
552
653
|
path_params=args.path,
|
|
553
654
|
)
|