Deutsche Bank Autobahn FX Trading System Adapter

Introduction

The TIBCO StreamBase® Adapter for Deutsche Bank Autobahn FX allows a StreamBase application to retrieve market data from, and submit trade requests to, a Deutsche Bank Autobahn FX trading system. The adapter appears as two icons on the EventFlow canvas in StreamBase Studio — one for market data and a second for trades. The two icons share a single Autobahn FX server connection, which is configured through the market data adapter. The EventFlow canvas icons for this adapter are:

  • Market Data — Retrieves spot, forward, and swap quotes.

  • Trades — Submits trade requests on quotes received from the market data adapter.

Each adapter icon has its own set of input and output ports, the fields for which are defined later in this document. Properties are shared by the two adapters and entered through the market data adapter's property view. A single global ID entered in both adapters' properties views binds the adapters.

The market data input adapter icon has two input ports for submitting subscription requests and quote ladders and four output ports for receiving status events, quotes, IDs associated with successful subscriptions, and notification that subscriptions have ended.

The trades output adapter icon has one input port for submitting trade requests and two output ports for receiving status events and trade responses.

Notes

StreamBase does not license or distribute Deutsche Bank Autobahn FX libraries. These must be obtained from Deutsche Bank and installed prior to running the adapter. The Deutsche Bank Autobahn adapter will typecheck without the Autobahn FX API libraries being available, but the adapter will not run until the API libraries are properly loaded.

Installing the Deutsche Bank Autobahn FX API libraries

You must obtain the Deutsche Bank Autobahn FX Java libraries, version prod-11-2-5 or above, directly from Deutsche Bank. The easiest way to make the Autobahn FX API accessible to StreamBase is to copy all the Autobahn FX API JARs into the StreamBase installation in the lib/ext directory. The Deutsche Bank Autobahn FX API is composed of more than 20 JAR files.

If copying the JAR file to lib/ext is impractical, then for running Deutsche Bank adapter applications in StreamBase Studio, you must add all the Autobahn FX API JARs to the Java Build Path. For running Deutsche Bank adapter applications from the command line, you must add the Autobahn FX API JARs to the server's CLASSPATH, either by setting an environment variable, or via the <java-vm> element of the server configuration file as described below.

Running Applications With The Deutsche Bank Autobahn FX Adapter

Running From StreamBase Studio

To run a StreamBase application containing a Deutsche Bank Autobahn FX Adapter from StreamBase Studio, ensure that the following configuration step has been taken:

  • Add all the Deutsche Bank Autobahn FX jars to your project's list of referenced libraries. In StreamBase Studio's Project Explorer view, right-click your project's top-level folder and select Build Path>Add External Archives from the context menu. Select the appropriate JAR files from the file dialog.

Running From The Command Line

To run a StreamBase application containing a Deutsche Bank Autobahn FX Adapter from the command line, ensure that the following configuration step has been taken:

  • In the server configuration file (usually, sbengine.conf), add a <java-vm/jar> element for each of your Autobahn FX JAR files, or add a <java-vm/dir> element that specifies the directory containing these JAR files.

    On Windows:

    <java-vm>
      <jar file="c:/my_db/lib/deutsche-autobahnfx-api.jar"/>
      <jar file="c:/my_db/lib/deutsche-autobahnfx-cache.jar"/>
    ...
    

    or:

    <java-vm>
      <dir path="c:/my_db/lib/"/>
    ...
    

    On Linux

    <java-vm>
      <jar file="/opt/db/lib/deutsche-autobahnfx-api.jar"/>
      <jar file="/opt/db/lib/deutsche-autobahnfx-cache.jar"/>
    ...
    

    or:

    <java-vm>
      <dir path="/opt/db/lib/"/>
    ...
    

Properties

With the exception of the global ID, all adapter properties entered in the Market Data adapter's Properties view apply to both the market data and trade adapters. The global ID for the trade adapter must be specified independently in its Properties view.

