Error in read(file, ...) : 'file' must be a character string or connection

Hi, out of an excel file I derive tickers and use the Bloomberg-market data connection to get prices and calculate returns afterwards.

In the below mentioned code I only took out the real "path". Everything works until I get to "anotherp".
Then the above mentioned error message kicks in. Please see my coding below:

setwd("//path/Datenbank_R/R_skripte")

library("Rblpapi")
library("RODBC")
library("lubridate")
library("dplyr")
library("tidyr")
library("readxl")
library("xlsx")
library("PerformanceAnalytics")


# connect to bloomberg
con <- blpConnect()

heute <- today()-1
datab <- "2019-12-29"
datei <- "FondsBM.xlsx"

dframe<-as.data.frame(read_excel(as.character(datei), range="Input!A1:E7"))
dframe

einWP <-c(dframe[1,1],dframe[1,2])
# comprises the following tickers: EURAKTI GR Equity and MSVEUNTR Index

einWP
prices<-bdh(einWP, "PX_LAST", as.Date(datab), as.Date(heute)) 
prices

anotherp <- prices %>%
   Return.read() %>%
   Return.calculate()

I stop he coding at this line

I hope somebody might help me with this. Thanks Marcus

According to its documentation, PerformanceAnalytics::Return.read() expects a filename as its first argument. According to its documenation, Rblpapi::bdh() returns a list of data frames, so prices is not the path to a file, hence the error.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.