Based on document from https://marketstack.com/documentation
http://api.marketstack.com/v1/eod
? access_key = YOUR_ACCESS_KEY
& symbols = AAPL
& date_from = 2019-01-01
& date_to = 2019-02-01
Specify a date in YYYY-MM-DD format.
You can also specify an exact time in ISO-8601 date format,
e.g. 2020-05-21T00:00:00+0000.
Example: /eod/2020-01-01
I am able to get access from the stock market without add date
parameter. It worked well
symbols <- c("FB", "GOOG", "AMZN")
access_key <- "my_access_key"
api_url <- paste0("http://api.marketstack.com/v1/eod?access_key=",
access_key, "&symbols=", paste(symbols, collapse = ","))
stock_dt <- fromJSON(api_url)
When I added date_from
and date_to
to url, it didn't understand those parameter
# this is not working
date <- "2019-01-06"
api_url <- paste0("http://api.marketstack.com/v1/eod/",date,"?access_key=",
access_key, "&symbols=", paste(symbols, collapse = ","))
stock_dt <- fromJSON(api_url)
# this is working
api_url <- paste0("http://api.marketstack.com/v1/eod/","2021-01-06T00:00:00+0000","?access_key=",
access_key, "&symbols=", paste(symbols, collapse = ","))
stock_dt <- fromJSON(api_url)
# this is not working
api_url <- paste0("http://api.marketstack.com/v1/eod?access_key=",access_key, "&symbols=",paste(symbols, collapse = ","), "&date_from=2021-01-06T00:00:00+0000","&date_to=2021-01-07T00:00:00+0000")
stocks_dt <- fromJSON(api_url)
Any suggestion?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…