How can I get the emulator to work with my code?

Feb 19, 2013 at 1:37 PM
First of all, thank you! Bloomberg not having an emulator already is crazy! I'm trying to get the emulator working against my code. In the install, I only see a BEmuInstaller directory with a dll and an Examples.exe which sends random requests.

I have a project running in eclipse which tries to connect to Bloomberg in the typical way:
        SessionOptions sessionOptions = new SessionOptions();
        this.session = new Session(sessionOptions);
        if (!this.session.start()) {
            logError("Failed to start session.");
How can I get this to connect to your emulator? What do I need to be running?
Feb 20, 2013 at 9:06 PM
You're welcome! Did you get this code from the Bloomberg Documentation? If so, did you pull it from a C++ example? I think you posted C++ code. BEmu is a .Net project only right now. I see now that I didn't make that clear in the homepage. I will edit that. The .Net code does not have a setServerHost(string) function for instance. It has a ServerHost property setter that accepts a string.

The DLL supports .Net code, so the C# version of what you pasted above is:

SessionOptions sessionOptions = new SessionOptions();
sessionOptions.ServerHost = "";
sessionOptions.ServerPort = 8194;

Session session = new Session(sessionOptions);

I am not familiar with Eclipse, but make sure that your project references the BEmu.dll file. Eventually when you have a Bloomberg account, replace that BEmu.dll reference with a reference to Bloomberglp.Blpapi.dll.
Feb 20, 2013 at 10:17 PM
Sorry, I should have mentioned that my project was created using Java API, the code I posted came from the Bloomberg API doc.

Usually I would just include a reference to a jar file which contains the resources I need, like blpaip-version.jar which I could replace with your emulator.

Do you have any plans on expanding it to Java?

Thank you!
Feb 21, 2013 at 1:44 AM
I am working on adding features to the emulator. Right now I'm working on IntradayTickRequests in fact. My priority is to add features like that because I have a Bloomberg account. If for whatever reason I no longer have an account, I'll start porting my code to other languages. I don't need an account to do that. My Java is really rusty though :)

Hopefully you can still find a way to leverage the emulator. Maybe you can write your code in C# and then translate that to Java. I find that the code I write to make Bloomberg API requests is generally short (and thus probably easy to translate). Though short, it's not straightforward to write.
Feb 21, 2013 at 2:12 PM
Fair enough. I do have a Bloomberg account and I have written extensive code using it, however I love the idea of the emulator because I can do performance tests with tons of data without having to worry about my data limits.

I think there may be a way to use your dll with Java using JNI, but that is new territory for me so I will need to dedicate some time to figuring it out. If I can figure it out I will post back here in case anyone else is in my boat.
May 5, 2013 at 4:57 PM

I've begun porting my code to Java. Right now my Java code supports Intraday Tick Requests and Intraday Bar Requests. I'm learning Java as I go, but code that you'd write works for both my emulator and the actual API. I hope that you will find this useful.