snaptrade-python-sdk 11.0.116__py3-none-any.whl → 11.0.118__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 -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/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/models/__init__.py +3 -0
- snaptrade_client/operation_parameter_map.py +7 -0
- snaptrade_client/paths/__init__.py +1 -0
- 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_python_sdk-11.0.116.dist-info → snaptrade_python_sdk-11.0.118.dist-info}/METADATA +34 -3
- {snaptrade_python_sdk-11.0.116.dist-info → snaptrade_python_sdk-11.0.118.dist-info}/RECORD +25 -12
- {snaptrade_python_sdk-11.0.116.dist-info → snaptrade_python_sdk-11.0.118.dist-info}/LICENSE +0 -0
- {snaptrade_python_sdk-11.0.116.dist-info → snaptrade_python_sdk-11.0.118.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
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 date, datetime # noqa: F401
|
|
14
|
+
import decimal # noqa: F401
|
|
15
|
+
import functools # noqa: F401
|
|
16
|
+
import io # noqa: F401
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import typing # noqa: F401
|
|
19
|
+
import typing_extensions # noqa: F401
|
|
20
|
+
import uuid # noqa: F401
|
|
21
|
+
|
|
22
|
+
import frozendict # noqa: F401
|
|
23
|
+
|
|
24
|
+
from snaptrade_client import schemas # noqa: F401
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BrokerageInstrumentsResponse(
|
|
28
|
+
schemas.DictSchema
|
|
29
|
+
):
|
|
30
|
+
"""
|
|
31
|
+
This class is auto generated by Konfig (https://konfigthis.com)
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class MetaOapg:
|
|
36
|
+
|
|
37
|
+
class properties:
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class instruments(
|
|
41
|
+
schemas.ListSchema
|
|
42
|
+
):
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class MetaOapg:
|
|
46
|
+
|
|
47
|
+
@staticmethod
|
|
48
|
+
def items() -> typing.Type['BrokerageInstrument']:
|
|
49
|
+
return BrokerageInstrument
|
|
50
|
+
|
|
51
|
+
def __new__(
|
|
52
|
+
cls,
|
|
53
|
+
arg: typing.Union[typing.Tuple['BrokerageInstrument'], typing.List['BrokerageInstrument']],
|
|
54
|
+
_configuration: typing.Optional[schemas.Configuration] = None,
|
|
55
|
+
) -> 'instruments':
|
|
56
|
+
return super().__new__(
|
|
57
|
+
cls,
|
|
58
|
+
arg,
|
|
59
|
+
_configuration=_configuration,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def __getitem__(self, i: int) -> 'BrokerageInstrument':
|
|
63
|
+
return super().__getitem__(i)
|
|
64
|
+
__annotations__ = {
|
|
65
|
+
"instruments": instruments,
|
|
66
|
+
}
|
|
67
|
+
additional_properties = schemas.AnyTypeSchema
|
|
68
|
+
|
|
69
|
+
@typing.overload
|
|
70
|
+
def __getitem__(self, name: typing_extensions.Literal["instruments"]) -> MetaOapg.properties.instruments: ...
|
|
71
|
+
|
|
72
|
+
@typing.overload
|
|
73
|
+
def __getitem__(self, name: str) -> MetaOapg.additional_properties: ...
|
|
74
|
+
|
|
75
|
+
def __getitem__(self, name: typing.Union[typing_extensions.Literal["instruments"], str, ]):
|
|
76
|
+
# dict_instance[name] accessor
|
|
77
|
+
return super().__getitem__(name)
|
|
78
|
+
|
|
79
|
+
@typing.overload
|
|
80
|
+
def get_item_oapg(self, name: typing_extensions.Literal["instruments"]) -> typing.Union[MetaOapg.properties.instruments, schemas.Unset]: ...
|
|
81
|
+
|
|
82
|
+
@typing.overload
|
|
83
|
+
def get_item_oapg(self, name: str) -> typing.Union[MetaOapg.additional_properties, schemas.Unset]: ...
|
|
84
|
+
|
|
85
|
+
def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["instruments"], str, ]):
|
|
86
|
+
return super().get_item_oapg(name)
|
|
87
|
+
|
|
88
|
+
def __new__(
|
|
89
|
+
cls,
|
|
90
|
+
*args: typing.Union[dict, frozendict.frozendict, ],
|
|
91
|
+
instruments: typing.Union[MetaOapg.properties.instruments, list, tuple, schemas.Unset] = schemas.unset,
|
|
92
|
+
_configuration: typing.Optional[schemas.Configuration] = None,
|
|
93
|
+
**kwargs: typing.Union[MetaOapg.additional_properties, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
|
|
94
|
+
) -> 'BrokerageInstrumentsResponse':
|
|
95
|
+
return super().__new__(
|
|
96
|
+
cls,
|
|
97
|
+
*args,
|
|
98
|
+
instruments=instruments,
|
|
99
|
+
_configuration=_configuration,
|
|
100
|
+
**kwargs,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
from snaptrade_client.model.brokerage_instrument import BrokerageInstrument
|
|
@@ -38,6 +38,9 @@ from snaptrade_client.model.brokerage_authorization_refresh_confirmation import
|
|
|
38
38
|
from snaptrade_client.model.brokerage_authorization_type_read_only import BrokerageAuthorizationTypeReadOnly
|
|
39
39
|
from snaptrade_client.model.brokerage_authorization_type_read_only_brokerage import BrokerageAuthorizationTypeReadOnlyBrokerage
|
|
40
40
|
from snaptrade_client.model.brokerage_exchanges import BrokerageExchanges
|
|
41
|
+
from snaptrade_client.model.brokerage_id import BrokerageID
|
|
42
|
+
from snaptrade_client.model.brokerage_instrument import BrokerageInstrument
|
|
43
|
+
from snaptrade_client.model.brokerage_instruments_response import BrokerageInstrumentsResponse
|
|
41
44
|
from snaptrade_client.model.brokerage_order_id import BrokerageOrderID
|
|
42
45
|
from snaptrade_client.model.brokerage_symbol_id import BrokerageSymbolID
|
|
43
46
|
from snaptrade_client.model.brokerage_type import BrokerageType
|
|
@@ -51,6 +51,7 @@ class PathValues(str, enum.Enum):
|
|
|
51
51
|
SNAP_TRADE_PARTNERS = "/snapTrade/partners"
|
|
52
52
|
ACCOUNTS_ACCOUNT_ID_SYMBOLS = "/accounts/{accountId}/symbols"
|
|
53
53
|
BROKERAGES = "/brokerages"
|
|
54
|
+
BROKERAGES_BROKERAGE_ID_INSTRUMENTS = "/brokerages/{brokerageId}/instruments"
|
|
54
55
|
BROKERAGE_AUTHORIZATION_TYPES = "/brokerageAuthorizationTypes"
|
|
55
56
|
CURRENCIES = "/currencies"
|
|
56
57
|
CURRENCIES_RATES = "/currencies/rates"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
|
2
|
+
# if you need the ability to import all endpoints from this module, import them with
|
|
3
|
+
# from snaptrade_client.paths.brokerages_brokerage_id_instruments import Api
|
|
4
|
+
|
|
5
|
+
from snaptrade_client.paths import PathValues
|
|
6
|
+
|
|
7
|
+
path = PathValues.BROKERAGES_BROKERAGE_ID_INSTRUMENTS
|
|
@@ -0,0 +1,417 @@
|
|
|
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
|
+
from . import path
|
|
40
|
+
|
|
41
|
+
# Path params
|
|
42
|
+
BrokerageIdSchema = schemas.UUIDSchema
|
|
43
|
+
RequestRequiredPathParams = typing_extensions.TypedDict(
|
|
44
|
+
'RequestRequiredPathParams',
|
|
45
|
+
{
|
|
46
|
+
'brokerageId': typing.Union[BrokerageIdSchema, str, uuid.UUID, ],
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
RequestOptionalPathParams = typing_extensions.TypedDict(
|
|
50
|
+
'RequestOptionalPathParams',
|
|
51
|
+
{
|
|
52
|
+
},
|
|
53
|
+
total=False
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams):
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
request_path_brokerage_id = api_client.PathParameter(
|
|
62
|
+
name="brokerageId",
|
|
63
|
+
style=api_client.ParameterStyle.SIMPLE,
|
|
64
|
+
schema=BrokerageIdSchema,
|
|
65
|
+
required=True,
|
|
66
|
+
)
|
|
67
|
+
_auth = [
|
|
68
|
+
'PartnerClientId',
|
|
69
|
+
'PartnerSignature',
|
|
70
|
+
'PartnerTimestamp',
|
|
71
|
+
]
|
|
72
|
+
SchemaFor200ResponseBodyApplicationJson = BrokerageInstrumentsResponseSchema
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@dataclass
|
|
76
|
+
class ApiResponseFor200(api_client.ApiResponse):
|
|
77
|
+
body: BrokerageInstrumentsResponse
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@dataclass
|
|
81
|
+
class ApiResponseFor200Async(api_client.AsyncApiResponse):
|
|
82
|
+
body: BrokerageInstrumentsResponse
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
_response_for_200 = api_client.OpenApiResponse(
|
|
86
|
+
response_cls=ApiResponseFor200,
|
|
87
|
+
response_cls_async=ApiResponseFor200Async,
|
|
88
|
+
content={
|
|
89
|
+
'application/json': api_client.MediaType(
|
|
90
|
+
schema=SchemaFor200ResponseBodyApplicationJson),
|
|
91
|
+
},
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass
|
|
96
|
+
class ApiResponseForDefault(api_client.ApiResponse):
|
|
97
|
+
body: schemas.Unset = schemas.unset
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass
|
|
101
|
+
class ApiResponseForDefaultAsync(api_client.AsyncApiResponse):
|
|
102
|
+
body: schemas.Unset = schemas.unset
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
_response_for_default = api_client.OpenApiResponse(
|
|
106
|
+
response_cls=ApiResponseForDefault,
|
|
107
|
+
)
|
|
108
|
+
_status_code_to_response = {
|
|
109
|
+
'200': _response_for_200,
|
|
110
|
+
'default': _response_for_default,
|
|
111
|
+
}
|
|
112
|
+
_all_accept_content_types = (
|
|
113
|
+
'application/json',
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class BaseApi(api_client.Api):
|
|
118
|
+
|
|
119
|
+
def _list_all_brokerage_instruments_mapped_args(
|
|
120
|
+
self,
|
|
121
|
+
brokerage_id: typing.Optional[str] = None,
|
|
122
|
+
path_params: typing.Optional[dict] = {},
|
|
123
|
+
) -> api_client.MappedArgs:
|
|
124
|
+
args: api_client.MappedArgs = api_client.MappedArgs()
|
|
125
|
+
_path_params = {}
|
|
126
|
+
if brokerage_id is not None:
|
|
127
|
+
_path_params["brokerageId"] = brokerage_id
|
|
128
|
+
args.path = path_params if path_params else _path_params
|
|
129
|
+
return args
|
|
130
|
+
|
|
131
|
+
async def _alist_all_brokerage_instruments_oapg(
|
|
132
|
+
self,
|
|
133
|
+
path_params: typing.Optional[dict] = {},
|
|
134
|
+
skip_deserialization: bool = True,
|
|
135
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
136
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
137
|
+
stream: bool = False,
|
|
138
|
+
**kwargs,
|
|
139
|
+
) -> typing.Union[
|
|
140
|
+
ApiResponseFor200Async,
|
|
141
|
+
ApiResponseForDefaultAsync,
|
|
142
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
143
|
+
AsyncGeneratorResponse,
|
|
144
|
+
]:
|
|
145
|
+
"""
|
|
146
|
+
Get brokerage instruments
|
|
147
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
148
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
149
|
+
class instances
|
|
150
|
+
"""
|
|
151
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
152
|
+
used_path = path.value
|
|
153
|
+
|
|
154
|
+
_path_params = {}
|
|
155
|
+
for parameter in (
|
|
156
|
+
request_path_brokerage_id,
|
|
157
|
+
):
|
|
158
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
159
|
+
if parameter_data is schemas.unset:
|
|
160
|
+
continue
|
|
161
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
162
|
+
_path_params.update(serialized_data)
|
|
163
|
+
|
|
164
|
+
for k, v in _path_params.items():
|
|
165
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
166
|
+
|
|
167
|
+
_headers = HTTPHeaderDict()
|
|
168
|
+
# TODO add cookie handling
|
|
169
|
+
if accept_content_types:
|
|
170
|
+
for accept_content_type in accept_content_types:
|
|
171
|
+
_headers.add('Accept', accept_content_type)
|
|
172
|
+
method = 'get'.upper()
|
|
173
|
+
request_before_hook(
|
|
174
|
+
resource_path=used_path,
|
|
175
|
+
method=method,
|
|
176
|
+
configuration=self.api_client.configuration,
|
|
177
|
+
path_template='/brokerages/{brokerageId}/instruments',
|
|
178
|
+
auth_settings=_auth,
|
|
179
|
+
headers=_headers,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
response = await self.api_client.async_call_api(
|
|
183
|
+
resource_path=used_path,
|
|
184
|
+
method=method,
|
|
185
|
+
headers=_headers,
|
|
186
|
+
auth_settings=_auth,
|
|
187
|
+
timeout=timeout,
|
|
188
|
+
**kwargs
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
if stream:
|
|
192
|
+
if not 200 <= response.http_response.status <= 299:
|
|
193
|
+
body = (await response.http_response.content.read()).decode("utf-8")
|
|
194
|
+
raise exceptions.ApiStreamingException(
|
|
195
|
+
status=response.http_response.status,
|
|
196
|
+
reason=response.http_response.reason,
|
|
197
|
+
body=body,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
async def stream_iterator():
|
|
201
|
+
"""
|
|
202
|
+
iterates over response.http_response.content and closes connection once iteration has finished
|
|
203
|
+
"""
|
|
204
|
+
async for line in response.http_response.content:
|
|
205
|
+
if line == b'\r\n':
|
|
206
|
+
continue
|
|
207
|
+
yield line
|
|
208
|
+
response.http_response.close()
|
|
209
|
+
await response.session.close()
|
|
210
|
+
return AsyncGeneratorResponse(
|
|
211
|
+
content=stream_iterator(),
|
|
212
|
+
headers=response.http_response.headers,
|
|
213
|
+
status=response.http_response.status,
|
|
214
|
+
response=response.http_response
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
response_for_status = _status_code_to_response.get(str(response.http_response.status))
|
|
218
|
+
if response_for_status:
|
|
219
|
+
api_response = await response_for_status.deserialize_async(
|
|
220
|
+
response,
|
|
221
|
+
self.api_client.configuration,
|
|
222
|
+
skip_deserialization=skip_deserialization
|
|
223
|
+
)
|
|
224
|
+
else:
|
|
225
|
+
default_response = _status_code_to_response.get('default')
|
|
226
|
+
if default_response:
|
|
227
|
+
api_response = default_response.deserialize(
|
|
228
|
+
response,
|
|
229
|
+
self.api_client.configuration,
|
|
230
|
+
skip_deserialization=skip_deserialization
|
|
231
|
+
)
|
|
232
|
+
else:
|
|
233
|
+
api_response = api_client.ApiResponseWithoutDeserializationAsync(
|
|
234
|
+
response=response.http_response,
|
|
235
|
+
round_trip_time=response.round_trip_time,
|
|
236
|
+
status=response.http_response.status,
|
|
237
|
+
headers=response.http_response.headers,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
if not 200 <= api_response.status <= 299:
|
|
241
|
+
raise exceptions.ApiException(api_response=api_response)
|
|
242
|
+
|
|
243
|
+
# cleanup session / response
|
|
244
|
+
response.http_response.close()
|
|
245
|
+
await response.session.close()
|
|
246
|
+
|
|
247
|
+
return api_response
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _list_all_brokerage_instruments_oapg(
|
|
251
|
+
self,
|
|
252
|
+
path_params: typing.Optional[dict] = {},
|
|
253
|
+
skip_deserialization: bool = True,
|
|
254
|
+
timeout: typing.Optional[typing.Union[float, typing.Tuple]] = None,
|
|
255
|
+
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
|
|
256
|
+
stream: bool = False,
|
|
257
|
+
) -> typing.Union[
|
|
258
|
+
ApiResponseFor200,
|
|
259
|
+
ApiResponseForDefault,
|
|
260
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
261
|
+
]:
|
|
262
|
+
"""
|
|
263
|
+
Get brokerage instruments
|
|
264
|
+
:param skip_deserialization: If true then api_response.response will be set but
|
|
265
|
+
api_response.body and api_response.headers will not be deserialized into schema
|
|
266
|
+
class instances
|
|
267
|
+
"""
|
|
268
|
+
self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
|
|
269
|
+
used_path = path.value
|
|
270
|
+
|
|
271
|
+
_path_params = {}
|
|
272
|
+
for parameter in (
|
|
273
|
+
request_path_brokerage_id,
|
|
274
|
+
):
|
|
275
|
+
parameter_data = path_params.get(parameter.name, schemas.unset)
|
|
276
|
+
if parameter_data is schemas.unset:
|
|
277
|
+
continue
|
|
278
|
+
serialized_data = parameter.serialize(parameter_data)
|
|
279
|
+
_path_params.update(serialized_data)
|
|
280
|
+
|
|
281
|
+
for k, v in _path_params.items():
|
|
282
|
+
used_path = used_path.replace('{%s}' % k, v)
|
|
283
|
+
|
|
284
|
+
_headers = HTTPHeaderDict()
|
|
285
|
+
# TODO add cookie handling
|
|
286
|
+
if accept_content_types:
|
|
287
|
+
for accept_content_type in accept_content_types:
|
|
288
|
+
_headers.add('Accept', accept_content_type)
|
|
289
|
+
method = 'get'.upper()
|
|
290
|
+
request_before_hook(
|
|
291
|
+
resource_path=used_path,
|
|
292
|
+
method=method,
|
|
293
|
+
configuration=self.api_client.configuration,
|
|
294
|
+
path_template='/brokerages/{brokerageId}/instruments',
|
|
295
|
+
auth_settings=_auth,
|
|
296
|
+
headers=_headers,
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
response = self.api_client.call_api(
|
|
300
|
+
resource_path=used_path,
|
|
301
|
+
method=method,
|
|
302
|
+
headers=_headers,
|
|
303
|
+
auth_settings=_auth,
|
|
304
|
+
timeout=timeout,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
response_for_status = _status_code_to_response.get(str(response.http_response.status))
|
|
308
|
+
if response_for_status:
|
|
309
|
+
api_response = response_for_status.deserialize(
|
|
310
|
+
response,
|
|
311
|
+
self.api_client.configuration,
|
|
312
|
+
skip_deserialization=skip_deserialization
|
|
313
|
+
)
|
|
314
|
+
else:
|
|
315
|
+
default_response = _status_code_to_response.get('default')
|
|
316
|
+
if default_response:
|
|
317
|
+
api_response = default_response.deserialize(
|
|
318
|
+
response,
|
|
319
|
+
self.api_client.configuration,
|
|
320
|
+
skip_deserialization=skip_deserialization
|
|
321
|
+
)
|
|
322
|
+
else:
|
|
323
|
+
api_response = api_client.ApiResponseWithoutDeserialization(
|
|
324
|
+
response=response.http_response,
|
|
325
|
+
round_trip_time=response.round_trip_time,
|
|
326
|
+
status=response.http_response.status,
|
|
327
|
+
headers=response.http_response.headers,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
if not 200 <= api_response.status <= 299:
|
|
331
|
+
raise exceptions.ApiException(api_response=api_response)
|
|
332
|
+
|
|
333
|
+
return api_response
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class ListAllBrokerageInstruments(BaseApi):
|
|
337
|
+
# this class is used by api classes that refer to endpoints with operationId fn names
|
|
338
|
+
|
|
339
|
+
async def alist_all_brokerage_instruments(
|
|
340
|
+
self,
|
|
341
|
+
brokerage_id: typing.Optional[str] = None,
|
|
342
|
+
path_params: typing.Optional[dict] = {},
|
|
343
|
+
**kwargs,
|
|
344
|
+
) -> typing.Union[
|
|
345
|
+
ApiResponseFor200Async,
|
|
346
|
+
ApiResponseForDefaultAsync,
|
|
347
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
348
|
+
AsyncGeneratorResponse,
|
|
349
|
+
]:
|
|
350
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
351
|
+
path_params=path_params,
|
|
352
|
+
brokerage_id=brokerage_id,
|
|
353
|
+
)
|
|
354
|
+
return await self._alist_all_brokerage_instruments_oapg(
|
|
355
|
+
path_params=args.path,
|
|
356
|
+
**kwargs,
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
def list_all_brokerage_instruments(
|
|
360
|
+
self,
|
|
361
|
+
brokerage_id: typing.Optional[str] = None,
|
|
362
|
+
path_params: typing.Optional[dict] = {},
|
|
363
|
+
) -> typing.Union[
|
|
364
|
+
ApiResponseFor200,
|
|
365
|
+
ApiResponseForDefault,
|
|
366
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
367
|
+
]:
|
|
368
|
+
""" Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list. """
|
|
369
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
370
|
+
path_params=path_params,
|
|
371
|
+
brokerage_id=brokerage_id,
|
|
372
|
+
)
|
|
373
|
+
return self._list_all_brokerage_instruments_oapg(
|
|
374
|
+
path_params=args.path,
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
class ApiForget(BaseApi):
|
|
378
|
+
# this class is used by api classes that refer to endpoints by path and http method names
|
|
379
|
+
|
|
380
|
+
async def aget(
|
|
381
|
+
self,
|
|
382
|
+
brokerage_id: typing.Optional[str] = None,
|
|
383
|
+
path_params: typing.Optional[dict] = {},
|
|
384
|
+
**kwargs,
|
|
385
|
+
) -> typing.Union[
|
|
386
|
+
ApiResponseFor200Async,
|
|
387
|
+
ApiResponseForDefaultAsync,
|
|
388
|
+
api_client.ApiResponseWithoutDeserializationAsync,
|
|
389
|
+
AsyncGeneratorResponse,
|
|
390
|
+
]:
|
|
391
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
392
|
+
path_params=path_params,
|
|
393
|
+
brokerage_id=brokerage_id,
|
|
394
|
+
)
|
|
395
|
+
return await self._alist_all_brokerage_instruments_oapg(
|
|
396
|
+
path_params=args.path,
|
|
397
|
+
**kwargs,
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
def get(
|
|
401
|
+
self,
|
|
402
|
+
brokerage_id: typing.Optional[str] = None,
|
|
403
|
+
path_params: typing.Optional[dict] = {},
|
|
404
|
+
) -> typing.Union[
|
|
405
|
+
ApiResponseFor200,
|
|
406
|
+
ApiResponseForDefault,
|
|
407
|
+
api_client.ApiResponseWithoutDeserialization,
|
|
408
|
+
]:
|
|
409
|
+
""" Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list. """
|
|
410
|
+
args = self._list_all_brokerage_instruments_mapped_args(
|
|
411
|
+
path_params=path_params,
|
|
412
|
+
brokerage_id=brokerage_id,
|
|
413
|
+
)
|
|
414
|
+
return self._list_all_brokerage_instruments_oapg(
|
|
415
|
+
path_params=args.path,
|
|
416
|
+
)
|
|
417
|
+
|