For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
I have a loop going through a list of ISIN/SEDOL names I want converted to RICs. Once it encounters an ISIN it deems invalid I get an error as below and the loop exists.
Error in print.default("HTTP Error, code= ", response$status_code, sep = "") : invalid 'digits' argument
I tried using a try clause with the silent option on but the get_symbology stops working after the first fail and the following code gives me NAs for all calls after the first error. If I do the calls one by one for each ISIN the commands work properly but I have a long list and want the loop to work.
RIC_vec <- vector("character",length = N) for (i in 1:N) { RIC_ID <- try(get_symbology(comps[i,2][[1]], from_symbol_type = "ISIN", to_symbol_type = "RIC"),silent=T) print(i) if ("RIC" %in% names(RIC_ID)) { RIC_vec[i] <- RIC_ID[1,2]} else { RIC_vec[i] <- NA} }
I'm using the eikonapir package in R.
Thanks,
Claudiu
From the problem statement, you got the error when calling the get_symbology function with a list of ISIN symbols. However, it works fine if it is called one by one.
Please share a list of symbols used by the application and let me know how many symbols in each request.
@claudiu
In order to understand what's going on here we need a way of reproducing the issue on our end. Would you be able to provide a complete sample code that reliably recreates the issue for you and that we could run to reproduce it? I just tried to simulate the issue by including an invalid ISIN in the character vector and running the code below.
> isins = c("US0378331005","akuebfkn","FR0000121501") > for (i in 1:3) { + print(isins[i]) + RIC <- try(get_symbology(isins[i], + from_symbol_type = "ISIN",to_symbol_type = "RIC"),silent=T) + print(i) + print(RIC) + }
The code ran gracefully as expected and produced the following output
[1] "US0378331005" [1] 1 Symbol RIC 1 US0378331005 AAPL.O [1] "akuebfkn" [1] 2 Symbol error 1 akuebfkn No best match available [1] "FR0000121501" [1] 3
I also tried to replicate the issue you describe by forcing get_symbology method to return an error. For this purpose I used invalid app key in set_app_id method. Again I couldn't reproduce the behavior you describe. In this test case every get_symbology call failed, but the loop ran all the way through thanks to try function.
It might be helpful to print the try-error object to understand what happens on your end.
To clarify, the error is for calling get_symbology with one ISIN item only. It is done in a loop, see code example above, each time with single ISIN. The error fails at different times during the loop if run several times so it may be a connectivity or response from server issue. The ISINs are OK since I manage to call get_symbology directly (not in loop) on the "failed" ISIN and get a correct answer. The question is if this is some server related issue how to workaround it and why doesn't the get_symbology command fail gracefully instead of exiting the program?