From b3b0c918d98326df8361e5f03302c7ecbd54be65 Mon Sep 17 00:00:00 2001 From: Timothy Pogue Date: Thu, 8 Sep 2022 10:44:03 -0600 Subject: [PATCH] cleanup old code --- freqtrade/rpc/api_server/ws/schema.py | 12 ------------ freqtrade/rpc/api_server/ws/serializer.py | 10 ---------- freqtrade/rpc/api_server/ws/utils.py | 12 ------------ 3 files changed, 34 deletions(-) delete mode 100644 freqtrade/rpc/api_server/ws/utils.py diff --git a/freqtrade/rpc/api_server/ws/schema.py b/freqtrade/rpc/api_server/ws/schema.py index 3221911de..0baa8d233 100644 --- a/freqtrade/rpc/api_server/ws/schema.py +++ b/freqtrade/rpc/api_server/ws/schema.py @@ -64,15 +64,3 @@ class WSAnalyzedDFMessage(WSMessageSchema): data: AnalyzedDFData # -------------------------------------------------------------------------- - - -if __name__ == "__main__": - message = WSAnalyzedDFMessage( - data={ - "key": ("1", "5m", "spot"), - "df": DataFrame(), - "la": datetime.now() - } - ) - - print(message) diff --git a/freqtrade/rpc/api_server/ws/serializer.py b/freqtrade/rpc/api_server/ws/serializer.py index c0c24bb28..d1ddd84f0 100644 --- a/freqtrade/rpc/api_server/ws/serializer.py +++ b/freqtrade/rpc/api_server/ws/serializer.py @@ -46,16 +46,6 @@ class JSONWebSocketSerializer(WebSocketSerializer): return json.loads(data, object_hook=_json_object_hook) -# ORJSON does not support .loads(object_hook=x) parameter, so we must use RapidJSON - -class RapidJSONWebSocketSerializer(WebSocketSerializer): - def _serialize(self, data): - return rapidjson.dumps(data, default=_json_default) - - def _deserialize(self, data): - return rapidjson.loads(data, object_hook=_json_object_hook) - - class HybridJSONWebSocketSerializer(WebSocketSerializer): def _serialize(self, data) -> str: return str(orjson.dumps(data, default=_json_default), "utf-8") diff --git a/freqtrade/rpc/api_server/ws/utils.py b/freqtrade/rpc/api_server/ws/utils.py deleted file mode 100644 index 1ceecab88..000000000 --- a/freqtrade/rpc/api_server/ws/utils.py +++ /dev/null @@ -1,12 +0,0 @@ -from fastapi import WebSocket -# fastapi does not make this available through it, so import directly from starlette -from starlette.websockets import WebSocketState - - -async def is_websocket_alive(ws: WebSocket) -> bool: - if ( - ws.application_state == WebSocketState.CONNECTED and - ws.client_state == WebSocketState.CONNECTED - ): - return True - return False