binance-sdk-cms 1.0.0__tar.gz

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.
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 - 2026-10-15
4
+
5
+ - Initial release
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Binance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: binance-sdk-cms
3
+ Version: 1.0.0
4
+ Summary: Official Binance Cms Connector - A lightweight library that provides a convenient interface to Binance's Cms REST API and WebSocket Streams.
5
+ License: MIT
6
+ License-File: LICENCE
7
+ Author: Binance
8
+ Requires-Python: >=3.10,<3.15
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Requires-Dist: aiohttp (>=3.14.5,<4.0.0)
17
+ Requires-Dist: binance-common (==4.6.0)
18
+ Requires-Dist: pycryptodome (>=3.17,<5)
19
+ Requires-Dist: pydantic (>=2.14.1)
20
+ Requires-Dist: requests (>=2.34.2)
21
+ Requires-Dist: urllib3 (>=2.8.0)
@@ -0,0 +1,35 @@
1
+ [tool.poetry]
2
+ name = "binance-sdk-cms"
3
+ version = "1.0.0"
4
+ description = "Official Binance Cms Connector - A lightweight library that provides a convenient interface to Binance's Cms REST API and WebSocket Streams."
5
+ authors = ["Binance"]
6
+ license = "MIT"
7
+ include = ["CHANGELOG.md", "LICENSE"]
8
+ packages = [
9
+ { include = "binance_sdk_cms", from = "src" }
10
+ ]
11
+
12
+ [tool.poetry.dependencies]
13
+ python = ">=3.10,<3.15"
14
+ requests = ">=2.34.2"
15
+ urllib3 = ">=2.8.0"
16
+ pydantic = ">=2.14.1"
17
+ pycryptodome = ">=3.17,<5"
18
+ aiohttp = "^3.14.5"
19
+ binance-common = "4.6.0"
20
+
21
+ [tool.poetry.group.dev.dependencies]
22
+ tox = "^4.65.0"
23
+ pytest-asyncio = "^1.4.0"
24
+ black = "^26.10.1"
25
+ ruff = "^0.17.0"
26
+ pytest = ">=9.1.1"
27
+
28
+ [tool.ruff]
29
+ exclude = [".git", ".tox", "build", "dist"]
30
+ lint.select = ["E4", "E7", "E9", "F"]
31
+ lint.ignore = ["E741"]
32
+
33
+ [build-system]
34
+ requires = ["poetry-core"]
35
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,31 @@
1
+ from binance_sdk_cms.cms import Cms
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
+ CMS_WS_STREAMS_PROD_URL,
16
+ )
17
+
18
+ __all__ = [
19
+ "Cms",
20
+ "CMS_WS_STREAMS_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,44 @@
1
+ import platform
2
+ from importlib.metadata import version
3
+
4
+ from binance_common.configuration import (
5
+ ConfigurationWebSocketStreams,
6
+ )
7
+ from binance_common.constants import (
8
+ CMS_WS_STREAMS_PROD_URL,
9
+ )
10
+ from . import metadata
11
+ from .websocket_streams import CmsWebSocketStreams
12
+
13
+ LIB_NAME = metadata.NAME
14
+ LIB_VERSION = version(LIB_NAME)
15
+
16
+
17
+ class Cms:
18
+ """Cms API that exposes Stream APIs in a single interface."""
19
+
20
+ def __init__(
21
+ self,
22
+ config_ws_streams: ConfigurationWebSocketStreams = None,
23
+ ) -> None:
24
+ self._websocket_streams = None
25
+ self._websocket_streams_config = (
26
+ ConfigurationWebSocketStreams()
27
+ if config_ws_streams is None
28
+ else config_ws_streams
29
+ )
30
+
31
+ @property
32
+ def websocket_streams(self) -> CmsWebSocketStreams:
33
+ if self._websocket_streams is None and self._websocket_streams_config:
34
+ self._websocket_streams_config.user_agent = f"{LIB_NAME}/{LIB_VERSION} (Python/{platform.python_version()}; {platform.system()}; {platform.machine()})"
35
+ self._websocket_streams_config.stream_url = (
36
+ CMS_WS_STREAMS_PROD_URL
37
+ if self._websocket_streams_config.stream_url is None
38
+ else self._websocket_streams_config.stream_url
39
+ )
40
+ self._websocket_streams = CmsWebSocketStreams(
41
+ self._websocket_streams_config
42
+ )
43
+
44
+ return self._websocket_streams
@@ -0,0 +1 @@
1
+ NAME = "binance-sdk-cms"
File without changes
@@ -0,0 +1,13 @@
1
+ """
2
+ Prediction Trading Streams
3
+
4
+ Binance Web3 Prediction pushes 14 types of per-user business events in real time via the Binance SApi WebSocket channel, covering trading (market / limit), reward claim, fund transfer and market resolution, plus order book (bid/ask) quotes broadcast per topic. Business events are routed by exact `(topic, userId)` match; order book topics are broadcast to every subscriber. Delivery is at-most-once, ordering is not guaranteed, and offline messages are not cached — pull the latest state via the REST API after reconnecting and deduplicate on `pushId` (business events) or `marketId` + `updateTimestampMs` (order book).
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 .websocket_streams import CmsWebSocketStreams
12
+
13
+ __all__ = ["CmsWebSocketStreams"]
@@ -0,0 +1,13 @@
1
+ """
2
+ Prediction Trading Streams
3
+
4
+ Binance Web3 Prediction pushes 14 types of per-user business events in real time via the Binance SApi WebSocket channel, covering trading (market / limit), reward claim, fund transfer and market resolution, plus order book (bid/ask) quotes broadcast per topic. Business events are routed by exact `(topic, userId)` match; order book topics are broadcast to every subscriber. Delivery is at-most-once, ordering is not guaranteed, and offline messages are not cached — pull the latest state via the REST API after reconnecting and deduplicate on `pushId` (business events) or `marketId` + `updateTimestampMs` (order book).
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 .com_announcement_en_response import (
12
+ ComAnnouncementEnResponse as ComAnnouncementEnResponse,
13
+ )
@@ -0,0 +1,126 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Prediction Trading Streams
5
+
6
+ Binance Web3 Prediction pushes 14 types of per-user business events in real time via the Binance SApi WebSocket channel, covering trading (market / limit), reward claim, fund transfer and market resolution, plus order book (bid/ask) quotes broadcast per topic. Business events are routed by exact `(topic, userId)` match; order book topics are broadcast to every subscriber. Delivery is at-most-once, ordering is not guaranteed, and offline messages are not cached — pull the latest state via the REST API after reconnecting and deduplicate on `pushId` (business events) or `marketId` + `updateTimestampMs` (order book).
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
+ from __future__ import annotations
14
+ import pprint
15
+ import re # noqa: F401
16
+ import json
17
+
18
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
19
+ from typing import Any, ClassVar, Dict, List, Optional
20
+ from typing import Set
21
+ from typing_extensions import Self
22
+
23
+
24
+ class ComAnnouncementEnResponse(BaseModel):
25
+ """
26
+ ComAnnouncementEnResponse
27
+ """ # noqa: E501
28
+
29
+ catalog_id: Optional[StrictInt] = Field(
30
+ default=None, description="Catalog ID", alias="catalogId"
31
+ )
32
+ catalog_name: Optional[StrictStr] = Field(
33
+ default=None, description="Catalog Name", alias="catalogName"
34
+ )
35
+ publish_date: Optional[StrictInt] = Field(
36
+ default=None,
37
+ description="Publish timestamp (milliseconds)",
38
+ alias="publishDate",
39
+ )
40
+ title: Optional[StrictStr] = Field(default=None, description="Announcement title")
41
+ body: Optional[StrictStr] = Field(default=None, description="Announcement body")
42
+ disclaimer: Optional[StrictStr] = Field(default=None, description="Disclaimer")
43
+ additional_properties: Dict[str, Any] = {}
44
+ __properties: ClassVar[List[str]] = [
45
+ "catalog_id",
46
+ "catalog_name",
47
+ "publish_date",
48
+ "title",
49
+ "body",
50
+ "disclaimer",
51
+ ]
52
+
53
+ model_config = ConfigDict(
54
+ populate_by_name=True,
55
+ validate_assignment=True,
56
+ protected_namespaces=(),
57
+ )
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of ComAnnouncementEnResponse from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ * Fields in `self.additional_properties` are added to the output dict.
83
+ """
84
+ excluded_fields: Set[str] = set(
85
+ [
86
+ "additional_properties",
87
+ ]
88
+ )
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # puts key-value pairs in additional_properties in the top level
96
+ if self.additional_properties is not None:
97
+ for _key, _value in self.additional_properties.items():
98
+ _dict[_key] = _value
99
+
100
+ return _dict
101
+
102
+ @classmethod
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
+ """Create an instance of ComAnnouncementEnResponse from a dict"""
105
+ if obj is None:
106
+ return None
107
+
108
+ if not isinstance(obj, dict):
109
+ return cls.model_validate(obj)
110
+
111
+ _obj = cls.model_validate(
112
+ {
113
+ "catalogId": obj.get("catalogId"),
114
+ "catalogName": obj.get("catalogName"),
115
+ "publishDate": obj.get("publishDate"),
116
+ "title": obj.get("title"),
117
+ "body": obj.get("body"),
118
+ "disclaimer": obj.get("disclaimer"),
119
+ }
120
+ )
121
+ # store additional fields in additional_properties
122
+ for _key in obj.keys():
123
+ if _key not in cls.__properties:
124
+ _obj.additional_properties[_key] = obj.get(_key)
125
+
126
+ return _obj
@@ -0,0 +1,9 @@
1
+ """
2
+ Prediction Trading Streams
3
+
4
+ Binance Web3 Prediction pushes 14 types of per-user business events in real time via the Binance SApi WebSocket channel, covering trading (market / limit), reward claim, fund transfer and market resolution, plus order book (bid/ask) quotes broadcast per topic. Business events are routed by exact `(topic, userId)` match; order book topics are broadcast to every subscriber. Delivery is at-most-once, ordering is not guaranteed, and offline messages are not cached — pull the latest state via the REST API after reconnecting and deduplicate on `pushId` (business events) or `marketId` + `updateTimestampMs` (order book).
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
+ """
@@ -0,0 +1,11 @@
1
+ """
2
+ Prediction Trading Streams
3
+
4
+ Binance Web3 Prediction pushes 14 types of per-user business events in real time via the Binance SApi WebSocket channel, covering trading (market / limit), reward claim, fund transfer and market resolution, plus order book (bid/ask) quotes broadcast per topic. Business events are routed by exact `(topic, userId)` match; order book topics are broadcast to every subscriber. Delivery is at-most-once, ordering is not guaranteed, and offline messages are not cached — pull the latest state via the REST API after reconnecting and deduplicate on `pushId` (business events) or `marketId` + `updateTimestampMs` (order book).
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 .default_api import DefaultApi as DefaultApi
@@ -0,0 +1,64 @@
1
+ """
2
+ Prediction Trading Streams
3
+
4
+ Binance Web3 Prediction pushes 14 types of per-user business events in real time via the Binance SApi WebSocket channel, covering trading (market / limit), reward claim, fund transfer and market resolution, plus order book (bid/ask) quotes broadcast per topic. Business events are routed by exact `(topic, userId)` match; order book topics are broadcast to every subscriber. Delivery is at-most-once, ordering is not guaranteed, and offline messages are not cached — pull the latest state via the REST API after reconnecting and deduplicate on `pushId` (business events) or `marketId` + `updateTimestampMs` (order book).
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 binance_common.utils import ws_streams_placeholder
12
+ from binance_common.websocket import (
13
+ WebSocketStreamBase,
14
+ RequestStream,
15
+ RequestStreamHandle,
16
+ )
17
+
18
+ from ..models import ComAnnouncementEnResponse
19
+
20
+
21
+ from typing import Optional
22
+
23
+
24
+ class DefaultApi:
25
+ """Client for DefaultApi endpoints."""
26
+
27
+ def __init__(self, websocket_base: WebSocketStreamBase) -> None:
28
+ self.websocket_base = websocket_base
29
+
30
+ async def com_announcement_en(
31
+ self,
32
+ id: Optional[str] = None,
33
+ ) -> RequestStreamHandle:
34
+ r"""
35
+
36
+ /com_announcement_en
37
+ https://developers.binance.com/en/docs/products/announcements/announcement
38
+
39
+ Receive push notifications hen Binance publishes announcements in English (language code: en).
40
+
41
+ Args:
42
+ id (Optional[str] = None): Unique WebSocket request ID.
43
+
44
+ Returns:
45
+ RequestStreamHandle
46
+
47
+ Raises:
48
+ RequiredError: If a required parameter is missing.
49
+
50
+ """
51
+
52
+ stream = ws_streams_placeholder(
53
+ "/com_announcement_en".replace("/", "", 1),
54
+ {
55
+ "id": id,
56
+ },
57
+ )
58
+
59
+ return await RequestStream(
60
+ self.websocket_base,
61
+ stream=stream,
62
+ response_model=ComAnnouncementEnResponse,
63
+ stream_url="",
64
+ )
@@ -0,0 +1,188 @@
1
+ """
2
+ Prediction Trading Streams
3
+
4
+ Binance Web3 Prediction pushes 14 types of per-user business events in real time via the Binance SApi WebSocket channel, covering trading (market / limit), reward claim, fund transfer and market resolution, plus order book (bid/ask) quotes broadcast per topic. Business events are routed by exact `(topic, userId)` match; order book topics are broadcast to every subscriber. Delivery is at-most-once, ordering is not guaranteed, and offline messages are not cached — pull the latest state via the REST API after reconnecting and deduplicate on `pushId` (business events) or `marketId` + `updateTimestampMs` (order book).
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
+ import aiohttp
12
+ import secrets
13
+ from urllib.parse import quote, urlencode
14
+
15
+ from pydantic import BaseModel
16
+ from typing import Callable, Optional, TypeVar
17
+
18
+ from binance_common.configuration import ConfigurationWebSocketStreams
19
+
20
+ from binance_common.signature import Signers
21
+ from binance_common.utils import get_signature, get_timestamp
22
+
23
+ from binance_common.websocket import (
24
+ WebSocketStreamBase,
25
+ WebSocketConnection,
26
+ RequestStreamHandle,
27
+ )
28
+
29
+
30
+ from .streams.default_api import DefaultApi
31
+
32
+ T = TypeVar("T", bound=BaseModel)
33
+
34
+
35
+ class CmsWebSocketStreams(WebSocketStreamBase):
36
+ def __init__(
37
+ self,
38
+ configuration: ConfigurationWebSocketStreams,
39
+ ) -> None:
40
+
41
+ stream_url = configuration.stream_url
42
+
43
+ super().__init__(configuration)
44
+ self.configuration = configuration
45
+
46
+ self.configuration.stream_url = stream_url
47
+ for attr in ("api_key", "api_secret", "private_key", "private_key_passphrase"):
48
+ if not hasattr(self.configuration, attr):
49
+ setattr(self.configuration, attr, None)
50
+ self._signer = (
51
+ Signers.get_signer(
52
+ self.configuration.private_key,
53
+ self.configuration.private_key_passphrase,
54
+ )
55
+ if self.configuration.private_key
56
+ else None
57
+ )
58
+
59
+ self._defaultApi = DefaultApi(self)
60
+
61
+ def _signed_url(self, url: str) -> str:
62
+ """Appends a freshly signed query string to the WebSocket URL.
63
+
64
+ Args:
65
+ url (str): The WebSocket URL to sign.
66
+ Returns:
67
+ str: The URL with the `random`, `recvWindow`, `timestamp` and `signature` query parameters.
68
+ """
69
+
70
+ query = urlencode(
71
+ {
72
+ "random": secrets.token_hex(16),
73
+ "recvWindow": 30000,
74
+ "timestamp": get_timestamp(),
75
+ }
76
+ )
77
+ signature = get_signature(self.configuration, query, self._signer)
78
+ return f"{url}?{query}&signature={quote(signature, safe='')}"
79
+
80
+ async def connect(self, url, configuration, ws_id=None, url_paths=None):
81
+ """Connects to the WebSocket server, sending the API key with every connection."""
82
+
83
+ if self.session is None:
84
+ self.session = aiohttp.ClientSession(
85
+ headers={"X-MBX-APIKEY": self.configuration.api_key or ""}
86
+ )
87
+ return await super().connect(
88
+ url, configuration, ws_id=ws_id, url_paths=url_paths
89
+ )
90
+
91
+ async def init_connection(self, url, configuration, url_path=None, ws_id=None):
92
+ """Opens a connection on a newly signed URL, so reconnects never reuse an expired signature."""
93
+
94
+ await super().init_connection(
95
+ self._signed_url(url), configuration, url_path=url_path, ws_id=ws_id
96
+ )
97
+
98
+ async def ping_server(self, connection: WebSocketConnection):
99
+ """Sends a ping message to the WebSocket server to check the connection status.
100
+
101
+ Args:
102
+ connection (WebSocketConnection): The WebSocket connection to send the ping message to.
103
+ """
104
+
105
+ if self.session:
106
+ await super().ping_ws_stream(connection=connection)
107
+ else:
108
+ raise ValueError("WebSocket session is not initialized.")
109
+
110
+ async def subscribe(
111
+ self,
112
+ streams,
113
+ response_model: Optional[T] = None,
114
+ stream_url: Optional[str] = None,
115
+ ):
116
+ """Subscribes to the specified WebSocket streams.
117
+
118
+ Args:
119
+ streams (list): A list of WebSocket streams to subscribe to.
120
+ response_model (Optional[T]): The Pydantic model to validate the response against.
121
+ """
122
+
123
+ await super().subscribe(
124
+ streams, response_model=response_model, stream_url=stream_url
125
+ )
126
+
127
+ async def unsubscribe(self, streams):
128
+ """Unsubscribes from the specified WebSocket streams.
129
+
130
+ Args:
131
+ streams (list): A list of WebSocket streams to unsubscribe from.
132
+ """
133
+
134
+ await super().unsubscribe(streams)
135
+
136
+ def on(self, event: str, callback: Callable[[T], None], stream: str):
137
+ """Registers a callback function for a specific WebSocket event.
138
+
139
+ Args:
140
+ event (str): The event type to listen for (e.g., 'message', 'error').
141
+ callback (Callable[[T], None]): The callback function to be called when the event occurs.
142
+ stream (str): The specific WebSocket stream to listen to.
143
+ """
144
+
145
+ super().on(event, callback, stream)
146
+
147
+ async def list_subscribe(self) -> dict:
148
+ """Lists all currently subscribed WebSocket streams.
149
+
150
+ Returns:
151
+ dict: A dictionary containing the current subscriptions.
152
+ """
153
+
154
+ return await super().list_subscribe()
155
+
156
+ async def close_connection(
157
+ self, connection: WebSocketConnection = None, close_session: bool = True
158
+ ):
159
+ """Closes the WebSocket connection and optionally the session.
160
+
161
+ Args:
162
+ connection (WebSocketConnection, optional): The WebSocket connection to close. If None, the current session's connection is used.
163
+ close_session (bool, optional): Whether to close the session after closing the connection. Defaults to True.
164
+ """
165
+
166
+ await super().close_connection(connection, close_session)
167
+
168
+ async def com_announcement_en(
169
+ self,
170
+ id: Optional[str] = None,
171
+ ) -> RequestStreamHandle:
172
+ r"""
173
+
174
+
175
+ Receive push notifications hen Binance publishes announcements in English (language code: en).
176
+
177
+ Args:
178
+ id (Optional[str] = None): Unique WebSocket request ID.
179
+
180
+ Returns:
181
+ RequestStreamHandle
182
+
183
+ Raises:
184
+ RequiredError: If a required parameter is missing.
185
+
186
+ """
187
+
188
+ return await self._defaultApi.com_announcement_en(id)