Fyers Data Feed

When I fetch EOD data, I am having to use datetime.datetime.utcfromtimestamp() to convert timestamp to CYMD. While 5min data, I am having to use datetime.datetime.fromtimestamp() to do the same. Why the difference?

I am using the function response = fyers.history(data=data) as mentioned in the V3 documents.

Hi
Can you paste both response there for which you are facing issue.

I am using the code provided by you. Just converting the time to CYMDHMS format so that it is easy to read.

start_dt = datetime.datetime(t_dt.year, t_dt.month, t_dt.day)

end_dt = datetime.datetime.now()

data = {“symbol”:full_sym, “resolution”:“D”, “date_format”:“0”, “range_from”:int(start_dt.timestamp()), “range_to”:int(end_dt.timestamp()), “cont_flag”:“1”}

response = fyers.history(data=data)

temp_list = pd.DataFrame(response[‘candles’], columns = [‘timestamp’, ‘open’, ‘high’, ‘low’, ‘close’, ‘volume’])

for index1, row1 in temp_list.iterrows():

eod_ts = datetime.datetime.utcfromtimestamp(row1[‘timestamp’]).strftime(‘%Y-%m-%d %H:%M:%S’)

eod_dt = datetime.datetime.utcfromtimestamp(row1[‘timestamp’]).strftime(‘%Y-%m-%d’)

Above of EOD and below is for 5min, only need to change the 3 lines as below. Just check at your end.

data = {“symbol”:full_sym, “resolution”:“5”, “date_format”:“0”, “range_from”:int(start_dt.timestamp()), “range_to”:int(end_dt.timestamp()), “cont_flag”:“1”}

eod_ts = datetime.datetime.fromtimestamp(row1[‘timestamp’]).strftime(‘%Y-%m-%d %H:%M:%S’)

eod_dt = datetime.datetime.fromtimestamp(row1[‘timestamp’]).strftime(‘%Y-%m-%d’)

@Z4PBvkQGyF any update?

Raised ticket 1340439 for this.