FeedProc Sample

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.

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 java-src folder.

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

Running the FeedProc Sample Application

This sample is intended to be run in StreamBase Studio, and has no provision for running at the command line. Experienced Java developers can do so by adding the java-bin directory to the classpath.

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 Application Output 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 RunRun 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 WindowsPreferences.

  2. In the left side navigation column, open StreamBase StudioTest/Debug.

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

  4. Click OK.

Steps to Run in Studio

Follow these steps to run this sample in StreamBase Studio:

  1. In the Package Explorer, double-click to open the feedproc.sbapp application. Make sure the application is the currently active tab in the EventFlow Editor.

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

  3. 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.

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

  5. Watch the Application Output view in Studio and the FeedProc Sample window. The Application Output 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.

  6. When done, press F9 or click the Stop Running Application button. This closes both the StreamBase application and the FeedProc Sample dequeuer window.

Back to Top ^

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 this sample from the Applications list.

  • Click OK.

StreamBase Studio creates a project for the sample.

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.

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

streambase-install-dir/sample/errorstreams

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