remove redundant timestamp conversion in ws serializer

This commit is contained in:
Timothy Pogue 2022-11-18 09:43:39 -07:00
parent 4c7bb79c86
commit b6a8e421f1

View File

@ -3,7 +3,7 @@ from abc import ABC, abstractmethod
import orjson import orjson
import rapidjson import rapidjson
from pandas import DataFrame, Timestamp from pandas import DataFrame
from freqtrade.misc import dataframe_to_json, json_to_dataframe from freqtrade.misc import dataframe_to_json, json_to_dataframe
from freqtrade.rpc.api_server.ws.proxy import WebSocketProxy from freqtrade.rpc.api_server.ws.proxy import WebSocketProxy
@ -52,11 +52,6 @@ def _json_default(z):
'__type__': 'dataframe', '__type__': 'dataframe',
'__value__': dataframe_to_json(z) '__value__': dataframe_to_json(z)
} }
# Pandas returns a Timestamp object, we need to
# convert it to a timestamp int (with ms) for orjson
# to handle it
if isinstance(z, Timestamp):
return z.timestamp() * 1e3
raise TypeError raise TypeError