Hi, When FULL mode streaming is enabled, the following error is seen in python,
File "/usr/local/lib/python2.7/dist-packages/simplejson/encoder.py", line 268, in default raise TypeError(repr(o) + " is not JSON serializable") exceptions.TypeError: datetime.datetime(2019, 12, 16, 14, 19, 53) is not JSON serializable
exceptions.TypeError: datetime.datetime(2019, 12, 16, 14, 19, 53) is not JSON serializable
Are you trying to dump WebSocket dictionary to the JSON object? If yes, you can follow either of the below approaches to dump to JSON object: 1>Specifically convert DateTime field to string and then dump it. eg: data['timestamp'] = response['timestamp'].strftime("%Y-%m-%d %H:%M:%S") 2>Convert everything it doesn't know to strings. eg:json.dumps(websocket_dic, indent=4, sort_keys=True, default=str)
No such error in QUOTE mode.
Yeah, as there isn't timestamp packet field(Last traded timestamp/Exchange timestamp) in Quote mode.
If yes, you can follow either of the below approaches to dump to JSON object:
1>Specifically convert DateTime field to string and then dump it.
eg:
data['timestamp'] = response['timestamp'].strftime("%Y-%m-%d %H:%M:%S")
2>Convert everything it doesn't know to strings.
eg:
json.dumps(websocket_dic, indent=4, sort_keys=True, default=str)
Yeah, as there isn't timestamp packet field(Last traded timestamp/Exchange timestamp) in Quote mode.Thank you for the quick & accurate response.
Regards,
Ramakrishnan S