Rscript -e 'gety<-function(sym){u<-paste0("https://query1.finance.yahoo.com/v8/finance/chart/",URLencode(sym,reserved=T),"?period1=1262304000&period2=1656633600&interval=1d");s<-paste(readLines(u,warn=F),collapse="");getarr<-function(k){mark<-paste0(intToUtf8(34),k,intToUtf8(34),":[");p<-regexpr(mark,s,fixed=T);if(p[1]<0)return(NULL);r<-substring(s,p+attr(p,"match.length"));e<-regexpr("]",r,fixed=T);suppressWarnings(as.numeric(strsplit(substr(r,1,e-1),",",f=T)[[1]]))};tt<-getarr("timestamp");cc<-getarr("close");data.frame(date=as.Date(as.POSIXct(tt,origin="1970-01-01",tz="UTC")),price=cc)};fdiff<-function(x,d){n2.5*se0)d1=as.Date(lim[1])&a$date<=as.Date(lim[2]),];y