Property Description
Autobahn FX Properties File The name of the file containing Autobahn FX API properties. See the Autobahn FX properties file shipped with the adapter sample, FxApi.properties, for the format and content of this file.
Initial Subscriptions File The name of the file containing subscription requests processed when the StreamBase application starts. See the initial subscription file shipped with the adapter sample, InitialSubscriptions.txt, for the format and content of this file.
Worker Thread Count The number of worker threads that will process incoming Quotes.
Default Tradable Amount The amount used to retrieve the quote when quote rungs are unavailable for a particular currency pair.
Quote Cache Size The maximum number of elements to keep in the quote cache, which contains quotes available for trading.
Quote Timeout The time, in seconds, a quote remains in the cache and available for trading.
Reconnect Interval The number of seconds to wait between attempts to (re)connect to the Autobahn FX server.
Global ID The global identifier for this adapter instance.
Log Level Controls the level of verbosity the adapter uses to send notifications to the console. This setting can be higher than the containing application's log level. If set lower, the system log level is used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE.
Include Latency Data Controls whether or not two optional latency measurement fields (QuoteArrivalTime and QuoteHandoffTime) are included in Quotes output tuples. Both fields are of type long and contain nanosecond timestamps.

Using the Adapter in a StreamBase Application

This section demonstrates how to use the Autobahn FX adapter in a StreamBase application. As shown in the EventFlow excerpts below (taken from the adapter's sample application), the adapter appears as two icons on the canvas: one for Market Data and one for Trades. See the sample application for the full context of these examples.

Each adapter has a specific set of input and output ports to communicate with the surrounding application. As with other StreamBase adapters and operators, you can optionally enable an Error Output Port, as described in Using Error Ports and Error Streams.

Adding the Adapter to an EventFlow Application

Add an instance of the adapter to a new StreamBase EventFlow application as follows:

  1. In StreamBase Studio, create a project, including an empty StreamBase EventFlow application file to host the adapter.

  2. From the Operators and Adapter drawer of the Palette view, drag a Deutsche Bank Market Data component to the canvas.

  3. From the Operators and Adapter drawer, drag a Deutsche Bank Trade component to the canvas.

  4. Import the template Autobahn FX properties file, FxApi.properties, from the sample application shipped with this adapter. To use the new EventFlow application with a simulated Autobahn FX server (recommended for initial testing), leave this file unchanged. Otherwise, make changes necessary to match the configuration at your site, including providing account credentials, a server ID, a realm URL, and keystore information.

  5. Select the Editor tab at the bottom of the EventFlow editor.

  6. Double-click the Deutsche Bank Market Data adapter icon, and in the Properties view, select the Adapter Settings tab.

  7. Select the Autobahn FX properties file imported above.

  8. Enter a Global ID used to bind the Market Data and Trade adapters.

  9. The remaining Market Data adapter properties are optional and may be left with their default values.

  10. Double-click the Deutsche Bank Trade adapter icon, and in the Properties view, select the Adapter Settings tab.

  11. Enter the same Global ID as used for the market data adapter above.

  12. Connect Input and Output Streams to the adapters' input and output ports.

  13. Configure the schemas of the input streams with the fields listed in the sections above describing market data and trade adapter input ports. Note that the adapter will generate typecheck errors when the input streams are missing required fields, when unexpected fields are present, or when fields are of the wrong type.

Description of This Adapter's Ports

Autobahn FX Market Data Adapter Ports

The Autobahn FX input adapter retrieves market data from the Autobahn FX server. It has two input ports and four output ports:

  • Subscriptions (input): This port is used to make subscription requests, beyond those in the initial file, as well as to unsubscribe from existing subscriptions, created both through the initial subscription file and this port. It can also be used to manually connect or disconnect from a venue. When the user manually disconnects from the venue, automatic reconnection is disabled until they explicitly connect again via this port.

    • Command, string: The type of request being made:

      • subscribe — subscribe to market data for a specific currency pair.

      • unsubscribe — close an existing subscription.

      • subscribeAll — resubscribe to all subscriptions specified in the initial subscriptions file.

      • unsubscribeAll — close all existing subscriptions.

      • connect — connect to the venue.

      • disconnect — disconnect from the venue.

    • Variant, string: The asset variant to subscribe to: Spot, Forward, Swap, CustomSpot, CustomForward, CustomSwap, CustomSpotRoll.

    • CcyPair, string: The 6-character, ISO4271 base/quote currency pair, such as EURUSD.

    • ClientName, string: The client to which the subscription relates. If this is a null or empty string then the subscription is for the client of the logged-on user.

    • ClientSubscriptionID, string: an optional, user-supplied value that is echoed in the subscription response and in quote tuples.

    • Side, string: Used for custom subscriptions and contains one of B, Buy, S, Sell, BS, or BuySell.

    • NearTenor, string: The near tenor value used in subscribing to custom swaps and the tenor value in subscribing to forwards. In subscribing to forwards, use null to subscribe to all tenors.

    • FarTenor, string: The far tenor value used in subscribing to custom swaps.

    • TradingCcy, string: The trading currency used in custom subscriptions. In addition, the trading currency is used to set the quote rungs received in non-custom subscriptions. If null, rungs are received for both currencies; otherwise, volume is stated in the requested currency.

    • NearAmount, double: The near-leg amount for which Quotes obtained through a custom swap subscription can be traded.

    • FarAmount, double: The far-leg amount for which Quotes obtained through a custom swap subscription can be traded.

    • HistSpot, double: For custom spot roll subscriptions, the historical spot rate on which a swap will be traded.

    • OutrightTenor, string: For custom spot roll subscriptions, the far tenor of the swap (the near tenor is SPOT).

    • SubscriptionId, string: Specifies the ID of the subscription to unsubscribe from. Subscription IDs are obtained from the market data adapter's SubscriptionIDs output port.

  • SetLadderRungs (input): This port is used to specify the rung structure used for generating quote ladders.

    • Ccy1, string: The base currency.

    • Ccy2, string: The quote currency.

    • BidRungs, List<string>: The list of quantity values which form the bid ladder rungs. Quantity values may be a colon separated pair of values where the first value is for forwards and the near quantity for swaps, while the second value is the far quantity for swaps.

    • AskRungs, List<string>: The list of quantity values which form the ask ladder rungs. Quantity values may be a colon separated pair of values where the first value is for forwards and the near quantity for swaps, while the second value is the far quantity for swaps.

  • MarketDataStatus (output): This output port emits status, information, and error tuples and has the following schema:

    • Type, string: Contains one of the following values describing the type of event that occurred:

      • Connection

      • Subscription

      • SuspendResume

    • Object, string: the name of the item associated with the event:

      • Connection events: The string DB Autobahn FX

      • Subscription events:

        • When action is File Processed, contains the name of the initial subscriptions file

        • When action is Accepted or Rejected, contains a string representation of the adapter's internal subscription object

      • SuspendResume events: The name of the market data adapter icon on the canvas that was suspended or resumed

    • Action, string: Contains one of the following values describing the action that took place:

      • Connection events: Connected, Disconnected, Unavailable, Unknown

      • Subscription events: File processed, Accepted, Rejected

      • SuspendResume: Suspended, Resumed

    • Message, string: A human-readable description of the event.

    • Request, tuple: The contents of the subscription request tuple, if applicable, that resulted in the status tuple.

  • SubscriptionIDs (output): The market data adapter emits tuples on this port when subscription requests succeed. The port has the following schema:

    • Variant, string: Spot, Forward, Swap, CustomSpot, CustomForward, CustomSwap, CustomSpotRoll.

    • CurrencyPair, string: The currency pair.

    • SubscriptionId, string: A unique, Autobahn FX API-generated ID for the subscription.

    • Request, tuple: Represents the original subscription request.

  • Quotes (output): The market data adapter emits tuples on this port when it receives quotes. The port has the following schema:

    • SubscriptionId, string: The unique, Autobahn FX API-generated ID for the subscription that resulted in the quote.

    • ClientSubscriptionId, string: The optional, user-supplied value for the subscription that resulted in the quote.

    • QuoteId, string: The unique ID of the quotes object received from the Autobahn FX API.

    • BaseCcy, string: The base currency.

    • QuoteCcy, string: The quote currency.

    • QuotesParameters, tuple: Addition information pertaining to all the quotes in the tuple, including:

      • SpotPriceDecimals, int: The number of decimals to which a spot price should be displayed.

      • SpotTickSize, int: The tick size for spot prices.

      • ForwardPointsDecimals, int: The number of decimals to which forward points should be displayed.

      • ForwardPointsTickSize, int: The tick size for forward points.

      • OutrightPriceDecimals, int: The number of decimals to which an outright price should be displayed.

      • BuyBaseMaxTradable, int: The maximum base currency buyable amount at moment the quotes object was created.

      • SellBaseMaxTradable, int: The maximum base currency sellable amount at moment the quotes object was created.

      • BuyQuoteMaxTradable, int: The maximum quote currency buyable amount at moment the quotes object was created.

      • SellQuoteMaxTradable, int: The maximum quote currency sellable amount at moment the quotes object was created.

    • SpotQuotes, list<tuple>: Zero or more spot quotes contained in the quotes object, each of which has the following fields:

      • QuotdId, string: The ID of the quote.

      • QuoteVariant, string: Ladder or Individual.

      • BaseCcy, string: The base currency.

      • QuoteCcy, string: The quote currency.

      • AssetVariant, string: Spot.

      • Side, string: B, S, or BS.

      • IsTradable, bool: True if the quote can be traded and false otherwise.

      • IsValid, bool: True if the quote is valid and false otherwise.

      • TradingCcy, string: The currency in which this quote will trade.

      • SpotDate, timestamp: The spot date of this quote.

      • SpotRate, double: The spot rate of this quote.

      • NearTenor, string: The tenor of this quote.

      • NearDate, timestamp: The spot date.

      • NearRate, double: The spot rate.

      • NearAmount, double: The amount this quote will trade.

    • ForwardQuotes, list<tuple>: Zero or more forward quotes contained in the quotes object, each of which has the following fields:

      • QuotdId, string: The ID of the quote.

      • QuoteVariant, string: Ladder or Individual.

      • BaseCcy, string: The base currency.

      • QuoteCcy, string: The quote currency.

      • AssetVariant, string: Forward.

      • Side, string: B, S, or BS.

      • IsTradable, bool: True if the quote can be traded and false otherwise.

      • IsValid, bool: True if the quote is valid and false otherwise.

      • TradingCcy, string: The currency in which this quote will trade.

      • SpotDate, timestamp: The spot date of this quote.

      • SpotRate, double: The spot rate of this quote.

      • NearTenor, string: The tenor of this quote.

      • NearDate, timestamp: The spot date.

      • NearRate, double: The spot rate.

      • NearAmount, double: The amount this quote will trade.

      • NearForwardPoints, double: The forward points of this quote.

    • SwapQuotes, list<tuple>: Zero or more swap quotes contained in the quotes object, each of which has the following fields:

      • QuotdId, string: The ID of the quote.

      • QuoteVariant, string: Ladder or Individual.

      • BaseCcy, string: The base currency.

      • QuoteCcy, string: The quote currency.

      • AssetVariant, string: Spot.

      • Side, string: B, S, or BS.

      • IsTradable, bool: True if the quote can be traded and false otherwise.

      • IsValid, bool: True if the quote is valid and false otherwise.

      • TradingCcy, string: The currency in which this quote will trade.

      • SpotDate, timestamp: The spot date of this quote.

      • SpotRate, double: The spot rate of this quote.

      • NearTenor, string: The tenor of this quote.

      • NearDate, timestamp: The spot date.

      • NearRate, double: The spot rate.

      • NearAmount, double: The amount this quote will trade.

      • NearForwardPoints, double: The forward points for the near leg (0.0 if the near leg is spot).

      • FarTenor, string: The tenor for the far leg.

      • FarDate, timestamp: The value date for the far leg.

      • FarRate, double: The rate for the far leg.

      • FarAmount, double: The amount for which the far leg of this quote will trade.

      • FarForwardPoints, double: The forward points for the far leg (0.0 if the far leg is spot).

      • SwapPoints, double: The swap points.

  • SubscriptionEnded (output): The market data adapter emits tuples on this port when it a subscription ends, either due to an unsubscribe request or though notification by the Autobahn FX API. The port has the following schema:

    • SubscriptionId, string: The unique, Autobahn FX API-generated ID for the subscription.

    • Request, tuple: Represents the original subscription request.

Autobahn FX Trade Adapter Ports

The Autobahn FX Trade adapter sends trade requests to the Autobahn FX trading system. It has one input port and two output ports:

  • TradeRequest (input): Tuples are enqueued on this port to request trades on previously-received quotes. The schema of this port is:

    • QuoteId, string: The ID of quote on which the trade is being requested.

    • ClientReference, string: A reference for this trade as generated by the StreamBase application. If an empty string is given it is assumed that client references are not being supplied. For any other value it is assumed that client references are being supplied and that the reference will be unique. If a non-unique value is supplied the trade will be rejected. ClientReference must be no longer than 62 characters.

    • ClientId, string: The client which is substituted instead of the client of the user subscribed to this quote. This functionality is only used by clients who have multiple accounts on which they need to execute trades and is agreed by the business ahead of time.

    • OverrideRate, double: The StreamBase application-supplied rate at which this quote will trade.

    • Amount, double: The traded amount to be used when requesting a partial fill.

  • TradeStatus (output): This output port emits status, information, and error tuples and has the following schema:

    • Type, string: Contains one of the following values describing the type of event that occurred:

      • Trade

      • SuspendResume

    • Object, string: the name of the item associated with the event:

      • Connection events: The string DB Autobahn FX

      • Trade events: A string representation of the rejected trade request tuple

      • SuspendResume events: The name of the trade adapter icon on the canvas that was suspended or resumed

    • Action, string: Contains one of the following values describing the action that took place:

      • Trade events: Rejected

      • SuspendResume: Suspended, Resumed

    • Message, string: A human-readable description of the event.

    • Request, tuple: The contents of the trade request tuple, if applicable, that resulted in the status tuple.

  • TradeResponses (output): The output adapter emits tuples to convey the results of trade requests and has the following schema:

    • Status, int: The status of the trade as an integer, 1 (Accepted), 2 (Rejected), 3 (Unknown).

    • StatusText, string: The status of the trade in text format, Accepted, Rejected, or Unknown.

    • BaseCcy, string: The base currency.

    • QuoteCcy, string: The quote currency.

    • ErrorMessage, string: An empty string if the trade was accepted. Otherwise, a message explaining the reason for the rejection or the reason that the status is unknown.

    • ErrorCode, string: An empty string if the trade was accepted. Otherwise, an internationalisation code for the error message. Possible values are: TRADING DISABLED, INSUFFICIENT LIQUIDITY, STALE QUOTE, INVALID RATE, INVALID AMOUNT, INVALID PRODUCT, AGGREGATION AFTER CUTOFF, or SYSTEM ERROR.

    • TradeId, string: If the trade was accepted, the Autobahn FX-generated ID of the trade. Otherwise, an empty string.

    • ClientReference, string: The client's reference for the trade or an empty string if no client reference was supplied.

    • TradeDateTime, string: The date and time of the trade if it was accepted. Otherwise, an empty string.

    • DealerUserId, string: The ID of the dealer if the trade was accepted. Otherwise, an empty string.

    • ClientName, string: The name of the client if the trade was accepted. Otherwise, an empty string.

    • ClientId, string: The ID of the client if the trade was accepted. Otherwise, an empty string.

    • CounterpartyName, string: The name of the counterparty if the trade was accepted. Otherwise, an empty string.

    • Side, string: One of B or S if the trade was accepted. Otherwise, an empty string.

    • NearLeftAmount, double: For accepted non-swap trades, the amount of the trade in the left currency. For accepted swap trades, the amount of the trade in the left currency for the near leg. For rejected trades, 0.0.

    • NearRightAmount, double: For accepted non-swap trades, the amount of the trade in the right currency. For accepted swap trades, the amount of the trade in the right currency for the near leg. For rejected trades, 0.0.

    • NearRate, double: For accepted non-swap trades, the rate for the trade. For accepted swap trades, the rate for the near leg of the trade. For rejected trades, 0.0.

    • NearValueDate, string: For accepted non-swap trades, the value date for trade. For accepted swap trades, the value date for the near leg of the trade. For rejected trades, an empty string.

    • TradeType, string: Spot, Outright, or Swap.

    • ForwardPoints, double: For accepted outright trades, the forward points. Otherwise, 0.0.

    • FarLeftAmount, double: For accepted swap trades, the amount of the trade in the left currency for the far leg. Otherwise, 0.0.

    • FarRightAmount, double: For accepted swap trades, the amount of the trade in the right currency for the far leg . Otherwise, 0.0.

    • FarRate, double: For accepted swap trades, the rate for the far leg of the trade. Otherwise, 0.0.

    • FarValueDate, string: For accepted swap trades, the value date for the far leg of the trade.

    • SwapPoints, double: For accepted swap trades, the swap points.

Typechecking and Error Handling

The Autobahn FX adapter uses typecheck messages to help you configure the adapter within your StreamBase application. In particular, the adapter generates typecheck messages for the following reasons:

  • A required property such as the Autobahn FX configuration file or Global ID is missing.

  • The specified Autobahn FX configuration file or initial subscriptions file does not exist.

  • One or more required fields in an input schema are missing or of the wrong type.

  • One or more unexpected fields are present in an input schema.

The adapter emits status tuples and/or warning messages during runtime under various conditions, including:

  • The adapter fails to connect or loses its connection to the Autobahn FX server.

  • An invalid subscription or trade request tuple is enqueued to the adapter.

  • The adapter incurs an error emitting a tuple.

  • The adapter adapter is suspended or resumed.

Suspend and Resume Behavior

When suspended, the adapter continues to receive and process Autobahn FX messages, but no longer emits tuples on its output ports.

When resumed, the adapter once again starts emitting tuples on its output ports.

Related Topics