wiz-trader 0.8.0__py3-none-any.whl → 0.9.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.
- wiz_trader/__init__.py +1 -1
- wiz_trader/quotes/client.py +34 -14
- {wiz_trader-0.8.0.dist-info → wiz_trader-0.9.0.dist-info}/METADATA +1 -1
- wiz_trader-0.9.0.dist-info/RECORD +9 -0
- wiz_trader-0.8.0.dist-info/RECORD +0 -9
- {wiz_trader-0.8.0.dist-info → wiz_trader-0.9.0.dist-info}/WHEEL +0 -0
- {wiz_trader-0.8.0.dist-info → wiz_trader-0.9.0.dist-info}/top_level.txt +0 -0
wiz_trader/__init__.py
CHANGED
wiz_trader/quotes/client.py
CHANGED
@@ -129,24 +129,44 @@ class QuotesClient:
|
|
129
129
|
async def _handle_messages(self) -> None:
|
130
130
|
"""
|
131
131
|
Handle incoming messages and dispatch them via the on_tick callback.
|
132
|
+
Handles newline-delimited JSON objects in a single message.
|
132
133
|
"""
|
133
134
|
try:
|
134
135
|
async for message in self.ws: # type: ignore
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
136
|
+
# Log message size for debugging large message issues
|
137
|
+
if self.log_level == "debug" and isinstance(message, str):
|
138
|
+
message_size = len(message.encode("utf-8"))
|
139
|
+
if message_size > 1024 * 1024: # Over 1MB
|
140
|
+
logger.debug("Received large message: %d bytes", message_size)
|
141
|
+
# Log the beginning of the message for debugging
|
142
|
+
logger.debug("Message starts with: %s", message[:100])
|
143
|
+
|
144
|
+
if isinstance(message, str):
|
145
|
+
# Special handling for newline-delimited JSON
|
146
|
+
if '\n' in message:
|
147
|
+
# Split by newlines and process each JSON object separately
|
148
|
+
for json_str in message.strip().split('\n'):
|
149
|
+
if not json_str:
|
150
|
+
continue
|
151
|
+
|
152
|
+
try:
|
153
|
+
tick = json.loads(json_str)
|
154
|
+
if self.on_tick:
|
155
|
+
self.on_tick(tick)
|
156
|
+
except json.JSONDecodeError as e:
|
157
|
+
logger.error("Failed to parse JSON object: %s", str(e))
|
158
|
+
logger.error("Invalid JSON: %s...", json_str[:100])
|
145
159
|
else:
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
160
|
+
# Single JSON object
|
161
|
+
try:
|
162
|
+
tick = json.loads(message)
|
163
|
+
if self.on_tick:
|
164
|
+
self.on_tick(tick)
|
165
|
+
except json.JSONDecodeError as e:
|
166
|
+
logger.error("Failed to parse JSON: %s", str(e))
|
167
|
+
logger.error("Invalid JSON message: %s...", message[:100])
|
168
|
+
else:
|
169
|
+
logger.warning("Received non-string message: %s", type(message))
|
150
170
|
except ConnectionClosed as e:
|
151
171
|
logger.info("Connection closed during message handling: %s", e)
|
152
172
|
except Exception as e:
|
@@ -0,0 +1,9 @@
|
|
1
|
+
wiz_trader/__init__.py,sha256=IOxpQuLhYFFBe75RCqoa81faDkt84n1pMIuiTND5_Kc,181
|
2
|
+
wiz_trader/apis/__init__.py,sha256=ItWKMOl4omiW0g2f-M7WRW3v-dss_ULd9vYnFyIIT9o,132
|
3
|
+
wiz_trader/apis/client.py,sha256=rq6FEA5DDCGXc4axSSzOdVvet1NWlW8L843GMp0qXQA,20562
|
4
|
+
wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
|
5
|
+
wiz_trader/quotes/client.py,sha256=gYiX65AjzCEHIwCROjcu7d6uGirpGj4bnkNQ2UOQEv8,9790
|
6
|
+
wiz_trader-0.9.0.dist-info/METADATA,sha256=sfnuzoMTsXBeUYdnJ7-Bns7116N5VErpbiIsFfkkigU,4281
|
7
|
+
wiz_trader-0.9.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
wiz_trader-0.9.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
|
9
|
+
wiz_trader-0.9.0.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
wiz_trader/__init__.py,sha256=eQVmMb93DelACJ7AZWh6NeaqKEgI8WpfXVpRn7ssrRs,181
|
2
|
-
wiz_trader/apis/__init__.py,sha256=ItWKMOl4omiW0g2f-M7WRW3v-dss_ULd9vYnFyIIT9o,132
|
3
|
-
wiz_trader/apis/client.py,sha256=rq6FEA5DDCGXc4axSSzOdVvet1NWlW8L843GMp0qXQA,20562
|
4
|
-
wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
|
5
|
-
wiz_trader/quotes/client.py,sha256=jDUbFMadDfAOOVXKbNWGuEgEZWzaOFY-aXRzeNRr1Gc,8954
|
6
|
-
wiz_trader-0.8.0.dist-info/METADATA,sha256=CwTLDUVCzNGJvegr9xwXzLZTWO8I1JDAGZjkh5X3Wso,4281
|
7
|
-
wiz_trader-0.8.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
-
wiz_trader-0.8.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
|
9
|
-
wiz_trader-0.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|