Raising this on behalf of an external client. I would like to use this language to access the Eikon API and I see there is a Python package, but looking for an R package.
@mariellejoy
Thank you for reaching out to us.
As far as I know, we don't officially provide the R library for Eikon Data API.
There is the Eikon Data API library for R available on GitHub but it is a community version.
Hello @mariellejoy
Please note that the eikonapir is not LSEG product and is not supported by LSEG.
If you have any questions or encounter issues with the product, please contact the developer directly via GitHub directly.
Use the latest refinitiv-data library (or the old eikon one) and use the reticulate package to connect to the python environment where you pull the data via python. Then you only need to focus on data pulling via python and can continue with data wrangling in R.In my case reticulate had problems with x64 data formats and I wrote the following function for cleaning/transforming these:
def CleanDtypes(df): df.reset_index(drop = True,inplace = True) for col in df.select_dtypes(include=['float64']).dtypes.to_dict(): df[[col]] = df[[col]].astype("float32") for col in df.select_dtypes(include=['Int64']).dtypes.to_dict(): df[[col]] = df[[col]].astype(int) for col in df.select_dtypes(include=['string']).dtypes.to_dict(): df[[col]] = df[[col]].astype(str) return df
P.s.: You can also keep it more R style using the reticulate wrappers for direct python execution in R:
> library(reticulate)> Sys.getenv("RETICULATE_PYTHON")[1] "C:\\ProgramData\\Anaconda3\\envs\\someenv"> rd <- import("refinitiv.data")> pd <- import("pandas")> datetime <- import("datetime")> > rd$open_session()<refinitiv.data.session.Definition object at 0x2a248194650 {name='workspace'}>> IndexConst <- rd$get_data(+ universe = c('.FTSE'), + fields = + c('TR.IndexConstituentRIC', + 'TR.IndexConstituentName',+ 'TR.IndexConstituentWeightPercent'),+ parameters = + list(+ 'SDate' = '2023-06-01'+ ),+ use_field_names_in_headers = TRUE+ )>> tibble::as_tibble(IndexConst)# A tibble: 100 × 4 Instrument TR.INDEXCONSTITUENTRIC TR.INDEXCONSTITUENTNAME TR.INDEXCONSTITUENTW…¹ <chr> <chr> <chr> <dbl> 1 .FTSE STAN.L STANDARD CHARTERED PLC ORD 0.789 2 .FTSE CRDA.L CRODA ORD 0.444 3 .FTSE ANTO.L ANTOFAGASTA ORD 0.248 4 .FTSE BNZL.L BUNZL ORD 0.551 5 .FTSE SGE.L SAGE GROUP ORD 0.460 6 .FTSE SVT.L SEVERN TRENT ORD 0.352 7 .FTSE BLND.L BRITISH LAND REIT 0.166 8 .FTSE ICAG.L INTL CONSOLIDATED AIRLINES G… 0.302 9 .FTSE REL.L RELX PLC ORD 2.54 10 .FTSE SMIN.L SMITHS GROUP ORD 0.297# ℹ 90 more rows# ℹ abbreviated name: ¹TR.INDEXCONSTITUENTWEIGHTPERCENT# ℹ Use `print(n = ...)` to see more rows