FXall Relationship Trading Customer Adapter Sample

This sample demonstrates the use of the TIBCO StreamBase® Adapter for FXall Relationship Trading Customer.

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

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

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_fxall

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/fxall

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.