This sample demonstrates the use of the Spotfire Streaming Input and Output Adapters for FIX. See FIX Adapter for details on the structure and use of these adapters.
This sample uses four FIX adapters (two Input-Output pairs) to simulate two separate counterparties communicating using the
FIX protocol. The application uses one FIX Input adapter (
FIXInput_1) and one FIX Output adapter (
FIXOutput_1), linked to share their FIX connection, to act as the connection initiator. The second FIX adapter pair (FIXInput_2 and FIXOutput_2)
acts as the connection acceptor.
In a typical StreamBase application, both FIX counterparties would not be running in the same process as they do in this sample. A more likely scenario would have one or more FIX adapters connected to FIX venues outside your company. However, for the purpose of this sample, keeping everything in one application improves clarity and ease of use.
In the sample application, the
FIXOutput_1 adapter periodically sends a
New Order Single (MsgType="D") FIX message to the FIX target,
FIXInput_2. On receiving this message, the target routes it to the appropriate output port based on the settings in its Message Routing
Map. In this case, messages of MsgType g are routed to port 2.
While this message is valid from a FIX protocol standpoint (that is, all required fields are set), it is not necessarily complete. This message is meant to demonstrate how to send messages and how to route them to specific ports on the receiving side.
When the New Order Single message is received, an Execution Report (MsgType="8") message is generated and sent back to FIXInput_1.
The sample application is configured to be run using the QuickFIX/J FIX engine, but you can easily use the StreamBaseFIX FIX engine to run it instead (provided you have the appropriate license to do so). To change the application to use this engine, follow these steps:
fix.sbappin StreamBase Studio.
Click on the FIX Output Adapter named
FIXOutput_1in the EventFlow editor.
In the StreamBase Properties view's Adapter Properties tab, in the FIX Engine drop-down control, select the StreamBaseFIX engine.
In the FIX Configuration File control, select
Make the same changes for the FIX Output Adapter named
FIXOutput_2, this time selecting
StreamBaseFIX-config-2.xmlas the FIX Configuration File.
fix.sbappfile before running.
In StreamBase Studio, import this sample with the following steps:
From the top-level menu, select> .
fixto narrow the list of options.
Select FIX adapter from the StreamBase Trade Execution Adapters category.
StreamBase Studio creates a project for this sample.
In the Project Explorer view, open the sample you just loaded.
If you see red marks on a project folder, wait a moment for the project to load its features.
If the red marks do not resolve themselves after a minute, select the project, right-click, and select> from the context menu.
fix.sbappfile and click the Run button. This opens the SB Test/Debug perspective and starts the module.
In the SB Test/Debug Perspective, open the Output Streams view.
Look for tuples emitted on the
AdminMsgFromFIXAdapter_2streams to indicate that Logon messages (MsgType=A) are exchanged.
Also look for tuples being emitted every five seconds on the NOSMsgFromFixOutput_1 stream, indicating that FIX messages of type D are sent from FIXOutput_1 to FIXInput_2. The messages are routed to that port instead of the first port because the FIXInput_2 adapter is configured to route all application level messages of type D to the second port (and all others to port 1.)
Once a New Order Single message has been generated, look for an Execution Report (MsgType='8') response to be sent back from FIXOutput_2. You will see this message being received by the
In the Manual Input view, select the Commands stream. Enter the following values and click:
Observe the Logout and Logon messages in each adapter's admin-level message stream, signifying that the connection is being reset.
When done, press F9 or click the Terminate EventFlow Fragment button.
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.
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:
See Default Installation Directories for the default location of
studio-workspace on your system.