snaptrade-python-sdk 11.0.115__py3-none-any.whl → 11.0.117__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 +6 -3
- snaptrade_client/apis/paths/accounts_account_id_trading_cancel.py +7 -0
- snaptrade_client/apis/paths/brokerages_brokerage_id_instruments.py +7 -0
- snaptrade_client/apis/tags/reference_data_api_generated.py +2 -0
- snaptrade_client/apis/tags/trading_api_generated.py +1 -1
- snaptrade_client/configuration.py +1 -1
- snaptrade_client/model/brokerage_id.py +25 -0
- snaptrade_client/model/brokerage_id.pyi +25 -0
- snaptrade_client/model/brokerage_instrument.py +197 -0
- snaptrade_client/model/brokerage_instrument.pyi +197 -0
- snaptrade_client/model/brokerage_instruments_response.py +103 -0
- snaptrade_client/model/brokerage_instruments_response.pyi +103 -0
- 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/models/__init__.py +5 -0
- snaptrade_client/operation_parameter_map.py +9 -2
- snaptrade_client/paths/__init__.py +2 -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/paths/brokerages_brokerage_id_instruments/__init__.py +7 -0
- snaptrade_client/paths/brokerages_brokerage_id_instruments/get.py +417 -0
- snaptrade_client/paths/brokerages_brokerage_id_instruments/get.pyi +406 -0
- snaptrade_client/type/brokerage_id.py +19 -0
- snaptrade_client/type/brokerage_instrument.py +39 -0
- snaptrade_client/type/brokerage_instruments_response.py +27 -0
- snaptrade_client/type/cancel_order_response.py +29 -0
- snaptrade_client/type/cancel_order_response_raw_response.py +19 -0
- {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/METADATA +41 -5
- {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/RECORD +36 -17
- snaptrade_client/apis/paths/accounts_account_id_trading_simple_brokerage_order_id_cancel.py +0 -7
- {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/LICENSE +0 -0
- {snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,406 @@
|
|
|
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.brokerage_instruments_response import BrokerageInstrumentsResponse as BrokerageInstrumentsResponseSchema
|
|
36
|
+
|
|
37
|
+
from snaptrade_client.type.brokerage_instruments_response import BrokerageInstrumentsResponse
|
|
38
|
+
|
|
39
|
+
# Path params
|
|
40
|
+
BrokerageIdSchema = schemas.UUIDSchema
|
|
41
|
+
RequestRequiredPathParams = typing_extensions.TypedDict(
|
|
42
|
+
'RequestRequiredPathParams',
|
|
43
|
+
{
|
|
44
|
+
'brokerageId': typing.Union[BrokerageIdSchema, str, uuid.UUID, ],
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
RequestOptionalPathParams = typing_extensions.TypedDict(
|
|
48
|
+
'RequestOptionalPathParams',
|
|
49
|
+
{
|
|
50
|
+
},
|
|
51
|
+
total=False
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams):
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
request_path_brokerage_id = api_client.PathParameter(
|
|
60
|
+
name="brokerageId",
|
|
61
|
+
style=api_client.ParameterStyle.SIMPLE,
|
|
62
|
+
schema=BrokerageIdSchema,
|
|
63
|
+
required=True,
|
|
64
|
+
)
|
|
65
|
+
SchemaFor200ResponseBodyApplicationJson = BrokerageInstrumentsResponseSchema
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass
|
|
69
|
+
class ApiResponseFor200(api_client.ApiResponse):
|
|
70
|
+
body: BrokerageInstrumentsResponse
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass
|
|
74
|
+
class ApiResponseFor200Async(api_client.AsyncApiResponse):
|
|
75
|
+
body: BrokerageInstrumentsResponse
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
_response_for_200 = api_client.OpenApiResponse(
|
|
79
|
+
response_cls=ApiResponseFor200,
|
|
80
|
+
response_cls_async=ApiResponseFor200Async,
|
|
81
|
+
content={
|
|
82
|
+
'application/json': api_client.MediaType(
|
|
83
|
+
schema=SchemaFor200ResponseBodyApplicationJson),
|
|
84
|
+
},
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@dataclass
|
|
89
|
+
class ApiResponseForDefault(api_client.ApiResponse):
|
|
90
|
+
body: schemas.Unset = schemas.unset
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@dataclass
|
|
94
|
+
class ApiResponseForDefaultAsync(api_client.AsyncApiResponse):
|
|
95
|
+
body: schemas.Unset = schemas.unset
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
_response_for_default = api_client.OpenApiResponse(
|
|
99
|
+
response_cls=ApiResponseForDefault,
|
|
100
|
+
)
|
|
101
|
+
_all_accept_content_types = (
|
|
102
|
+
'application/json',
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class BaseApi(api_client.Api):
|
|
107
|
+
|
|
108
|
+
def _list_all_brokerage_instruments_mapped_args(
|
|
109
|
+
self,
|
|
110
|
+
brokerage_id: typing.Optional[str] = None,
|
|
111
|
+
path_params: typing.Optional[dict] = {},
|
|
112
|
+
) -> api_client.MappedArgs:
|
|
113
|
+
args: api_client.MappedArgs = api_client.MappedArgs()
|
|
114
|
+
_path_params = {}
|
|
115
|
+
if brokerage_id is not None:
|
|
116
|
+
_path_params["brokerageId"] = brokerage_id
|
|
117
|
+
args.path = path_params if path_params else _path_params
|
|
118
|
+
return args
|
|
119
|
+
|
|
120
|
+
async def _alist_all_brokerage_instruments_oapg(
|
|
121
|
+
self,
|
|
122
|
+
path_params: typing.Optional[dict] = {},
|
|
123
|
+
skip_deserialization: bool = True,
|
|
124
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
125
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
126
|
+
stream: bool = False,
|
|
127
|
+
**kwargs,
|
|
128
|
+
) -> typing.Union[
|
|
129
|
+
ApiResponseFor200Async,
|
|
130
|
+
ApiResponseForDefaultAsync,
|
|
131
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
132
|
+
AsyncGeneratorResponse,
|
|
133
|
+
]:
|
|
134
|
+
"""
|
|
135
|
+
Get a list of instruments available on the brokerage.
|
|
136
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
137
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
138
|
+
class instances
|
|
139
|
+
"""
|
|
140
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
141
|
+
used_path = path.value
|
|
142
|
+
|
|
143
|
+
_path_params = {}
|
|
144
|
+
for parameter in (
|
|
145
|
+
request_path_brokerage_id,
|
|
146
|
+
):
|
|
147
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
148
|
+
if parameter_data is schemas.unset:
|
|
149
|
+
continue
|
|
150
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
151
|
+
_path_params.update(serialized_data)
|
|
152
|
+
|
|
153
|
+
for k, v in _path_params.items():
|
|
154
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
155
|
+
|
|
156
|
+
_headers = HTTPHeaderDict()
|
|
157
|
+
# TODO add cookie handling
|
|
158
|
+
if accept_content_types:
|
|
159
|
+
for accept_content_type in accept_content_types:
|
|
160
|
+
_headers.add('Accept', accept_content_type)
|
|
161
|
+
method = 'get'.upper()
|
|
162
|
+
request_before_hook(
|
|
163
|
+
resource_path=used_path,
|
|
164
|
+
method=method,
|
|
165
|
+
configuration=self.api_client.configuration,
|
|
166
|
+
path_template='/brokerages/{brokerageId}/instruments',
|
|
167
|
+
auth_settings=_auth,
|
|
168
|
+
headers=_headers,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
response = await self.api_client.async_call_api(
|
|
172
|
+
resource_path=used_path,
|
|
173
|
+
method=method,
|
|
174
|
+
headers=_headers,
|
|
175
|
+
auth_settings=_auth,
|
|
176
|
+
timeout=timeout,
|
|
177
|
+
**kwargs
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
if stream:
|
|
181
|
+
if not 200 <= response.http_response.status <= 299:
|
|
182
|
+
body = (await response.http_response.content.read()).decode("utf-8")
|
|
183
|
+
raise exceptions.ApiStreamingException(
|
|
184
|
+
status=response.http_response.status,
|
|
185
|
+
reason=response.http_response.reason,
|
|
186
|
+
body=body,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
async def stream_iterator():
|
|
190
|
+
"""
|
|
191
|
+
iterates over response.http_response.content and closes connection once iteration has finished
|
|
192
|
+
"""
|
|
193
|
+
async for line in response.http_response.content:
|
|
194
|
+
if line == b'\r\n':
|
|
195
|
+
continue
|
|
196
|
+
yield line
|
|
197
|
+
response.http_response.close()
|
|
198
|
+
await response.session.close()
|
|
199
|
+
return AsyncGeneratorResponse(
|
|
200
|
+
content=stream_iterator(),
|
|
201
|
+
headers=response.http_response.headers,
|
|
202
|
+
status=response.http_response.status,
|
|
203
|
+
response=response.http_response
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
response_for_status = _status_code_to_response.get(str(response.http_response.status))
|
|
207
|
+
if response_for_status:
|
|
208
|
+
api_response = await response_for_status.deserialize_async(
|
|
209
|
+
response,
|
|
210
|
+
self.api_client.configuration,
|
|
211
|
+
skip_deserialization=skip_deserialization
|
|
212
|
+
)
|
|
213
|
+
else:
|
|
214
|
+
default_response = _status_code_to_response.get('default')
|
|
215
|
+
if default_response:
|
|
216
|
+
api_response = default_response.deserialize(
|
|
217
|
+
response,
|
|
218
|
+
self.api_client.configuration,
|
|
219
|
+
skip_deserialization=skip_deserialization
|
|
220
|
+
)
|
|
221
|
+
else:
|
|
222
|
+
api_response = api_client.ApiResponseWithoutDeserializationAsync(
|
|
223
|
+
response=response.http_response,
|
|
224
|
+
round_trip_time=response.round_trip_time,
|
|
225
|
+
status=response.http_response.status,
|
|
226
|
+
headers=response.http_response.headers,
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
if not 200 <= api_response.status <= 299:
|
|
230
|
+
raise exceptions.ApiException(api_response=api_response)
|
|
231
|
+
|
|
232
|
+
# cleanup session / response
|
|
233
|
+
response.http_response.close()
|
|
234
|
+
await response.session.close()
|
|
235
|
+
|
|
236
|
+
return api_response
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def _list_all_brokerage_instruments_oapg(
|
|
240
|
+
self,
|
|
241
|
+
path_params: typing.Optional[dict] = {},
|
|
242
|
+
skip_deserialization: bool = True,
|
|
243
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
244
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
245
|
+
stream: bool = False,
|
|
246
|
+
) -> typing.Union[
|
|
247
|
+
ApiResponseFor200,
|
|
248
|
+
ApiResponseForDefault,
|
|
249
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
250
|
+
]:
|
|
251
|
+
"""
|
|
252
|
+
Get a list of instruments available on the brokerage.
|
|
253
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
254
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
255
|
+
class instances
|
|
256
|
+
"""
|
|
257
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
258
|
+
used_path = path.value
|
|
259
|
+
|
|
260
|
+
_path_params = {}
|
|
261
|
+
for parameter in (
|
|
262
|
+
request_path_brokerage_id,
|
|
263
|
+
):
|
|
264
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
265
|
+
if parameter_data is schemas.unset:
|
|
266
|
+
continue
|
|
267
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
268
|
+
_path_params.update(serialized_data)
|
|
269
|
+
|
|
270
|
+
for k, v in _path_params.items():
|
|
271
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
272
|
+
|
|
273
|
+
_headers = HTTPHeaderDict()
|
|
274
|
+
# TODO add cookie handling
|
|
275
|
+
if accept_content_types:
|
|
276
|
+
for accept_content_type in accept_content_types:
|
|
277
|
+
_headers.add('Accept', accept_content_type)
|
|
278
|
+
method = 'get'.upper()
|
|
279
|
+
request_before_hook(
|
|
280
|
+
resource_path=used_path,
|
|
281
|
+
method=method,
|
|
282
|
+
configuration=self.api_client.configuration,
|
|
283
|
+
path_template='/brokerages/{brokerageId}/instruments',
|
|
284
|
+
auth_settings=_auth,
|
|
285
|
+
headers=_headers,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
response = self.api_client.call_api(
|
|
289
|
+
resource_path=used_path,
|
|
290
|
+
method=method,
|
|
291
|
+
headers=_headers,
|
|
292
|
+
auth_settings=_auth,
|
|
293
|
+
timeout=timeout,
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
response_for_status = _status_code_to_response.get(str(response.http_response.status))
|
|
297
|
+
if response_for_status:
|
|
298
|
+
api_response = response_for_status.deserialize(
|
|
299
|
+
response,
|
|
300
|
+
self.api_client.configuration,
|
|
301
|
+
skip_deserialization=skip_deserialization
|
|
302
|
+
)
|
|
303
|
+
else:
|
|
304
|
+
default_response = _status_code_to_response.get('default')
|
|
305
|
+
if default_response:
|
|
306
|
+
api_response = default_response.deserialize(
|
|
307
|
+
response,
|
|
308
|
+
self.api_client.configuration,
|
|
309
|
+
skip_deserialization=skip_deserialization
|
|
310
|
+
)
|
|
311
|
+
else:
|
|
312
|
+
api_response = api_client.ApiResponseWithoutDeserialization(
|
|
313
|
+
response=response.http_response,
|
|
314
|
+
round_trip_time=response.round_trip_time,
|
|
315
|
+
status=response.http_response.status,
|
|
316
|
+
headers=response.http_response.headers,
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
if not 200 <= api_response.status <= 299:
|
|
320
|
+
raise exceptions.ApiException(api_response=api_response)
|
|
321
|
+
|
|
322
|
+
return api_response
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class ListAllBrokerageInstruments(BaseApi):
|
|
326
|
+
# this class is used by api classes that refer to endpoints with operationId fn names
|
|
327
|
+
|
|
328
|
+
async def alist_all_brokerage_instruments(
|
|
329
|
+
self,
|
|
330
|
+
brokerage_id: typing.Optional[str] = None,
|
|
331
|
+
path_params: typing.Optional[dict] = {},
|
|
332
|
+
**kwargs,
|
|
333
|
+
) -> typing.Union[
|
|
334
|
+
ApiResponseFor200Async,
|
|
335
|
+
ApiResponseForDefaultAsync,
|
|
336
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
337
|
+
AsyncGeneratorResponse,
|
|
338
|
+
]:
|
|
339
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
340
|
+
path_params=path_params,
|
|
341
|
+
brokerage_id=brokerage_id,
|
|
342
|
+
)
|
|
343
|
+
return await self._alist_all_brokerage_instruments_oapg(
|
|
344
|
+
path_params=args.path,
|
|
345
|
+
**kwargs,
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
def list_all_brokerage_instruments(
|
|
349
|
+
self,
|
|
350
|
+
brokerage_id: typing.Optional[str] = None,
|
|
351
|
+
path_params: typing.Optional[dict] = {},
|
|
352
|
+
) -> typing.Union[
|
|
353
|
+
ApiResponseFor200,
|
|
354
|
+
ApiResponseForDefault,
|
|
355
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
356
|
+
]:
|
|
357
|
+
""" Returns a list of all brokerage instruments available for a given brokerage, optionally filtered by a search. Not all brokerages support this. The ones that don't will return an empty list. """
|
|
358
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
359
|
+
path_params=path_params,
|
|
360
|
+
brokerage_id=brokerage_id,
|
|
361
|
+
)
|
|
362
|
+
return self._list_all_brokerage_instruments_oapg(
|
|
363
|
+
path_params=args.path,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
class ApiForget(BaseApi):
|
|
367
|
+
# this class is used by api classes that refer to endpoints by path and http method names
|
|
368
|
+
|
|
369
|
+
async def aget(
|
|
370
|
+
self,
|
|
371
|
+
brokerage_id: typing.Optional[str] = None,
|
|
372
|
+
path_params: typing.Optional[dict] = {},
|
|
373
|
+
**kwargs,
|
|
374
|
+
) -> typing.Union[
|
|
375
|
+
ApiResponseFor200Async,
|
|
376
|
+
ApiResponseForDefaultAsync,
|
|
377
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
378
|
+
AsyncGeneratorResponse,
|
|
379
|
+
]:
|
|
380
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
381
|
+
path_params=path_params,
|
|
382
|
+
brokerage_id=brokerage_id,
|
|
383
|
+
)
|
|
384
|
+
return await self._alist_all_brokerage_instruments_oapg(
|
|
385
|
+
path_params=args.path,
|
|
386
|
+
**kwargs,
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
def get(
|
|
390
|
+
self,
|
|
391
|
+
brokerage_id: typing.Optional[str] = None,
|
|
392
|
+
path_params: typing.Optional[dict] = {},
|
|
393
|
+
) -> typing.Union[
|
|
394
|
+
ApiResponseFor200,
|
|
395
|
+
ApiResponseForDefault,
|
|
396
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
397
|
+
]:
|
|
398
|
+
""" Returns a list of all brokerage instruments available for a given brokerage, optionally filtered by a search. Not all brokerages support this. The ones that don't will return an empty list. """
|
|
399
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
400
|
+
path_params=path_params,
|
|
401
|
+
brokerage_id=brokerage_id,
|
|
402
|
+
)
|
|
403
|
+
return self._list_all_brokerage_instruments_oapg(
|
|
404
|
+
path_params=args.path,
|
|
405
|
+
)
|
|
406
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
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 datetime import datetime, date
|
|
14
|
+
import typing
|
|
15
|
+
from enum import Enum
|
|
16
|
+
from typing_extensions import TypedDict, Literal, TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
BrokerageID = str
|
|
@@ -0,0 +1,39 @@
|
|
|
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 datetime import datetime, date
|
|
14
|
+
import typing
|
|
15
|
+
from enum import Enum
|
|
16
|
+
from typing_extensions import TypedDict, Literal, TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class RequiredBrokerageInstrument(TypedDict):
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
class OptionalBrokerageInstrument(TypedDict, total=False):
|
|
23
|
+
# The instrument's trading symbol / ticker.
|
|
24
|
+
symbol: str
|
|
25
|
+
|
|
26
|
+
# The MIC code of the exchange where the instrument is traded.
|
|
27
|
+
exchange_mic: typing.Optional[str]
|
|
28
|
+
|
|
29
|
+
# Whether the instrument is tradeable through the brokerage. `null` if the tradeability is unknown.
|
|
30
|
+
tradeable: typing.Optional[bool]
|
|
31
|
+
|
|
32
|
+
# Whether the instrument allows fractional units. `null` if the fractionability is unknown.
|
|
33
|
+
fractionable: typing.Optional[bool]
|
|
34
|
+
|
|
35
|
+
# The universal symbol ID of the instrument. This is the ID used to reference the instrument in SnapTrade API calls.
|
|
36
|
+
universal_symbol_id: typing.Optional[str]
|
|
37
|
+
|
|
38
|
+
class BrokerageInstrument(RequiredBrokerageInstrument, OptionalBrokerageInstrument):
|
|
39
|
+
pass
|
|
@@ -0,0 +1,27 @@
|
|
|
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 datetime import datetime, date
|
|
14
|
+
import typing
|
|
15
|
+
from enum import Enum
|
|
16
|
+
from typing_extensions import TypedDict, Literal, TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
from snaptrade_client.type.brokerage_instrument import BrokerageInstrument
|
|
19
|
+
|
|
20
|
+
class RequiredBrokerageInstrumentsResponse(TypedDict):
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
class OptionalBrokerageInstrumentsResponse(TypedDict, total=False):
|
|
24
|
+
instruments: typing.List[BrokerageInstrument]
|
|
25
|
+
|
|
26
|
+
class BrokerageInstrumentsResponse(RequiredBrokerageInstrumentsResponse, OptionalBrokerageInstrumentsResponse):
|
|
27
|
+
pass
|
|
@@ -0,0 +1,29 @@
|
|
|
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 datetime import datetime, date
|
|
14
|
+
import typing
|
|
15
|
+
from enum import Enum
|
|
16
|
+
from typing_extensions import TypedDict, Literal, TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
from snaptrade_client.type.cancel_order_response_raw_response import CancelOrderResponseRawResponse
|
|
19
|
+
|
|
20
|
+
class RequiredCancelOrderResponse(TypedDict):
|
|
21
|
+
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
22
|
+
brokerage_order_id: str
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class OptionalCancelOrderResponse(TypedDict, total=False):
|
|
26
|
+
raw_response: typing.Optional[CancelOrderResponseRawResponse]
|
|
27
|
+
|
|
28
|
+
class CancelOrderResponse(RequiredCancelOrderResponse, OptionalCancelOrderResponse):
|
|
29
|
+
pass
|
|
@@ -0,0 +1,19 @@
|
|
|
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 datetime import datetime, date
|
|
14
|
+
import typing
|
|
15
|
+
from enum import Enum
|
|
16
|
+
from typing_extensions import TypedDict, Literal, TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
CancelOrderResponseRawResponse = dict
|
{snaptrade_python_sdk-11.0.115.dist-info → snaptrade_python_sdk-11.0.117.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: snaptrade-python-sdk
|
|
3
|
-
Version: 11.0.
|
|
3
|
+
Version: 11.0.117
|
|
4
4
|
Summary: Client for SnapTrade
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: SnapTrade
|
|
@@ -30,7 +30,7 @@ Description-Content-Type: text/markdown
|
|
|
30
30
|
Connect brokerage accounts to your app for live positions and trading
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
[](https://pypi.org/project/snaptrade-python-sdk/11.0.117)
|
|
34
34
|
[](https://github.com/passiv/snaptrade-sdks/tree/master/sdks/python#readme)
|
|
35
35
|
[](https://snaptrade.com/)
|
|
36
36
|
|
|
@@ -81,6 +81,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
81
81
|
* [`snaptrade.reference_data.get_symbols`](#snaptradereference_dataget_symbols)
|
|
82
82
|
* [`snaptrade.reference_data.get_symbols_by_ticker`](#snaptradereference_dataget_symbols_by_ticker)
|
|
83
83
|
* [`snaptrade.reference_data.list_all_brokerage_authorization_type`](#snaptradereference_datalist_all_brokerage_authorization_type)
|
|
84
|
+
* [`snaptrade.reference_data.list_all_brokerage_instruments`](#snaptradereference_datalist_all_brokerage_instruments)
|
|
84
85
|
* [`snaptrade.reference_data.list_all_brokerages`](#snaptradereference_datalist_all_brokerages)
|
|
85
86
|
* [`snaptrade.reference_data.list_all_currencies`](#snaptradereference_datalist_all_currencies)
|
|
86
87
|
* [`snaptrade.reference_data.list_all_currencies_rates`](#snaptradereference_datalist_all_currencies_rates)
|
|
@@ -110,7 +111,7 @@ Python >=3.8
|
|
|
110
111
|
## Installation<a id="installation"></a>
|
|
111
112
|
|
|
112
113
|
```sh
|
|
113
|
-
pip install snaptrade-python-sdk==11.0.
|
|
114
|
+
pip install snaptrade-python-sdk==11.0.117
|
|
114
115
|
```
|
|
115
116
|
|
|
116
117
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1565,6 +1566,36 @@ Comma separated value of brokerage slugs
|
|
|
1565
1566
|
|
|
1566
1567
|
---
|
|
1567
1568
|
|
|
1569
|
+
### `snaptrade.reference_data.list_all_brokerage_instruments`<a id="snaptradereference_datalist_all_brokerage_instruments"></a>
|
|
1570
|
+
|
|
1571
|
+
Returns a list of all brokerage instruments available for a given brokerage, optionally filtered by a search. Not all brokerages support this. The ones that don't will return an empty list.
|
|
1572
|
+
|
|
1573
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1574
|
+
|
|
1575
|
+
```python
|
|
1576
|
+
list_all_brokerage_instruments_response = (
|
|
1577
|
+
snaptrade.reference_data.list_all_brokerage_instruments(
|
|
1578
|
+
brokerage_id="87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1579
|
+
)
|
|
1580
|
+
)
|
|
1581
|
+
```
|
|
1582
|
+
|
|
1583
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1584
|
+
|
|
1585
|
+
##### brokerage_id: `str`<a id="brokerage_id-str"></a>
|
|
1586
|
+
|
|
1587
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1588
|
+
|
|
1589
|
+
[`BrokerageInstrumentsResponse`](./snaptrade_client/type/brokerage_instruments_response.py)
|
|
1590
|
+
|
|
1591
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1592
|
+
|
|
1593
|
+
`/brokerages/{brokerageId}/instruments` `get`
|
|
1594
|
+
|
|
1595
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1596
|
+
|
|
1597
|
+
---
|
|
1598
|
+
|
|
1568
1599
|
### `snaptrade.reference_data.list_all_brokerages`<a id="snaptradereference_datalist_all_brokerages"></a>
|
|
1569
1600
|
|
|
1570
1601
|
Returns a list of all defined Brokerage objects.
|
|
@@ -1706,13 +1737,18 @@ cancel_order_response = snaptrade.trading.cancel_order(
|
|
|
1706
1737
|
|
|
1707
1738
|
##### brokerage_order_id: `str`<a id="brokerage_order_id-str"></a>
|
|
1708
1739
|
|
|
1740
|
+
Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
1741
|
+
|
|
1742
|
+
#### ⚙️ Request Body<a id="⚙️-request-body"></a>
|
|
1743
|
+
|
|
1744
|
+
[`Any`](./snaptrade_client/type/typing_any.py)
|
|
1709
1745
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1710
1746
|
|
|
1711
|
-
[`
|
|
1747
|
+
[`CancelOrderResponse`](./snaptrade_client/type/cancel_order_response.py)
|
|
1712
1748
|
|
|
1713
1749
|
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1714
1750
|
|
|
1715
|
-
`/accounts/{accountId}/trading/
|
|
1751
|
+
`/accounts/{accountId}/trading/cancel` `post`
|
|
1716
1752
|
|
|
1717
1753
|
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1718
1754
|
|