I am trying to save as a CSV file the orderbook generated after running a portfolio on quantstrat.
order_book <- getOrderBook(qs.portfolio)
write.csv(order_book, "orderbook.csv")
I am getting the following error message:
Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class ""order_book"" to a data.frame
I am new to R so I believe there is a simple solution, but I haven't been able to figure it out.