You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. It appears that it should now be possible to add BQL support to Rblpapi. The blp python library, which also relies on the C++ API, has managed to do so. Here's the specific commit: matthewgilbert/blp@700c280
I can confirm that it works in the Python library. I don't know how hard it would be, but it doesn't seem particularly complex. (I'm sadly not knowledgeable enough to propose a fix to Rblpapi myself.)
Thank you developers for sharing your code, it's been very helpful.
I had some change to look at this - following is a short summary:
While it looks not overly complicated to retrieve data from Bloomberg by copying and slightly modifying exisiting C++ code in functions bds_impl and bdh_impl, the data are in the form of a rather long and complex string in json format.
The result of this function is a list of data.frames (one list element per entry/field in "get") where each entry in each data.frame is a string:
$`px_last()`
ID VALUE DATE CURRENCY
1 AZUL4 BZ Equity 5.39 2024-08-31T00:00:00Z BRL
Those strings would have to be converted to the correct format (as specified in the json in field type, e.g. STRING, DOUBLE, DATE).
From my point of view, this looks like a rather complex parsing tasks probably requiring additional dependencies - and there might probably be some edge cases to be considered and tested, given the variety of BQL-statements which could be used.
Reacted by Dirk Eddelbuettel, vitordfachetti and kathuriarajat
The additional dependencies are not that much of a concern, really. jsonlite is widely used so most users have. RcppSimdJson is performant if that mattered. Either one is fine, I used RcppSimdJson elsewhere too and it work. And if one really wanted to one could also 'vendor in' the well-known and widely used nlohmann header-only C++ library.
What may be a little trickier is to 'guess' or 'infer' the resulting format when the bql() query can be free-form. Is there any guidance in the documentation?
@mtkerbeR could I ask you for a different favour though? I posted to the r-sig-finance list yesterday asking for help in testing a new build of Rblpapi. Would you be able to install from the branch (calling the other branch) and then assert that everything still works?
Activity
eddelbuettel commentedon Feb 5, 2024
I think we might have to rely on community contributions here.
mtkerbeR commentedon Aug 31, 2024
I had some change to look at this - following is a short summary:
While it looks not overly complicated to retrieve data from Bloomberg by copying and slightly modifying exisiting C++ code in functions
bds_implandbdh_impl, the data are in the form of a rather long and complex string in json format.In the simplest example:
bql("get( px_last() ) for( 'AZUL4 BZ Equity' )")this json-string can be reduced to essentially:
In a next step, one probably needs to save/parse the data, using e.g. some R-code/package like
RcppSimdJson(or alternatively, some C++ code):The result of this function is a list of data.frames (one list element per entry/field in "get") where each entry in each data.frame is a string:
Those strings would have to be converted to the correct format (as specified in the json in field type, e.g. STRING, DOUBLE, DATE).
From my point of view, this looks like a rather complex parsing tasks probably requiring additional dependencies - and there might probably be some edge cases to be considered and tested, given the variety of BQL-statements which could be used.
eddelbuettel commentedon Aug 31, 2024
The additional dependencies are not that much of a concern, really.
jsonliteis widely used so most users have.RcppSimdJsonis performant if that mattered. Either one is fine, I usedRcppSimdJsonelsewhere too and it work. And if one really wanted to one could also 'vendor in' the well-known and widely used nlohmann header-only C++ library.What may be a little trickier is to 'guess' or 'infer' the resulting format when the
bql()query can be free-form. Is there any guidance in the documentation?eddelbuettel commentedon Aug 31, 2024
@mtkerbeR could I ask you for a different favour though? I posted to the r-sig-finance list yesterday asking for help in testing a new build of
Rblpapi. Would you be able to install from the branch (calling the other branch) and then assert that everything still works?mtkerbeR commentedon Aug 31, 2024
@eddelbuettel
regarding testing the new build:
Sure - I will try and revert, probably tomorrow.
Add bql() for Bloomberg Query Language queries via //blp/bqlsvc
Add bql() for Bloomberg Query Language queries via //blp/bqlsvc
Add bql() for Bloomberg Query Language queries via //blp/bqlsvc