0

I'm querying data from alphavantage using the getSymbols.av function. Whenever I run the standalone paragraph

GOOGL <- getSymbols.av("GOOGL",auto.assign=F,return.class = "xts",adjusted=T,outputs.size="full",data.type="csv",periodicity = "weekly")
GOOG <- getSymbols.av("GOOG",auto.assign=F,return.class = "xts",adjusted=T,outputs.size="full",data.type="csv",periodicity = "weekly")
google <- rbind.xts(GOOGL["2013-05-17/2014-04-04"],GOOG["2013-05-17/2018-05-18"])
google <- google[-48,]

it works. However, when I try to run the whole script in Source mode, i get this error:

Error in read.zoo(tmp, header = TRUE, sep = ",") : 
  index has bad entries at data rows: 1 2
In addition: Warning message:
In read(file, ...) :
  incomplete final line found by readTableHeader on 'C:\Users\..\Temp

I opened that file and it is empty.

None of the other functions, who look exactly the same have this error. I tried to get wiser by studying this answer:'Incomplete final line' warning when trying to read a .csv file into R , but I didn't.

I'm a beginner at R, the code is meant to be sent to my Finance professor and I don't want to look like I'm struggling. I'd be very thankful for any help you could give.

My sessionInfo() is:

R version 3.4.3 (2017-11-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

PrinzvonK
  • 93
  • 6
  • I cannot replicate this behavior using quantmod 0.4.13 in R-3.4.3 on 64-bit Ubuntu. What is your `sessionInfo()` output (please edit it into your question)? Does it work if you do not set `data.type`? Also, you should not call `getSymbols.av` directly. Call `getSymbols("GOOGL", src = "av", ...)` instead. – Joshua Ulrich May 25 '18 at 13:06
  • when I remove data.type="csv", I can still not run the whole script. If I only run the paragraph, it works however. Does alphavantage have a strict time limit on API queries? – PrinzvonK May 26 '18 at 11:44
  • They probably have a limit, but two queries shouldn't be a problem. – Joshua Ulrich May 26 '18 at 12:09

0 Answers0