Home : J-Integra for COM : Using J-Integra to Access Real-Time Data from Bloomberg®
Q183197 - HOWTO: Using J-Integra to Access Real-Time Data from Bloomberg®

Using J-Integra to Get Real-Time Data from Bloomberg®

The following example demonstrates how to access Bloomberg® real-time data from your Java application via J-Integra. Before running this example, make sure you have completed the configuration steps outlined in our documentation:

Accessing Bloomberg® from Java

Copy and paste the code below (and reference the Java proxies for Bloomberg®) to get started with the example

For a third-party solution leveraging J-Integra, please see Optura®'s Virtual Investment Analytics (VIA) automation platform. Additional information can also be found here.

import blpdatax.BlpData;
import blpdatax._BlpDataEventsAdapter;

public class RealTimeDataExample {
    // fire event types
    final static int ByField = 0;
    final static int ByRequest = 1;
    final static int BySecurity = 2;
    // list of securities we wish to monitor
    static Object[] security = {"MSFT US Equity", "IBM US Equity", "EUR Curncy", "CAD Curncy"};
    // security fields we wish to monitor
    static Object[] fields = {"Last_Price", "Bid", "Ask", "Volume", "High", "Low"};
    public static void main(String[] args) {
            //Uncomment this line if running J-Integra in native mode
            //i.e. Java and Bloomberg are running in the same machine
            //System.setProperty("JINTEGRA_NATIVE_MODE", "");
            // Uncomment this line if running J-Integra in DCOM mode
            // i.e. Java and Bloomberg are in different machines
            // DCOM authentication: Make sure NT Domain, NT User, NT Password are valid credentials.
            //com.linar.jintegra.AuthInfo.setDefault("NT DOMAIN", "NT USER", "NT PASSWORD");
            // Create the Bloomberg object
            // Specify host name or IP address of Bloomberg machine as parameter if
            // running in DCOM mode, e.g.:
            // BlpData blp = new BlpData("123.456.789.0");
            BlpData bloomberg = new BlpData();
            // set some configuration parameters
            // add data listener
            DataListener dataListener = new DataListener();
            // package the parameters
            Object[] params = { security, new Integer(0), fields, null, null, null, null };
            // call the subscribe method via late binding
            // this is a workaround since early binding does not work
            bloomberg.invokeMethodByName("subscribe", params);
            // flush out the data
            // let the program run indefinitely
            while (true) {
        } catch (Exception e) {
        } finally {
class DataListener extends _BlpDataEventsAdapter {
    // this event is called once the request is flushed out
    public void data (blpdatax._BlpDataEventsDataEvent theEvent) throws java.io.IOException, com.linar.jintegra.AutomationException {
        System.out.println("\n *** DATA EVENT CALLED *** " );
        // obtain which stock info changed
        Object[] securityArray = (Object[]) theEvent.getSecurity();
        System.out.println("Security: " + securityArray[0]);
        // display updated data
        Object[] dataArray = (Object[]) theEvent.getData();
        for(int i=0; i<dataArray.length; i++){
            System.out.println(RealTimeDataExample.fields[i] + ": " + dataArray[i]);
    public void status (blpdatax._BlpDataEventsStatusEvent theEvent) throws java.io.IOException, com.linar.jintegra.AutomationException {
        System.out.println("*** STATUS EVENT CALLED *** " );
Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?


Tell us why you rated the content this way. (optional)
Approved Comments...
No user comments available for this article.
Created on 7/11/2006.
Last Modified on 5/4/2010.
Last Modified by J-Integra KB Admin.
Article has been viewed 9931 times.
Rated 3 out of 10 based on 17 votes.
Print Article
Email Article