polygon symbol handling edge case

This commit is contained in:
Danglewood
2024-11-10 13:08:40 -08:00
parent 2489128b67
commit 1e82e1e08f
3 changed files with 7 additions and 6 deletions

View File

@@ -705,7 +705,8 @@ def send_message(
else:
client.logger.error("Broadcast process is not running.")
except Exception as e:
client.logger.error(f"Error sending message to WebSocket process: {e}")
msg = f"Error sending message to WebSocket process: {e.__class__.__name__} -> {e.__str__()}"
client.logger.error(msg)
def read_message_queue(

View File

@@ -57,9 +57,9 @@ async def create_connection(
await asyncio.sleep(1)
if not client.is_running:
if client._exception:
exc = getattr(client, "_exception", None)
if not client.is_running or client._exception:
exc = getattr(client, "_exception", None)
if exc:
client._atexit()
if isinstance(exc, UnauthorizedError):
raise exc

View File

@@ -65,9 +65,9 @@ async def handle_symbol(symbol):
if ticker and "." not in ticker:
ticker = f"{feed}.{ticker}"
if ASSET_TYPE == "crypto" and "-" not in ticker and ticker != "*":
if ASSET_TYPE == "crypto" and "-" not in ticker and "*" not in ticker:
ticker = ticker[:3] + "-" + ticker[3:]
elif ASSET_TYPE == "fx" and "/" not in ticker and ticker != "*":
elif ASSET_TYPE == "fx" and "/" not in ticker and "*" not in ticker:
ticker = ticker[:3] + "/" + ticker[3:]
elif ASSET_TYPE == "fx" and "-" in ticker:
ticker = ticker.replace("-", "/")