1

Im trying to develop a simple shiny app that prints the latest EUR price

library(shiny)

ui <- basicPage(

  verbatimTextOutput(outputId = "roll", placeholder = TRUE)

)

server <- function(input, output) {

  Rblpapi::blpConnect()
  last_print <- reactiveVal(value = 1)

  Rblpapi::subscribe(securities = "EUR Curncy", fields = "LAST_PRICE", fun = function(x) last_print(x))

  output$roll <- renderPrint({
    last_print()$data$LAST_PRICE
  })
} 

shinyApp(ui = ui, server = server)

If you dont have access to Rblpapi, think of subscribe as a function that creates a subscription to a data, and calls fun every time the data is updated. When you run the app, nothing happens, though if you debug it, you see last_print is being updated. I know Im messing up with the reactive paradigm in Shiny, but I just cant get my head around of what would the pattern to use. Any stub function to replace Rblpapi::subscribe for people without Bloomberg to be able to test and help would be very appreciated also.

Juancentro
  • 1,119
  • 7
  • 19

0 Answers0