Search code examples
rbloombergrblpapi

change currency output of bdh


How can I set the currency for this to dollars?

bdh(securities = "SBMAR1 Comdty", fields = 'PX_LAST', start.date = today() - 10, end.date = today())

I tried:

bdh(securities = "SBMAR1 Comdty", fields = 'PX_LAST', start.date = today() - 10, end.date = today(), options = c('FX' = 'USD'))

Error in bdh_Impl(con, securities, fields, start.date, end.date, options, : Sub-element '(null)' does not exist.

and

bdh(securities = "SBMAR1 Comdty", fields = 'PX_LAST', start.date = today() - 10, end.date = today(), options = c('Currency' = 'USD'))

Error in bdh_Impl(con, securities, fields, start.date, end.date, options, : Attempt to access unknown sub-element 'Currency' on element 'HistoricalDataRequest'


Solution

  • Just has to be lowercase:

    bdh(securities = "SBMAR1 Comdty", fields = 'PX_LAST', start.date = today() - 10, end.date = today(), options = c("currency"="USD"))