[R-SIG-Finance] Slow data EOD

G See gsee000 at gmail.com
Tue Oct 9 18:40:54 CEST 2012


Hi Ralph,

You can get real time intraday data from yahoo or google:
http://www.quantshare.com/sa-426-6-ways-to-download-free-intraday-and-tick-data-for-the-us-stock-market

Or you can get delayed data with quantmod::getQuote.

Maybe that will work better for you.

I'm not sure about your particular issue, but one of the issues with
yahoo's daily data is that sometimes it has duplicate timestamps (and
different volume) for the most recent observation.

HTH,
Garrett

On Tue, Oct 9, 2012 at 11:26 AM, Ralph Vince <rvince99 at gmail.com> wrote:
> I'm downloading certain equity data from yahoo on an eod basis, using
> the code, below. It works wonderfully, formatting the data and dates
> precisely as I am looking for EXCEPT often the data is late. Often,
> the latest market day's data is not up until 10, 11 pm that night.
>
> Is there something I am doing wrong here? Surely, yahoo must have the
> data by the close. is the way I am invoking calling the file, below,
> causing this? Or is there a way to obtain it from google earlier? I;d
> be very grateful for any help along these lines. Ralph Vince
>
> require(quantmod)
> library(plan)
> brsym <- c(
> "AAPL",
> "ABT",
> ...
> "WMT",
> "XOM"
> );
> for (i in 1:length(brsym)) {
> tryCatch({
> j <- paste("http://table.finance.yahoo.com/table.csv?s=",brsym[[i]],sep="");
> j <- paste(j,"&g=d&ignore=.csv",sep="");
> print(j);
> X <- read.csv(j, header=TRUE);
> # Convert the "Date" column from a factor class to a Date class
> X$Date <- as.Date(X$Date)
> # Sort the X object by the Date column -- order(-X$Date) will sort it
> in the other direction
> X <- X[order(X$Date),]
> # Format the date column as you want
> X$Date <- format(as.Date(X$Date),"%Y%m%d");
> X <- X[,1:6]
> kk <- trim.whitespace(brsym[[i]]);
> k <- paste("/home/oracle/broadbaseddata/", kk, sep="");
> k <- trim.whitespace(k);
> k <- paste(k,".csv", sep="");
> write.table(X, k, append = FALSE, quote = FALSE, sep = ",",
>             eol = "\n", na = "NA", dec = ".", row.names = FALSE,
>             col.names = FALSE, qmethod = c("escape", "double"));
> print(k);
> ko <- paste(X$Date[1], "-",X$Date[length(X$Date)]);
> print(ko);
> }, interrupt = function(ex) {
> cat("An interrupt was detected.\n");
> print(ex);
> }, error = function(ex) {
> cat("An error was detected.\n");
> print(ex);
> }, finally = {
> cat("done\n");
> })
> }
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



More information about the R-SIG-Finance mailing list