question

Upvotes
Accepted
1 1 0 0

DSWS R API - run into some problems using R code to get data for 300 companies listed under ASX300

Hi There,

We put together a rough sketch of the code that could be used to access prices and market capitalisation of the 300 companies each day. I run into some problems using this code for all 300 companies, but could you please see if it works in this environment?

#  Retrieve tickers  ------------------------------------------------------
function_ds <- function(x) {use_dsws$listRequest(instrument = x, 
                                                  datatype = c("NAME", 
                                                               "MNEM"),
                                                  requestDate = "0D") %>% 
                                mutate(mmyy = x)
}
tickers_300 <- function_ds("LASX300I")
# Retrieve price data for tickers -----------------------------------------
ts_req <- function(x) {use_dsws$timeSeriesListRequest(instrument = x,
                                                      datatype = c("P", "MV"),
                                                      startDate = "-0D",
                                                      endDate = "-0D",
                                                      frequency = "D")}
# the following line works properly - get price data for first 20 tickers but I cannot get price data for 30 tickers
# following results in error: Error requesting data.  HTTP message was: Server error : Internal Server Error : Server error: (500) Internal Server Error

Can you recommend us on how to do this for larger quantity?

datastream-apidsws-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

<AHS>

Asked DSWS Escalation Support for help.

<AHS>

So far, no response

Hello @patelj

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS

1 Answer

· Write an Answer
Upvote
Accepted
78.8k 250 52 74

@patelj

I got the same error.

To solve the problem, you need to reduce the chunkLimit. For example:

use_dsws$chunkLimit <- 20L

Then, use one datatype in the request.

ts_req <- function(x) {use_dsws$timeSeriesListRequest(instrument = x,
                                                      datatype = "P",
                                                      startDate = "-0D",
                                                      endDate = "-0D",
                                                      frequency = "D")}

If you use more than one datatype, you will get this error "subscription out of bound". This issue has been fixed in 1.7.10 available on GitHub, as mentioned on this thread.

require(devtools) 
install_github("CharlesCara/DatastreamDSWS2R")

In conclusion, you need to upgrade the package to 1.7.10, and set the chunkLimit.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.