getting started with blp api and emulator

Apr 4 at 11:26 AM
Edited Apr 4 at 4:05 PM
Hello,
I have to write a program to extract data from bloomberg.
I'm a beginner for both bloomberg environment and also its API.
I've just installed Python on my pc, and also your emulator.

Is it enough or I need something else?

My question is due to the fact that an example of python code, taken from _"https://www.bloomberglabs.com/api/libraries/"_, starts with:
import blpapi
import copy
import datetime
from optparse import OptionParser, Option, OptionValueError
where can I find them?

thanks a lot
:(
michele
Coordinator
Apr 4 at 9:09 PM
Michele,

I haven't written a Python version of the emulator. I've only supported .Net languages (e.g., C#), Java, and C++. Bloomberg supports those three as well as Python and Perl https://www.bloomberglabs.com/api/libraries/

You might be able to find some way to call C#, Java, or C++ code from Python. I have no idea as I have no experience with Python.

-Jordan
Apr 5 at 7:21 AM
Edited Apr 5 at 10:59 AM
Thank you Jordan

I would like to use your emulator so I can follow the way C++ (I know C, guess I can try and learn C++)

so, considering C++, may you please give me the steps to start?

thanks again for your support and patient..
michele.
Apr 5 at 10:58 AM
Edited Apr 6 at 7:59 AM
I guess I have to follow some step like these:

1st: Install VC++ 2010 Express : http://filehippo.com/download_visualc_2010_express_edition

2nd: download Bloomberg C++ SDK https://bloomberg.bintray.com/BLPAPI-Stable-Generic/blpapi_cpp_3.8.18.1-windows.zip and unzip it to somewhere like C:\BLPAPI\CPP. Then include the Bloomberg C++ SDK (C:\BLPAPI\CPP\BIN) into the "PATH" environment variable.

3th: Set the BLPAPI_ROOT system environment variable to C:\BLPAPI\CPP (This PC, Properties, Advanced System Settings, Advanced, Environment Variables, System Variables, New)

4rd: install C++ environment (I think I can use VS express 2010, right?)

5th: download and install BEmuInstaller.msi. Is it needed to be launched in some way?


Is it right?

do I have to perform something else?

thanks a lot, bye
michele
Apr 6 at 8:13 AM
Edited Apr 6 at 1:19 PM
Hello Jordan,
it's me again :-D

I decided to develope my project in C++ (visual studio express 2010)

I downloaded your emulator, installed it, and then launched an example (SecurityLookupExample_32.exe), taken from the Bloomberg C++ SDK, but I got this error

Do you know what I'm doing wrong?
>>> Connecting to localhost:8194

06APR2017_10:08:08.109 41144:42620 ERROR blpapi_platformtransporttcp.cpp:671 blpapi.session.transporttcp.{1}.<localhost:8194> Connection failed

06APR2017_10:08:08.109 41144:42620 WARN blpapi_platformcontroller.cpp:371 blpapi.session.platformcontroller.{1} Platform: 0 failed 1 consecutive connect attempts, stopped trying to reconnect.
>>> Failed to start session
Press ENTER to quit
I imagined that the emulator "answer" instead of real bloomberg, it isn't so?

many thanks for your help
michele
Coordinator
Apr 6 at 8:27 PM
Michele,

Since you're going to use the C++ version, I suggest you try to run the example C++ code I included. Here's the main.cpp file https://bemu.codeplex.com/SourceControl/latest#Examples_cpp/src/main.cpp

Once you have that running, play around with the code in the Examples_cpp/src/*.cpp files. That'll give you an idea of how to use the code.
Apr 7 at 7:32 AM
Hi Jordan and thank you for your help

I will surely proceed as you suggested

Only a couple of confirmations:

the 5 steps I listed above are correct?

Is it needed the emulator to be launched in some way or is it enough the simple installation?

PS: I see that this website will be closed: may you please give me the link for the new one (the section where there is the blp api emulator... :-D )
Coordinator
Apr 7 at 3:11 PM
Michele,

Your steps are not right. You don't need to download anything from Bloomberg to use my project. The steps aren't anymore complicated than (1) download the C++ source code, (2) build it, (3) run it. You don't need to install anything.

Do you have a colleague who is more familiar with running C++ projects? Or C# or Java projects? They can help you get started.
Apr 10 at 7:49 AM
Yes Jordan, you are absolutely right
I wrongly realized that your emulator answered to the requests of the C++ code instead of real bloomberg

Now I guess I understand

When I asked you the correctness of the steps, I only meant that, after having tested my C++ code with your emulator, I should transfer it to real environment installing VC++ and all the things I will need.

Unfortunately I have no choice to ask anyone about C++, C#, Java
I can only base on my C language knowledge...

thanks a lot for everything and for all your helpful support!
michele
Apr 10 at 10:14 AM
Edited Apr 12 at 1:34 PM
uhmmm...when I'm convinced to have been arrived to a good point, some new error appears...

I have now replied your solution, even if I have express instead of professional version of visual studio

I guess I'm quite near to the end, maybe

when I build the solution, only concerning the project examples_cpp (no problem for bemu_cpp), I get this error:
2>MarketDataRequest.obj : error LNK2019: unresolved external symbol "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall BEmu::Element::print(class std::basic_ostream<char,struct std::char_traits<char> > &,int,int)const " (?print@Element@BEmu@@QBEAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV34@HH@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl BEmu::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class BEmu::Element const &)" (??6BEmu@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABVElement@0@@Z)
I guess I find the definition of BEmu::Element into "BEmu_cpp\src\BloombergTypes\Element.cpp"

I tried several ways but I'm not able to tell the system to read that file...

may you please help me to solve this last (hope) step?

thanks, bye
michele
Apr 13 at 3:24 PM
ok, done

After many troubles I realized that in the "common properties" of the project "Examples_cpp" there was to add the reference to BEmu_cpp

once done, it runs very well!

thanks a lot for your support

michele