Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bdh: problem with int.as.double #244

Closed
mgartner6 opened this issue Oct 9, 2017 · 1 comment
Closed

bdh: problem with int.as.double #244

mgartner6 opened this issue Oct 9, 2017 · 1 comment

Comments

@mgartner6
Copy link

There seems to be a problem in bdh() since the implementation of the function argument int.as.double. Please try the following:

library(Rblpapi)
blpConnect()
bdh('SPX Index', 'PX_VOLUME', start.date = Sys.Date()-365*10, int.as.double = FALSE)

This ends up in the following error:

Error in bdh_Impl(con, securities, fields, start.date, end.date, options,  : 
  Attempt to access value of element 'PX_VOLUME'(type: 'Float64') as 'Int32' type.

But, if I set int.as.double = TRUE everything works fine.

The error seems to be dependent on the required time horizon, if I just query one year instead of 10 years of historic data and set start.date = Sys.Date()-365 instead of start.date = Sys.Date()-365*10 the function works fine with both, int.as.double = TRUE and int.as.double = FALSE.

However, for me the best solution is to set the default of int.as.double to TRUE.

Could you advise on this?

@johnlaing
Copy link
Contributor

Short answer: the int.as.double argument was added to solve exactly the problem you are experiencing. The best thing to do is set it to TRUE.

For more detail see #163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants