binance-sdk-alpha 1.0.0__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. binance_sdk_alpha/__init__.py +31 -0
  2. binance_sdk_alpha/alpha.py +34 -0
  3. binance_sdk_alpha/metadata.py +1 -0
  4. binance_sdk_alpha/rest_api/__init__.py +13 -0
  5. binance_sdk_alpha/rest_api/api/__init__.py +11 -0
  6. binance_sdk_alpha/rest_api/api/market_data_api.py +270 -0
  7. binance_sdk_alpha/rest_api/models/__init__.py +42 -0
  8. binance_sdk_alpha/rest_api/models/aggregated_trades_response.py +129 -0
  9. binance_sdk_alpha/rest_api/models/aggregated_trades_response_data_inner.py +118 -0
  10. binance_sdk_alpha/rest_api/models/enums.py +9 -0
  11. binance_sdk_alpha/rest_api/models/get_exchange_info_response.py +130 -0
  12. binance_sdk_alpha/rest_api/models/get_exchange_info_response_data.py +146 -0
  13. binance_sdk_alpha/rest_api/models/get_exchange_info_response_data_assets_inner.py +102 -0
  14. binance_sdk_alpha/rest_api/models/get_exchange_info_response_data_symbols_inner.py +158 -0
  15. binance_sdk_alpha/rest_api/models/get_exchange_info_response_data_symbols_inner_filters_inner.py +161 -0
  16. binance_sdk_alpha/rest_api/models/klines_response.py +113 -0
  17. binance_sdk_alpha/rest_api/models/klines_response_data_item.py +81 -0
  18. binance_sdk_alpha/rest_api/models/klines_response_data_item_inner.py +132 -0
  19. binance_sdk_alpha/rest_api/models/ticker_response.py +128 -0
  20. binance_sdk_alpha/rest_api/models/ticker_response_data.py +157 -0
  21. binance_sdk_alpha/rest_api/models/token_list_response.py +137 -0
  22. binance_sdk_alpha/rest_api/models/token_list_response_data_inner.py +225 -0
  23. binance_sdk_alpha/rest_api/rest_api.py +238 -0
  24. binance_sdk_alpha-1.0.0.dist-info/METADATA +27 -0
  25. binance_sdk_alpha-1.0.0.dist-info/RECORD +27 -0
  26. binance_sdk_alpha-1.0.0.dist-info/WHEEL +4 -0
  27. binance_sdk_alpha-1.0.0.dist-info/licenses/LICENCE +21 -0
