Closed sinaak closed 2 years ago
I do the following
from pandas import to_timedelta
def _to_datetime(iq_date, iq_time):
return iq_date + to_timedelta(int(iq_time / 1000000), 's')
This is the number of microseconds passed since the beginning of the day.
import numpy as np
# res is a variable from your example
data = res[0]
date = data[0] # np.datetime64['D']
time = data[1] # int
dt = date + np.timedelta64(time, "us")
btw, here is an example of working with these timestamps: https://github.com/akapur/pyiqfeed/blob/master/pyiqfeed/field_readers.py#L259-L272
Not a problem with pyiqfeed.
I have a probem converting the timestamp to human-readable format. in [example.py] line 416 (https://github.com/akapur/pyiqfeed/blob/master/example.py#L416) when i print what i get is
res = [ ('2021-02-03', 14640000000, 382.94, 383.09, 382.94, 383.09, 9223, 1100, 0), ...]
The first element is a date, the second element should be time. I cannot translate this UNIX timestamp to a human-readable timestamp. Can you please tell me what is its format. how can I see the hour:minute:second:millisecond