FeedProc Sample

Introduction

This sample demonstrates a StreamBase application, feedproc.sbapp, that processes financial tick data from three financial feeds. The application determines the fastest of the three feeds, computes useful statistics for each feed, and calculates the VWAP for the incoming tick data. A simple client user interface is provided to illustrate the output of the StreamBase application. This application and user interface are geared toward a system administrator monitoring financial feeds.

The goal of the FeedProc application is twofold:

  1. To output groomed trade data as soon as it arrives on any feed

  2. To create useful feed performance data

The application enqueues market data on three streams. Each stream represents a market feed reporting the same trade tick data. Trades are recorded and passed on to the trader if the trade arrived first for a given tick. As each trade is processed, feed performance data is extrapolated, such as the delay with respect to the first incoming trade of each tick.

This sample includes a sample Java dequeuer program that runs in a separate window with its own user interface. This program provides a slider that lets you determine which trades are considered outliers, based on how many standard deviations from the mean a price lies. You can set the value for the SIGMA threshold at which trades are dropped. Therefore, any trades where the price difference from the mean is greater than (SIGMA standard deviations away) is to be counted as outliers and not shown in the Trader View portion of the dequeuer's user interface. Try running the application several times, and notice that if the SIGMA is set sufficiently low (to 1,for example), then many trades are filtered out. The distance from the mean of non-outliers is shown in the sigma column of the Trader View grid. For further information, refer to the descriptions in the operators that comprise feedproc.sbapp.

Note

The Java code in this sample is delivered only in source code form. To build the code, you must load the sample into StreamBase Studio, which automatically builds the Java code.

Importing This Sample into StreamBase Studio

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

  • From the top-level menu, select File>Import Samples and Community Content.

  • Enter feedp to narrow the list of options.

  • Select Processing multiple financial feeds from the Applications category.

  • Click Import Now.

StreamBase Studio creates a project for the sample.

Introduction and Setup

When you load this sample in Studio, the sample places a launcher for the Java dequeuer sample program into Studio's Run History list. The overall procedure is:

  • Run the StreamBase application, feedproc.sbapp, in Studio. The StreamBase application accepts input from the Manual Input or Feed Simulations view, and shows output in the Output Streams view, as normal.

  • Use the launcher in the Run History list to run the FeedProcGUI Java client program at the same time the StreamBase application is running. This opens a new window for FeedProcGUI.

  • Back in Studio, run a feed simulation file.

  • Watch the results in the FeedProcGUI user interface and make adjustments there as the feed simulation runs.

Run the Java client launcher from the Run History list using one of the following methods:

  • From the Studio top-level menu, invoke Run>Run History, and select the specified launcher from the list.

  • Open the Run Configurations dialog, select the specified launcher from the Java application category, then click Run.

  • Click the down-arrow next to the Run button in the Studio toolbar, and select the specified launcher from the list.

The Java client launcher placed in the Run History list presumes that Studio is running the StreamBase application on port 10000, which is the installed default port for StreamBase application launches. Before you proceed, use these steps to confirm that port 10000 is the default launch port:

  1. Open Run>Run Configurations.

  2. In the left side column, make sure feedproc is selected under EventFlow Fragment.

  3. Confirm that the StreamBase engine Configuration or Default Port setting is 10000. If not, change it to 10000.

  4. Click Apply and Close.

Running This Sample in StreamBase Studio

Follow these steps to run this sample in StreamBase Studio:

  1. In the Project Explorer view, open this sample's folder.

    Keep an eye on the bottom right status bar of the Studio window. Make sure any Updating, Downloading, Building, or Rebuild project messages finish before you proceed.

  2. Open the src/main/eventflow/packageName folder.

  3. Double-click to open the feedproc.sbapp module. Make sure the module is the currently active tab in the EventFlow Editor.

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

  5. Wait for the Waiting for fragment to initialize message to clear.

  6. Open the Run History list as described in Introduction and Setup, and select the FeedProcGUI launcher. This runs the FeedProc.java program, which opens a separate window with title FeedProc Sample, and connects to the StreamBase Server instance running feedproc.sbapp.

  7. In the Feed Simulations view, select the feedproc.sbfs feed simulation, and click Run.

  8. Watch the Output Streams view in Studio and the FeedProc Sample window. The Output Streams view shows the raw data from the feed simulation passing into the running application. The FeedProc Sample window shows an example of a Trader View and an IT View of the processed data.

  9. When done, press F9 or click the Terminate EventFlow Fragment button. This closes both the StreamBase application and the FeedProc Sample dequeuer window.

This Sample's Files

The FeedProc sample includes:

  • The application, feedproc.sbapp.

  • A sample Java dequeuer program, FeedProc.java, to view the application's output. This program runs as a separate Java application with its own user interface, independent of Studio.

  • A feed simulation configuration file, feedproc.sbfs.

  • Three CSV files representing real-time feed data, used by the feed simulation.

  • Java source code for the dequeuer program, in the src/main/java src/main/java/packageName folder.

  • FeedProcGUI.launch, a Studio launcher file. The presence of this file places the FeedProcGUI entry into Studio's Run History list.

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 permission problems. The default workspace location for this sample is:

studio-workspace/sample_errorstreams

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