@@ -0,0 +1,31 @@
1
+ from binance_sdk_alpha.alpha import Alpha
2
+ from binance_common.errors import (
3
+ ClientError,
4
+ RequiredError,
5
+ UnauthorizedError,
6
+ ForbiddenError,
7
+ TooManyRequestsError,
8
+ RateLimitBanError,
9
+ ServerError,
10
+ NetworkError,
11
+ NotFoundError,
12
+ BadRequestError,
13
+ )
14
+ from binance_common.constants import (
15
+ ALPHA_REST_API_PROD_URL,
16
+ )
17
+
18
+ __all__ = [
19
+ "Alpha",
20
+ "ALPHA_REST_API_PROD_URL",
21
+ "ClientError",
22
+ "RequiredError",
23
+ "UnauthorizedError",
24
+ "ForbiddenError",
25
+ "TooManyRequestsError",
26
+ "RateLimitBanError",
27
+ "ServerError",
28
+ "NetworkError",
29
+ "NotFoundError",
30
+ "BadRequestError",
31
+ ]
@@ -0,0 +1,34 @@
1
+ import platform
2
+ from importlib.metadata import version
3
+
4
+ from binance_common.configuration import ConfigurationRestAPI
5
+ from binance_common.constants import ALPHA_REST_API_PROD_URL
6
+ from . import metadata
7
+ from .rest_api import AlphaRestAPI
8
+
9
+ LIB_NAME = metadata.NAME
10
+ LIB_VERSION = version(LIB_NAME)
11
+
12
+
13
+ class Alpha:
14
+ """Alpha API that exposes REST APIs in a single interface."""
15
+
16
+ def __init__(self, config_rest_api: ConfigurationRestAPI = None) -> None:
17
+ self._rest_api = None
18
+ self._rest_api_config = (
19
+ ConfigurationRestAPI() if config_rest_api is None else config_rest_api
20
+ )
21
+
22
+ @property
23
+ def rest_api(self) -> AlphaRestAPI:
24
+ if self._rest_api is None and self._rest_api_config:
25
+ self._rest_api_config.base_headers["User-Agent"] = (
26
+ f"{LIB_NAME}/{LIB_VERSION} (Python/{platform.python_version()}; {platform.system()}; {platform.machine()})"
27
+ )
28
+ self._rest_api_config.base_path = (
29
+ ALPHA_REST_API_PROD_URL
30
+ if self._rest_api_config.base_path is None
31
+ else self._rest_api_config.base_path
32
+ )
33
+ self._rest_api = AlphaRestAPI(self._rest_api_config)
34
+ return self._rest_api
@@ -0,0 +1 @@
1
+ NAME = "binance-sdk-alpha"
@@ -0,0 +1,13 @@
1
+ """
2
+ Binance Alpha REST API
3
+
4
+ OpenAPI Specification for the Binance Alpha REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """
10
+
11
+ from .rest_api import AlphaRestAPI
12
+
13
+ __all__ = ["AlphaRestAPI"]
@@ -0,0 +1,11 @@
1
+ """
2
+ Binance Alpha REST API
3
+
4
+ OpenAPI Specification for the Binance Alpha REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """
10
+
11
+ from .market_data_api import MarketDataApi as MarketDataApi
@@ -0,0 +1,270 @@
1
+ """
2
+ Binance Alpha REST API
3
+
4
+ OpenAPI Specification for the Binance Alpha REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """
10
+
11
+ from typing import Optional, Union
12
+ from requests import Session
13
+ from binance_common.configuration import ConfigurationRestAPI
14
+ from binance_common.errors import RequiredError
15
+ from binance_common.models import ApiResponse
16
+ from binance_common.signature import Signers
17
+ from binance_common.utils import send_request
18
+
19
+ from ..models import AggregatedTradesResponse
20
+ from ..models import GetExchangeInfoResponse
21
+ from ..models import KlinesResponse
22
+ from ..models import TickerResponse
23
+ from ..models import TokenListResponse
24
+
25
+
26
+ class MarketDataApi:
27
+ """API Client for MarketDataApi endpoints."""
28
+
29
+ def __init__(
30
+ self,
31
+ configuration: ConfigurationRestAPI = None,
32
+ session: Session = None,
33
+ signer: Signers = None,
34
+ ) -> None:
35
+ self._configuration = configuration
36
+ self._session = session
37
+ self._signer = signer
38
+
39
+ def aggregated_trades(
40
+ self,
41
+ symbol: Union[str, None],
42
+ from_id: Optional[int] = None,
43
+ start_time: Optional[int] = None,
44
+ end_time: Optional[int] = None,
45
+ limit: Optional[int] = None,
46
+ ) -> ApiResponse[AggregatedTradesResponse]:
47
+ """
48
+ Aggregated Trades
49
+ GET /bapi/defi/v1/public/alpha-trade/agg-trades
50
+ https://developers.binance.com/docs/alpha/market-data/rest-api/Aggregated-Trades
51
+
52
+ Retrieves compressed, aggregated historical trades for a specific symbol. Useful for recent trade history.
53
+
54
+ Weight: 0
55
+
56
+ Args:
57
+ symbol (Union[str, None]): e.g., "ALPHA_175USDT" – use token ID from Token List
58
+ from_id (Optional[int] = None): starting trade ID to fetch from
59
+ start_time (Optional[int] = None): start timestamp (milliseconds)
60
+ end_time (Optional[int] = None): end timestamp (milliseconds)
61
+ limit (Optional[int] = None): number of results to return (default 500, max 1000)
62
+
63
+ Returns:
64
+ ApiResponse[AggregatedTradesResponse]
65
+
66
+ Raises:
67
+ RequiredError: If a required parameter is missing.
68
+
69
+ """
70
+
71
+ if symbol is None:
72
+ raise RequiredError(
73
+ field="symbol", error_message="Missing required parameter 'symbol'"
74
+ )
75
+
76
+ body = {}
77
+ payload = {
78
+ "symbol": symbol,
79
+ "from_id": from_id,
80
+ "start_time": start_time,
81
+ "end_time": end_time,
82
+ "limit": limit,
83
+ }
84
+
85
+ return send_request(
86
+ self._session,
87
+ self._configuration,
88
+ method="GET",
89
+ path="/bapi/defi/v1/public/alpha-trade/agg-trades",
90
+ payload=payload,
91
+ body=body,
92
+ time_unit=self._configuration.time_unit,
93
+ response_model=AggregatedTradesResponse,
94
+ )
95
+
96
+ def get_exchange_info(
97
+ self,
98
+ ) -> ApiResponse[GetExchangeInfoResponse]:
99
+ """
100
+ Get Exchange Info
101
+ GET /bapi/defi/v1/public/alpha-trade/get-exchange-info
102
+ https://developers.binance.com/docs/alpha/market-data/rest-api/Get-Exchange-Info
103
+
104
+ Fetches general exchange information, such as supported symbols, rate limits, and server time.
105
+
106
+ Weight: 0
107
+
108
+ Args:
109
+
110
+ Returns:
111
+ ApiResponse[GetExchangeInfoResponse]
112
+
113
+ Raises:
114
+ RequiredError: If a required parameter is missing.
115
+
116
+ """
117
+
118
+ body = None
119
+ payload = None
120
+
121
+ return send_request(
122
+ self._session,
123
+ self._configuration,
124
+ method="GET",
125
+ path="/bapi/defi/v1/public/alpha-trade/get-exchange-info",
126
+ payload=payload,
127
+ body=body,
128
+ time_unit=self._configuration.time_unit,
129
+ response_model=GetExchangeInfoResponse,
130
+ )
131
+
132
+ def klines(
133
+ self,
134
+ symbol: Union[str, None],
135
+ interval: Union[str, None],
136
+ limit: Optional[int] = None,
137
+ start_time: Optional[int] = None,
138
+ end_time: Optional[int] = None,
139
+ ) -> ApiResponse[KlinesResponse]:
140
+ """
141
+ Klines (Candlestick Data)
142
+ GET /bapi/defi/v1/public/alpha-trade/klines
143
+ https://developers.binance.com/docs/alpha/market-data/rest-api/Klines
144
+
145
+ Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and volume over intervals. Useful for charting and analysis.
146
+
147
+ Weight: 0
148
+
149
+ Args:
150
+ symbol (Union[str, None]): e.g., "ALPHA_175USDT" – use token ID from Token List
151
+ interval (Union[str, None]): e.g., "1h" – supported intervals: 1s, 15s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M
152
+ limit (Optional[int] = None): number of results to return (default 500, max 1000)
153
+ start_time (Optional[int] = None): start timestamp (milliseconds)
154
+ end_time (Optional[int] = None): end timestamp (milliseconds)
155
+
156
+ Returns:
157
+ ApiResponse[KlinesResponse]
158
+
159
+ Raises:
160
+ RequiredError: If a required parameter is missing.
161
+
162
+ """
163
+
164
+ if symbol is None:
165
+ raise RequiredError(
166
+ field="symbol", error_message="Missing required parameter 'symbol'"
167
+ )
168
+ if interval is None:
169
+ raise RequiredError(
170
+ field="interval", error_message="Missing required parameter 'interval'"
171
+ )
172
+
173
+ body = {}
174
+ payload = {
175
+ "symbol": symbol,
176
+ "interval": interval,
177
+ "limit": limit,
178
+ "start_time": start_time,
179
+ "end_time": end_time,
180
+ }
181
+
182
+ return send_request(
183
+ self._session,
184
+ self._configuration,
185
+ method="GET",
186
+ path="/bapi/defi/v1/public/alpha-trade/klines",
187
+ payload=payload,
188
+ body=body,
189
+ time_unit=self._configuration.time_unit,
190
+ response_model=KlinesResponse,
191
+ )
192
+
193
+ def ticker(
194
+ self,
195
+ symbol: Union[str, None],
196
+ ) -> ApiResponse[TickerResponse]:
197
+ """
198
+ Ticker (24hr Price Statistics)
199
+ GET /bapi/defi/v1/public/alpha-trade/ticker
200
+ https://developers.binance.com/docs/alpha/market-data/rest-api/24hr-ticker-price-change
201
+
202
+ Gets the 24-hour rolling window price change statistics for a symbol, including volume and price changes.
203
+
204
+ Weight: 0
205
+
206
+ Args:
207
+ symbol (Union[str, None]): e.g., "ALPHA_175USDT" – use token ID from Token List
208
+
209
+ Returns:
210
+ ApiResponse[TickerResponse]
211
+
212
+ Raises:
213
+ RequiredError: If a required parameter is missing.
214
+
215
+ """
216
+
217
+ if symbol is None:
218
+ raise RequiredError(
219
+ field="symbol", error_message="Missing required parameter 'symbol'"
220
+ )
221
+
222
+ body = {}
223
+ payload = {"symbol": symbol}
224
+
225
+ return send_request(
226
+ self._session,
227
+ self._configuration,
228
+ method="GET",
229
+ path="/bapi/defi/v1/public/alpha-trade/ticker",
230
+ payload=payload,
231
+ body=body,
232
+ time_unit=self._configuration.time_unit,
233
+ response_model=TickerResponse,
234
+ )
235
+
236
+ def token_list(
237
+ self,
238
+ ) -> ApiResponse[TokenListResponse]:
239
+ """
240
+ Token List
241
+ GET /bapi/defi/v1/public/wallet-direct/buw/wallet/cex/alpha/all/token/list
242
+ https://developers.binance.com/docs/alpha/market-data/rest-api/Token-List
243
+
244
+ Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this to find the token ID for constructing symbols in other endpoints.
245
+
246
+ Weight: 0
247
+
248
+ Args:
249
+
250
+ Returns:
251
+ ApiResponse[TokenListResponse]
252
+
253
+ Raises:
254
+ RequiredError: If a required parameter is missing.
255
+
256
+ """
257
+
258
+ body = None
259
+ payload = None
260
+
261
+ return send_request(
262
+ self._session,
263
+ self._configuration,
264
+ method="GET",
265
+ path="/bapi/defi/v1/public/wallet-direct/buw/wallet/cex/alpha/all/token/list",
266
+ payload=payload,
267
+ body=body,
268
+ time_unit=self._configuration.time_unit,
269
+ response_model=TokenListResponse,
270
+ )
@@ -0,0 +1,42 @@
1
+ """
2
+ Binance Alpha REST API
3
+
4
+ OpenAPI Specification for the Binance Alpha REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """
10
+
11
+ from .aggregated_trades_response import (
12
+ AggregatedTradesResponse as AggregatedTradesResponse,
13
+ )
14
+ from .aggregated_trades_response_data_inner import (
15
+ AggregatedTradesResponseDataInner as AggregatedTradesResponseDataInner,
16
+ )
17
+ from .get_exchange_info_response import (
18
+ GetExchangeInfoResponse as GetExchangeInfoResponse,
19
+ )
20
+ from .get_exchange_info_response_data import (
21
+ GetExchangeInfoResponseData as GetExchangeInfoResponseData,
22
+ )
23
+ from .get_exchange_info_response_data_assets_inner import (
24
+ GetExchangeInfoResponseDataAssetsInner as GetExchangeInfoResponseDataAssetsInner,
25
+ )
26
+ from .get_exchange_info_response_data_symbols_inner import (
27
+ GetExchangeInfoResponseDataSymbolsInner as GetExchangeInfoResponseDataSymbolsInner,
28
+ )
29
+ from .get_exchange_info_response_data_symbols_inner_filters_inner import (
30
+ GetExchangeInfoResponseDataSymbolsInnerFiltersInner as GetExchangeInfoResponseDataSymbolsInnerFiltersInner,
31
+ )
32
+ from .klines_response import KlinesResponse as KlinesResponse
33
+ from .klines_response_data_item import KlinesResponseDataItem as KlinesResponseDataItem
34
+ from .klines_response_data_item_inner import (
35
+ KlinesResponseDataItemInner as KlinesResponseDataItemInner,
36
+ )
37
+ from .ticker_response import TickerResponse as TickerResponse
38
+ from .ticker_response_data import TickerResponseData as TickerResponseData
39
+ from .token_list_response import TokenListResponse as TokenListResponse
40
+ from .token_list_response_data_inner import (
41
+ TokenListResponseDataInner as TokenListResponseDataInner,
42
+ )
@@ -0,0 +1,129 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Binance Alpha REST API
5
+
6
+ OpenAPI Specification for the Binance Alpha REST API
7
+ The version of the OpenAPI document: 1.0.0
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """
12
+
13
+
14
+ from __future__ import annotations
15
+ import pprint
16
+ import re # noqa: F401
17
+ import json
18
+
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
20
+ from typing import Any, ClassVar, Dict, List, Optional
21
+ from binance_sdk_alpha.rest_api.models.aggregated_trades_response_data_inner import (
22
+ AggregatedTradesResponseDataInner,
23
+ )
24
+ from typing import Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class AggregatedTradesResponse(BaseModel):
29
+ """
30
+ AggregatedTradesResponse
31
+ """ # noqa: E501
32
+
33
+ code: Optional[StrictStr] = None
34
+ message: Optional[StrictStr] = None
35
+ message_detail: Optional[StrictStr] = Field(default=None, alias="messageDetail")
36
+ data: Optional[List[AggregatedTradesResponseDataInner]] = None
37
+ additional_properties: Dict[str, Any] = {}
38
+ __properties: ClassVar[List[str]] = ["code", "message", "messageDetail", "data"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def is_array(cls) -> bool:
57
+ return False
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of AggregatedTradesResponse from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ * Fields in `self.additional_properties` are added to the output dict.
74
+ """
75
+ excluded_fields: Set[str] = set(
76
+ [
77
+ "additional_properties",
78
+ ]
79
+ )
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # override the default output from pydantic by calling `to_dict()` of each item in data (list)
87
+ _items = []
88
+ if self.data:
89
+ for _item_data in self.data:
90
+ if _item_data:
91
+ _items.append(_item_data.to_dict())
92
+ _dict["data"] = _items
93
+ # puts key-value pairs in additional_properties in the top level
94
+ if self.additional_properties is not None:
95
+ for _key, _value in self.additional_properties.items():
96
+ _dict[_key] = _value
97
+
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of AggregatedTradesResponse from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate(
110
+ {
111
+ "code": obj.get("code"),
112
+ "message": obj.get("message"),
113
+ "messageDetail": obj.get("messageDetail"),
114
+ "data": (
115
+ [
116
+ AggregatedTradesResponseDataInner.from_dict(_item)
117
+ for _item in obj["data"]
118
+ ]
119
+ if obj.get("data") is not None
120
+ else None
121
+ ),
122
+ }
123
+ )
124
+ # store additional fields in additional_properties
125
+ for _key in obj.keys():
126
+ if _key not in cls.__properties:
127
+ _obj.additional_properties[_key] = obj.get(_key)
128
+
129
+ return _obj
@@ -0,0 +1,118 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Binance Alpha REST API
5
+
6
+ OpenAPI Specification for the Binance Alpha REST API
7
+ The version of the OpenAPI document: 1.0.0
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """
12
+
13
+
14
+ from __future__ import annotations
15
+ import pprint
16
+ import re # noqa: F401
17
+ import json
18
+
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
20
+ from typing import Any, ClassVar, Dict, List, Optional
21
+ from typing import Set
22
+ from typing_extensions import Self
23
+
24
+
25
+ class AggregatedTradesResponseDataInner(BaseModel):
26
+ """
27
+ AggregatedTradesResponseDataInner
28
+ """ # noqa: E501
29
+
30
+ a: Optional[StrictInt] = None
31
+ p: Optional[StrictStr] = None
32
+ q: Optional[StrictStr] = None
33
+ f: Optional[StrictInt] = None
34
+ l: Optional[StrictInt] = None
35
+ T: Optional[StrictInt] = Field(default=None, alias="T")
36
+ m: Optional[StrictBool] = None
37
+ additional_properties: Dict[str, Any] = {}
38
+ __properties: ClassVar[List[str]] = ["a", "p", "q", "f", "l", "T", "m"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def is_array(cls) -> bool:
57
+ return False
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of AggregatedTradesResponseDataInner from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ * Fields in `self.additional_properties` are added to the output dict.
74
+ """
75
+ excluded_fields: Set[str] = set(
76
+ [
77
+ "additional_properties",
78
+ ]
79
+ )
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # puts key-value pairs in additional_properties in the top level
87
+ if self.additional_properties is not None:
88
+ for _key, _value in self.additional_properties.items():
89
+ _dict[_key] = _value
90
+
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of AggregatedTradesResponseDataInner from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate(
103
+ {
104
+ "a": obj.get("a"),
105
+ "p": obj.get("p"),
106
+ "q": obj.get("q"),
107
+ "f": obj.get("f"),
108
+ "l": obj.get("l"),
109
+ "T": obj.get("T"),
110
+ "m": obj.get("m"),
111
+ }
112
+ )
113
+ # store additional fields in additional_properties
114
+ for _key in obj.keys():
115
+ if _key not in cls.__properties:
116
+ _obj.additional_properties[_key] = obj.get(_key)
117
+
118
+ return _obj
@@ -0,0 +1,9 @@
1
+ """
2
+ Binance Alpha REST API
3
+
4
+ OpenAPI Specification for the Binance Alpha REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """