BM&FBOVESPA UMDF Input Adapter Sample

This sample demonstrates the use of the TIBCO StreamBase® Adapter for BM&FBovespa UMDF. See BM&FBovespa UMDF Input Adapter for details on the use and structure of this adapter.

About This Sample

This sample use one instance of the UMDF Input Adapter to connect to the BM&FBOVESPA UMDF market feed and provide market data. In order to run this sample, you must have access to one of BM&FBOVESPA's UMDF feeds for the adapter to use.

Once the application has started, you can use the adapter to subscribe to one or more instruments to obtain instrument definition, initial snapshot, incremental updates and other FAST messages for those instruments as they are issued by the market feed.

Running This Sample in StreamBase Studio

  1. In the Package Explorer, double-click to open the sample application, umdf.sbapp.

  2. Edit the channelDefinitions.xml file to input the proper IP addresses and ports supplied to your company by BM&FBOVESPA to access the UMDF data feeds. See BM&FBovespa UMDF Input Adapter for details on editing this file.

  3. Be sure to obtain an up-to-date version of the UMDF FAST templates definition file (called templates-UMDF.xml in the sample) from BM&FBOVESPA and place it in the sample's top-level directory. Make sure the adapter's FAST Template File property points to this file.

  4. Click the Run button. This opens the SB Test/Debug perspective and starts the application.

  5. In the Manual Input view, select the Subscriptions stream. Enter the following values and click Send Data:

    • Command: Subscribe

    • ChannelID: MyChannel

    • SymbolID: SomeSymbol

    where MyChannel is the value specified in the channelDefinitions.xml file's <channel id="MyChannel"> attribute, and MySymbol is the name of a valid instrument handled by this UMDF feed.

  6. After you have sent the command, the adapter connects to the configured Instrument Definition stream and obtains the definition for the specified symbol. Once received, the adapter issues a tuple on the InstrumentDefinitions output port that contains the contents of the received FAST message.

    Note

    This step happens only the first time you subscribe to this symbol in the lifetime of the application. If you later unsubscribe and resubscribe, this tuple is not generated.

  7. The adapter next sends a tuple on the Events port to indicate the subscription to the symbol has succeeded.

  8. The adapter connects to the configured UMDF Recovery stream to obtain the current state of the book for this instrument. Once the snapshot is obtained, a tuple is emitted on the Snapshots output port with the information.

  9. At this point the adapter starts emitting tuples on the IncrementalRefreshes port as updates become available.

  10. You can also periodically observe messages of type News and others being generated on the OtherMessages port as they are received.

  11. When done, press F9 or click the Stop Running Application button.

Running This Sample in Terminal Windows

This section describes how to run the sample in UNIX terminal windows or Windows command prompt windows. On Windows, be sure to use the StreamBase Command Prompt from the Start menu as described in the Test/Debug Guide, not the default command prompt.

  1. Open three terminal windows on UNIX, or three StreamBase Command Prompts on Windows. In each window, navigate to the directory where the sample is installed, or to your workspace copy of the sample, as described above.

  2. Make sure you have properly edited the channelDefinitions.xml file and obtained a fresh copy of templates-UMDF.xml as described in steps 2 and 3 in the previous section.

  3. In window 1, type:

    sbd umdf.sbapp
    
  4. In window 2, type:

    sbc dequeue -v
    

    This window will display tuples dequeued from the adapter's output ports.

  5. In window 3, type:

    echo MyChannel,Subscribe,MySymbol | sbc enqueue Subscriptions
    

    Take care to replace MyChannel and MySymbol as described in the previous section's step 5.

  6. Observe in window 2 that tuples are emitted from the InstrumentDefinitions, Events, Snapshots and IncrementalRefreshes streams, successively.

  7. In window 3, type the following command to terminate the server and dequeuer:

    sbadmin shutdown
    

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top menu, select FileLoad StreamBase Sample.

  • Select UMDF Input adapter from the StreamBase Market Data Adapters category.

  • Click OK.

StreamBase Studio creates a single project containing the sample files.

Sample Location

When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.

Important

Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.

Using the workspace copy of the sample avoids the permission problems that can occur when trying to work with the initially installed location of the sample. The default workspace location for this sample is:

studio-workspace/sample_adapter_embedded_umdf

See Default Installation Directories for the location of studio-workspace on your system.

In the default TIBCO StreamBase installation, this sample's files are initially installed in:

streambase-install-dir/sample/adapter/embedded/umdf

See Default Installation Directories for the location of streambase-install-dir on your system. This location may require administrator privileges for write access, depending on your platform.