Capturing Intraday data, Backup plan
[This article was first published on Systematic Investor » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
In the Capturing Intraday data post, I outlined steps to setup your own process to capture Intraday data. But what do you do if you missed some data points due for example internet being down or due to power outage your server was re-started. To fill up the gaps in the Intraday data, you could get up to 10 day historical Intraday data from Google finance.
I created a wrapper function for Google finance, getSymbol.intraday.google() function in data.r at github, to download historical Intrday quotes. For example,
##############################################################################
# Load Systematic Investor Toolbox (SIT)
# http://systematicinvestor.wordpress.com/systematic-investor-toolbox/
###############################################################################
setInternet2(TRUE)
con = gzcon(url('http://www.systematicportfolio.com/sit.gz', 'rb'))
source(con)
close(con)
#*****************************************************************
# Load Intraday data
#******************************************************************
data = getSymbol.intraday.google('GOOG', 'NASDAQ', 60, '5d')
last(data, 10)
plota(data, type='candle', main='Google Intraday prices')
> last(data, 10)
Open High Low Close Volume
2014-03-28 15:52:00 1119.10 1119.61 1119.10 1119.610 4431
2014-03-28 15:53:00 1119.30 1119.30 1118.75 1118.805 3954
2014-03-28 15:54:00 1119.31 1119.45 1119.18 1119.340 5702
2014-03-28 15:55:00 1119.17 1119.40 1119.00 1119.340 8907
2014-03-28 15:56:00 1119.19 1119.35 1119.18 1119.190 11882
2014-03-28 15:57:00 1119.30 1119.30 1119.02 1119.270 6298
2014-03-28 15:58:00 1119.25 1119.35 1119.15 1119.265 10542
2014-03-28 15:59:00 1119.38 1119.49 1118.82 1119.250 29496
2014-03-28 16:00:00 1120.15 1120.15 1119.15 1119.380 71518
2014-03-28 16:01:00 1120.15 1120.15 1120.15 1120.150 0
So if your Intraday capture process failed, you can rely on Google fiance data to fill up the gaps.
To leave a comment for the author, please follow the link and comment on their blog: Systematic Investor » R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
