FXall Relationship Trading Adapter Sample

This sample demonstrates the use of the StreamBase FXall Relationship Trading adapter.

Importing This Sample into StreamBase Studio

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

  • From the top menu, click FileLoad StreamBase Sample.

  • Select this sample from the Embedded Input Adapters list.

  • Click OK.

StreamBase Studio creates a project for this sample.

Sample Location

By default, the sample files are installed in:

On Windows

C:\Program Files\StreamBase Systems\StreamBase.n.m\sample\adapter\embedded\fxall\

On UNIX

/opt/streambase/sample/adapter/embedded/fxall/

When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace. StreamBase Systems recommends that you use the workspace copy of the sample, especially on UNIX, where you may not have write access to /opt/streambase. In the default installation, the path to this sample in your Studio workspace is:

UNIX:       
   ~/streambase-studio-n.m-workspace/sample_adapter_embedded_fxall
Windows XP:
   C:\Documents and Settings\username\My Documents\StreamBase Studio n.m Workspace\
      sample_embedded_fxall
Windows Vista:
   C:\Users\username\Documents\StreamBase Studio n.m Workspace\
      sample_embedded_fxall

Running This Sample in StreamBase Studio

  1. In the Package Explorer, double-click fxall.sbapp.

  2. Select the Parameters tab.

  3. Enter site-specific values for your FXall host (typically an HTTPS URI), username, and password. Enter the absolute path of the directory containing your FXall keystore files.

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

  5. In the Test/Debug Perspective, open the Application Output view. If connectivity is configured correctly, look for tuples emitted on the Status streams indicating a connection has been opened to your FXall server.

  6. In the Manual Input view, select the QueryRequest stream, enter a value in the Tag field, and click Send Data. A tuple is emitted on the QueryResponse stream containing information retrieved from the FXall server, including the set of valid accounts, providers, currencies, tenors.

  7. Select the SubmitDeal stream, enter values in the following required fields, and click Send Data. Missing or invalid input will result in a tuple from the FXallOutputStatus stream describing the invalid input.

    • UserId (note: the sample application appends a sequence number to the UserId to ensure its uniqueness)

    • TwoWay

    • Providers (enter at least one)

    • Order.InstrumentOrders (create at least one)

    • Order.InstrumentOrder.Type

    • Order.InstrumentOrder.BaseCurrency

    • Order.InstrumentOrder.TermsCurrency

    • Order.InstrumentOrder.DealtCurrency

    • Order.InstrumentOrder.Legs (one required for SPOT deals)

    • Order.InstrumentOrder.Leg.ValueDateType

    • Order.InstrumentOrder.Leg.Requirements (create at least one)

    • Order.InstrumentOrder.Leg.Requirement.TakerBuysBase (required for one-way deals)

    • Order.InstrumentOrderLeg.Requirement.Account

    • Order.InstrumentOrderLeg.Requirement.DealAmount

  8. Assuming a valid deal was entered, one or more tuples are emitted on the FXallEvents stream indicating the deal was submitted successfully (EventType=SubmitOk) and, possibly, that the deal was picked up by one or more providers (EventType=DealPickup), which start providing quotes (EventType=NewPrice).

  9. Select the AcceptDeal stream, enter in the QuoteId field the corresponding value from one of the NewPrice tuples, enter true or false in the TakerBuysBaseField (if the corresponding field had not been set when submitting the deal), and click Send Data.

  10. Assuming the deal is accepted, a deal logged tuple (EventType=DealLogged) is emitted on the FXallEvents stream.

  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.

Note

Because of the complexity of the input and output schemas used by this adapter, it is not practical to submit deals from terminal windows.

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

  2. In window 1, type:

    sbd fxall.sbapp

  3. In window 2, type:

    sbc dequeue -v

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

  4. In window 3, issue a query request :

    echo MyTag,null,null,null,null,null,null,null,null,null,null | sbc enqueue QueryRequest

  5. Observe in windows 2 a tuple emitted from the QueryResponse stream.

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

    sbadmin shutdown