Clear Filters
Clear Filters

Why is Bloomberg API working slower when adding "blpapi3.jar" as a dynamic library instead of static library?

4 views (last 30 days)
I am using the Datafeed Toolbox and I am executing "blp/history" function and requesting a lot of data.
When I use "blp/history" with a dynamic path, it may take hours to complete running. However, with a static path, it is much faster and it can be done in about 20 minutes or so.
Why does "blp/history" perform so much slower when I use the dynamic path rather than the static path?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 9 May 2022
Edited: MathWorks Support Team on 9 May 2022
The function "blp/history" has two possible code paths depending on how "blpapi3.jar" is added to the classpath.
If "blpapi3.jar" is added:
- statically, then MATLAB is able to use code in "datafeed.jar" that parses the event messages at the Java level and then passes a Java vector back to MATLAB. There is only one MATLAB/Java boundary crossing in this case and it is much faster.
- dynamically, then MATLAB is not able to resolve what it needs at a startup making the code in "datafeed.jar", that relies on "blpapi3.jar", inaccessible. In this case, "blp/history" falls back to using the MATLAB code path, which makes the Java calls directly from the MATLAB Workspace and there are many MATLAB/Java boundary crossings needed to parse the event messages. Thus, this implementation is much slower.
Add "blpapi.jar" to the static Java path rather than the dynamic path. That is, define a "javaclasspath.txt" rather than using "javaaddpath" - this will give you the best performance. See the section "Add Jar File Classes" in the MATLAB documentation page about the static Java classpath:
Additionally, if Bloomberg API is still slow after adding it to the static path, try downloading the 'blpapi3.jar' from Bloomberg again and replace it in your current installation.

    More Answers (0)




    Community Treasure Hunt

    Find the treasures in MATLAB Central and discover how the community can help you!

    Start Hunting!