Yahoo offers an API to download historical intraday data, but I am unable to understand the timestamps on the data. The URL request is:
Format : http://chartapi.finance.yahoo.com/instrument/1.0/[TICKER]/chartdata;type=quote;range=[days]d/csv
Example: http://chartapi.finance.yahoo.com/instrument/1.0/GOOG/chartdata;type=quote;range=1d/csv
Which returns data like the following:
uri:/instrument/1.0/GOOG/chartdata;type=quote;range=1d/csv
ticker:goog
Company-Name:Alphabet Inc.
Exchange-Name:NMS
unit:MIN
timezone:EST
currency:USD
gmtoffset:-18000
previous_close:731.2300
Timestamp:1447425000,1447448400
labels:1447426800,1447430400,1447434000,1447437600,1447441200,1447444800,1447448400
values:Timestamp,close,high,low,open,volume
close:717.0000,730.7000
high:717.0000,731.1500
low:716.7300,729.7850
open:717.0000,731.0000
volume:0,104700
1447425030,727.2000,728.8550,727.2000,728.7500,48300
1447425096,727.8440,728.2200,727.8440,727.8850,0
1447425120,728.7300,729.0000,727.2900,728.4800,25100
1447425183,729.3100,729.8900,728.1550,729.2465,20000
1447425247,729.4500,731.1500,729.4500,730.4893,8900
1447425301,729.4500,730.4000,729.0600,729.3200,4500
1447425418,730.4250,730.7000,729.0200,730.0500,5100
The data it in each row is in the form: Timestamp, close, high, low, open, volume.
The timestamp appears to be a Unix timestamp (seconds since 1970). That is confirmed by this web post: https://www.daniweb.com/programming/software-development/threads/260694/how-to-process-timestamp-in-chartapi-finance-yahoo-com
My question is on the values I get when converting from Unix timestamps, they look very close to timestamps I would expect, every one minute, but are off by random amounts.
2015-11-13 09:30:58
2015-11-13 09:31:15
2015-11-13 09:32:06
2015-11-13 09:33:00
2015-11-13 09:34:03
My question is if anyone else has been successful in figuring how to properly convert the timestamps to the correct values.
-----------Update based on R code suggestion-------------------
I tried the R code below and got similar results of timestamps on odd non-even minutes. Here is the output using this getYahoo.intraday() function and GOOG ticker:
> p <- getYahoo.intraday('goog','1')
> head(p)
Open High Low Close Volume
2015-11-13 09:31:02 728.410 728.420 727.1601 727.830 18300
2015-11-13 09:32:06 728.960 729.000 727.2900 728.450 11200
2015-11-13 09:33:00 729.240 729.890 728.1550 728.460 15300
2015-11-13 09:34:03 729.450 730.820 729.4500 729.846 15300
2015-11-13 09:35:14 729.450 729.588 729.0600 729.070 3900
2015-11-13 09:36:58 730.425 730.700 729.0200 730.050 5100