Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hyperliquid/websocket_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def subscription_to_identifier(subscription: Subscription) -> str:
return f'activeAssetCtx:{subscription["coin"].lower()}'
elif subscription["type"] == "activeAssetData":
return f'activeAssetData:{subscription["coin"].lower()},{subscription["user"].lower()}'
elif subscription['type'] == "twapStates":
return f'twapStates:{subscription["user"].lower()}'


def ws_msg_to_identifier(ws_msg: WsMsg) -> Optional[str]:
Expand Down Expand Up @@ -72,6 +74,8 @@ def ws_msg_to_identifier(ws_msg: WsMsg) -> Optional[str]:
return f'activeAssetCtx:{ws_msg["data"]["coin"].lower()}'
elif ws_msg["channel"] == "activeAssetData":
return f'activeAssetData:{ws_msg["data"]["coin"].lower()},{ws_msg["data"]["user"].lower()}'
elif ws_msg["channel"] == "twapStates":
return f'twapStates:{ws_msg["data"]["user"].lower()}'


class WebsocketManager(threading.Thread):
Expand Down