GAIN GTX Adapter

Introduction

The TIBCO StreamBase® Adapter for GAIN GTX allows a StreamBase application to receive Foreign Exchange (FX) market data from, place orders with, and receive trading-related events from a GAIN GTX ECN server. The GAIN GTX adapter is a single, bidirectional adapter that can both send and receive GTX messages. To facilitate its use in EventFlow diagrams, the adapter is represented as an input adapter and an output adapter, with separate icons in the StreamBase Studio Palette view. These icons must be used as a pair that shares a single GTX connection (described below in Linking Input and Output Adapters).

The adapter has the following capabilities:

  • Establishes a connection to the GAIN GTX server.

  • Subscribes to market data for specific FX currency pairs, as well as publishes prices and places trades for those subscribed symbols.

  • Converts the incoming events from the GTX server and sends them as tuples to the StreamBase application.

  • Converts incoming tuples from the StreamBase application into GTX messages that are then sent to the GTX server.

  • Optionally receives commands from the StreamBase application to log on to, or log out from, the GAIN GTX server.

The input side of the adapter exposes a set of output ports, and the output side exposes a set of input ports, the fields for which are defined later in this document. In addition, each side of the adapter exposes a set of adapter properties as described in Adapter Properties.

Linking Input and Output Adapters

Having separate input and output adapter icons for EventFlow applications minimizes the need for loops in EventFlow logic. The input and output adapters share a connection to the GAIN GTX server.

To link GAIN GTX input and output adapters so that they share a single GTX connection, follow these steps:

  • Create a GAIN GTX input adapter and configure it to connect to the GTX server, as described in Adapter Properties Tab. In this input adapter's General tab, note the value of the Name parameter. For clarity, specify a non-default name here. For this example we will use the name MyGTXTradingInputAdapter.

  • Create an instance of the GAIN GTX output adapter.

  • In this new adapter's Adapter Properties tab, fill in the Share A Connection With The GAIN GTX Input Adapter Named field, enter the name of your input adapter (MyGTXTradingInputAdapter in our example).

    Note

    Make sure the spelling matches the input adapter's name exactly or a runtime error will occur, indicating that the specified input adapter is not found.

Adapter Properties

Settings are used to control most of the behavior of the adapter. The settings are grouped under several tabs in the Properties view in StreamBase Studio.

In the table in this section, the Property column shows each property name as found in the one or more adapter properties tabs of the Properties view for this adapter.

Input Adapter Properties

General Tab

Name: Use this required field to specify or change the name of this instance of this component, which must be unique in the current EventFlow module. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.

Adapter: A read-only field that shows the formal name of the adapter.

Class name: Shows the fully qualified class name that implements the functionality of this adapter. If you need to reference this class name elsewhere in your application, you can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.

Start with application: If this field is set to Yes (default) or to a module parameter that evaluates to true, this instance of this adapter starts as part of the JVM engine that runs this EventFlow module. If this field is set to No or to a module parameter that evaluates to false, the adapter instance is loaded with the engine, but does not start until you send an sbadmin resume command, or until you start the component with StreamBase Manager.

Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports to learn about Error Ports.

Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Adapter Properties Tab

Property Data Type Default Description
Server URL string none A valid URL pointing to the GAIN GTX server to which to connect.

Note

Unless the Configuration File property is specified, this setting is required.

User Name string none The username to use when signing on to the GTX server.

Note

Unless the Configuration File property is specified, this setting is required.

Password string none The password to use when signing on to the GTX server.

Note

Unless the Configuration File property is specified, this setting is required.

Application Name string none A string such as "Acme Corp. Trading App" to be used as the application name to be recorded as the "User-Agent" identifier in server connection logs.
Configuration File drop-down list none The name a file containing the necessary parameters to use when connecting to the GAIN GTX server. The format of this file is expected to conform to the Java Properties file format. As of this writing the following properties may be included in this file:
  • forexster.serverUrl: A valid URL pointing to the GAIN GTX server to which to connect.

  • forexster.username: The username to use when signing on to the GTX server.

  • forexster.password: The password to use when signing on to the GTX server.

  • forexster.backoff.schedule: Set this to a comma-separated list of millisecond reconnect delays.

This control is a drop-down list that shows the available files in the current Studio project. Import the GAIN GTX configuration into your Studio project so that it can be selected in the list.

Connect On Startup check box true (selected) When selected, the adapter attempts to connect to the GAIN GTX server immediately after starting. If cleared, the adapter remains idle after starting and waits for a Connect command as described in Input Port Overview.
Reconnect Retries int 0 The number of times the adapter is to attempt reconnection if the first connection attempt is unsuccessful.
Reconnect Interval (in seconds) int 10 Specifies the number of seconds to wait between reconnection attempts. This value is ignored unless Reconnect Retries has a non-zero positive value.

Proxy Tab

Property Data Type Default Description
Use Proxy check box false (cleared) If selected, this option causes the adapter to go through the specified proxy (see settings below) to access the GAIN GTX server.
Proxy Host Name string none Name of the proxy server to use.
Proxy Host Port int none Port number of the proxy server to use.
Proxy Type drop-down list NONE The type of proxy connection to use. Available values are:
  • NONE - All sockets will connect directly to the target host.

  • HTTP_CONNECT - This option causes all sockets to request an "HTTP CONNECT" tunnel to the target host through the proxy server.

  • HTTP_PROXY - This option only works if the client/server traffic is converted to separate HTTP POST and GET actions, and causes those POST and GET messages to use certain HTTP headers to determine proxy options.

Proxy User Name string none User name to use when connecting to the proxy server.
Proxy Passphrase string none Passphrase to use when connecting to the proxy server.

Logging Tab

Property Data Type Default Description
Log Level drop-down list INFO 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 will be used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE.
Report Profiling Data check box false (cleared) When selected, the adapter collects data on how long it takes to process incoming messages, and regularly reports the results to the console. Reported data includes the average, standard deviation, minimum and maximum times (in microseconds) taken to receive each market data message, convert it into a tuple and send it to the application. This is useful when troubleshooting performance issues in your application.
Reporting Interval (in # of messages) int 10000 When Report Profiling Data is checked, this property specifies the number of incoming messages after which performance data is reported to the console. A positive integer is expected. This property is ignored if Report Profiling Data is cleared.

Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.

Caution

Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.

Output Adapter Properties

General Tab

This tab is identical to the one exposed by the GAIN GTX input adapter. See General Tab.

Adapter Properties Tab

Property Data Type Default Description
Share A Connection With The GAIN GTX Input Adapter Named string none The name of the GAIN GTX input adapter with which to share a connection.

Logging Tab

This tab is identical to the one exposed by the GAIN GTX input adapter. See Logging Tab.

Concurrency Tab

This tab is identical to the one exposed by the GAIN GTX input adapter. See Concurrency Tab.

Adapter Ports And Schemas

Input Adapter Ports

Output Port Overview

The GAIN GTX input adapter has five output ports:

  • The first port routes the Market Data messages received from the GAIN GTX server.

  • The second port routes incoming Trade Execution Report messages received from the server.

  • The third port routes incoming Firm Feed Execution Report messages received from the server.

  • The fourth port routes status messages, such as connection and disconnection from the server, error conditions, and so on.

  • The fifth port routes asynchronous order status messages. These are generated to inform the user of an order's current state in the system (Accepted, Matched, and so on).

The schema for each output port is described in the following sections:

Market Data Output Port Schema

The first output port routes incoming Market Data messages to the StreamBase application. In order to receive such messages for a given currency pair, you must first subscribe to it (see Subscription Input Port).

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name Field Type Description
requestedSymbol string  
requesterBookProperties string  
marketParameters tuple Contains values common to all the data entries in this message.
^ symbol string Symbol in CCY1/CCY2 format.
displayPrecision int Positive number of decimal places which should be used for displaying prices in this book.
maxBuyAmount long PRE-CLEARED TRADING LIMIT: Returns the maximum order size that can result in a complete fill for a BUY order from viewingFirmName assuming sufficient market depth is available.
maxSellAmount long PRE-CLEARED TRADING LIMIT: Returns the maximum order size that can result in a complete fill for a SELL order from viewingFirmName assuming sufficient market depth is available.
onePip double Customary value of one pip in this market.
priceIncrement double All prices displayed in this book will be a multiple of this value.
tradeDate timestamp Current trade date.
valueData timestamp Current value date.
viewingFirmName string Name of the firm for which this custom limit-order book view has been constructed.
viewingUserName string Name of the firm for which this custom limit-order book view has been constructed.
marketDataEntries list<tuple> Contains the list of MarketDataEntries contained in this message.
^ orderID string String Order ID associated with this entry if it is available, null otherwise.
price double Limit order price for the underlying order.
size double Available size (adjusted by credit constraints and previous fills) of the underlying order.
enteringFirmName string Identifying code for the entering firm name if it is available, null otherwise.
enteringUserName string Login name of the entering user if it is available, null otherwise.
matchIncrement double Non-null value if this entry is restricted to matching in multiples of the specified positive value.
minQty double Non-null value if this entry is restricted to matching in amounts equal to or larger than the specified positive value.
positionNum int Display position of this bid or offer, numbered from most competitive to least competitive, per market side, beginning with 1.
isAON boolean  
isRestrictedBySelfDealRule boolean True if the price maker is in your own firm and your account is configured to disallow self-dealing.
scope string FIX Scope(546) of the entry, or zero if the subscriber is not configured to receive that information. Possible values are:
  • SCOPE_LOCAL

  • SCOPE_NATIONAL

  • SCOPE_GLOBAL

side string BID_SIDE if this entry is an order to BUY CCY1, or OFFER_SIDE if this is an order to SELL CCY1.

Trade Execution Report Output Port Schema

The second output port routes incoming Trade Execution Report messages to the StreamBase application (once you've subscribed for trading — see Subscription Input Port).

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name Field Type Description
possDup boolean  
bulkLoad boolean True for any and all trades that are reported in a "bulk load" operation immediately after a new trading subscription is made.
sequenceNumber long The GTX sequence number that can be used to query subsequent trades.
symbol string  
tradeID string A short deal identifier, same for all parties to the trade.
tradeDate timestamp  
amount double Quantity of the first currency which was bought or sold.
counterAmount double Quantity of the second currency that was bought or sold in exchange for amount.
farAmount double  
farCounterAmount double  
counterpartyID string String identifier for the counterparty firm.
forwardPoints double swapRate value after scaling by the standard scaling factor for this currency pair, which usually (but not always) results in a number of pips.
otherCustomOrderInfo string String identifier that was attached to the order by specifying a FIX PartyRole(452) of CONTRA_TRADER(37), or null if that party is not available in this Execution Report.
otherOrderID string String identifier of the order entered by the FIX PartyRole(452) of CONTRA_TRADER(37), or null if that party is not available in this Execution Report.
otherOrderProperties tuple "Advanced properties" of the order entered by the FIX PartyRole(452) of CONTRA_TRADER(37), or null if that party is not available in this Execution Report.
^ properties list<tuple> Contains a list of the properties, represented by a simple tag|value tuple.
^ tag string  
value string  
possibleProblems list<string> A collection of strings describing unrecognized tags and other issues that might cause problems but which GTX will attempt to pass along anyway.
definiteProblems list<string> A collection of strings describing parse errors that will prevent the affected fields from being processed correctly.
ourCustomOrderInfo string  
ourOrderID string String identifier of the trader's order, useful for tracking multiple executions which represent partial fills of a single order.
ourOrderProperties tuple "Advanced properties" of the order.
^ properties list<tuple> Contains a list of the properties, represented by a simple tag|value tuple.
^ tag string  
value string  
possibleProblems list<string> A collection of strings describing unrecognized tags and other issues that might cause problems but which GTX will attempt to pass along anyway.
definiteProblems list<string> A collection of strings describing parse errors that will prevent the affected fields from being processed correctly.
ourPartyID string String identifying the firm or account from whose perspective this trade is being reported.
parties list<tuple> Names and roles of the parties involved the trade.
^ partyRole string FIX PartyRole(452) value for this party.
name string Name of this party.
rate double Price at which this trade was executed.
spotRate double For a forward trade, returns the spot rate, equivalent to the Rate minus the SwapRate.
spotDate timestamp  
swapRate double For a forward trade, returns the unscaled forward points, that is, as a value that can be directly added or subtracted to other prices.
swapNearRate double  
swapFarRate double  
swapNearDate timestamp  
swapFarDate timestamp  
forwardDate timestamp  
isBuying boolean True of this party was the buyer of amount, false if seller.
isForward boolean  
isSpot boolean  
isSwap boolean  

Firm Feed Execution Report Output Port Schema

The third output port routes incoming Firm Feed Execution Report messages to the StreamBase application (once you've subscribed for Firm Feed functionality — see Subscription Input Port). The schema for this port is identical to that of the Trade Execution Report Output port above.

The schema for this port is pre-set by the adapter, and is described in this section: Trade Execution Report Output Port Schema.

Note

Every Execution Report received via this port MUST subsequently be acknowledged via an ACKNOWLEDGE_REPORT command to the Output Adapter's Command input port (see Command Input Port).

Status Output Port Schema

The fourth output port routes incoming Status messages to the StreamBase application.

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name Field Type Description
statusType string The type of event this tuple is describing. One of:
  • CONNECTED - Connection has been established with the GTX server

  • DISCONNECTED - Disconnection from the GTX server

  • CONNECTION_FAILED - Connection attempt to GTX server was unsuccessful

  • CONNECTION_STATUS - Current status of the connection to the GTX server. This status is sent periodically by the GTX server, and may also be explicitly requested via the GET_CONNECTION_STATUS command on the Command input port.

  • ORDER_SENT - Indicates that an order was sent to the GTX server. This is useful to obtain the "official" orderID assigned by GTX and relate it to the user-supplied tempOrderID, which is important because all further messages relating to this order will use orderID as an identifier.

  • ASYNC_ORDER_SENT - Indicates that an asynchronous order was sent to the GTX server. Shortly after this tuple is received, an order status tuple with type=ACCEPTED will be issued (see Order Status Output Port Schema), which can be used to obtain the "official" orderID assigned by GTX and relate it to the user-supplied tempOrderID. This is important because all further messages relating to this order will use orderID as an identifier.

  • ORDER_STATUS - Status of an order as requested via the GET_ORDER_STATUS command on the Command input port.

  • DOWNLOADED_TRADES - All trades done since the trade which had the specified sequence number, as requested via the DOWNLOAD_TRADES command on the Command input port.

  • FIRM_FEED_MASTER_SWITCH_STATE - State of the Firm Feed "master switch", as requested via the GET_MASTER_SWITCH_STATE command of the Command input port.

  • SUBSCRIBED_TO_MARKET_DATA - Indicates a subscription has been made to market data (via the Subscription input port).

  • SUBSCRIBED_TO_TRADING - Indicates a subscription has been made to trade a given currency pair (via the Subscription input port).

  • SUBSCRIBED_TO_FIRM_FEED - Indicates a subscription has been made to publish Firm Feed prices (multiple bid and offer prices as a stream) for the given currency pair (via the Subscription input port).

  • UNSUBSCRIBED_TO_MARKET_DATA

  • UNSUBSCRIBED_TO_TRADING

  • UNSUBSCRIBED_TO_FIRM_FEED

moreInfo string Contains extra information when the statusType is one of:
masterSwitchEnabled boolean True if the "master switch" controlling all Firm Feed subscriptions is currently allowing prices to be displayed.
previousConnectionStatus tuple Describes the previous state of the connection to the GTX server. This may be null if this status tuple was generated as a result of a GET_CONNECTION_STATUS command (see Command Input Port).
^ isConnected boolean True if the connection is up.
clockSkewMillis long Smoothed estimate of the clock skew, positive if the GTX server clock is ahead of the client clock.
roundTripMillis int Most recent round-trip latency observation.
nextAttempt timestamp If connection was unexpectedly disconnected, returns the approximate time (according to the local client clock) at which a reconnection attempt is scheduled, otherwise returns zero.
disconnectCause string Describes the cause of the most recent disconnect or the reason for a login failure.
newConnectionStatus tuple Describes the current state of the connection to the GTX server.
^ isConnected boolean True if the connection is up.
clockSkewMillis long Smoothed estimate of the clock skew, positive if the GTX server clock is ahead of the client clock.
roundTripMillis int Most recent round-trip latency observation.
nextAttempt timestamp If connection was unexpectedly disconnected, returns the approximate time (according to the local client clock) at which a reconnection attempt is scheduled, otherwise returns zero.
disconnectCause string Describes the cause of the most recent disconnect or the reason for a login failure.
tempOrderID string If this status tuple is of type ORDER_SENT, this field will contain the orderID supplied in the original SEND_ORDER tuple sent to the Trading input port (see Trading Input Port).
orderID string Contains the "official" order ID as assigned by GTX. This is the order ID that must be used to refer to this order after an order is sent (for example, when requesting the status of the order via a GET_ORDER_STATUS command on the Command input port, or when canceling the order via a CANCEL command sent on the Trading input port).
isActive boolean For tuples of statusType ORDER_STATUS, contains true if this trade is currently active or false if the order is canceled, filled, expired, or replaced.
execReports list<ExecutionReport> When a command of type GET_ORDER_STATUS is sent with includeExecReports=true, this list will contain the Exection Reports (see Trade Execution Report Output Port Schema) for all partial fills that have occurred on this order.

Order Status Output Port Schema

The fifth output port routes to the StreamBase application all incoming messages resulting from notifications of state changes and fills for an order submitted via the Trading port's Send_Order_Async functionality (see Trading Input Port).

The schema for this port is pre-set by the adapter, and is described in the following table:

Field Name Field Type Description
type string The type of status represented by this tuple. Possible values are:
  • ACCEPTED — Sent as soon as the order has been placed. This will always precede any fills. This is useful to obtain the official orderID assigned by GTX and relate it to the user-supplied tempOrderID. This is important because all further messages relating to this order use orderID as an identifier.

  • MATCHED — Sent after any new trades occur. Note that multiple new trades may be reported in each call, and the list of <tradeID>s is cumulative.

  • UNKNOWN — Sent when the order status cannot be determined by the GTX adapter. Notify operations personnel to immediately check order status by contacting Support.

  • FROZEN — Sent when the order reaches a final state; no further callbacks will occur. The <text> field contains a string describing the final disposition of the order (such as FILLED).

symbol string  
side string Literal strings buy or sell.
orderQty long  
cashOrderQty long  
limitPrice long  
tempOrderID string If this status tuple is of type ACCEPTED, this field contains the orderID supplied in the original SEND_ORDER tuple sent to the Trading input port (see Trading Input Port).
orderID string Contains the official order ID as assigned by GTX. This is the order ID that must be used to refer to this order after an order is sent (for example, when requesting the status of the order via a GET_ORDER_STATUS command on the Command input port, when canceling the order via a CANCEL command sent on the Trading input port, or when receiving an Execution Report or other order status report via this port).
cumulativeAmount double  
cumulativeCounterAmount double  
averagePrice double  
text string For status tuples of type FROZEN, contains the final disposition of the order (such as FILLED).
advancedProperties tuple The advanced properties of the order.
^ properties list<tuple> Contains a list of the properties, represented by a simple tag-value tuple.
^ tag string  
value string  
possibleProblems list<string> A collection of strings describing unrecognized tags and other issues that might cause problems but which GTX attempts to pass along anyway.
definiteProblems list<string> A collection of strings describing parse errors that prevent the affected fields from being processed correctly.
tradeIDs list<string> For status tuples of type MATCHED, contains the cumulative list of all trades that have occurred so far to fill this order.

Output Adapter Ports

Input Port Overview

The adapter has four input ports:

  • The first port, Command Input Port, allows applications to send commands to the adapter.

  • The second port, Subscription Input Port, allows applications to subscribe to receive market data, trading and firm feed updates from the GAIN GTX server.

  • The third port, Trading Input Port, allows applications to place trades.

  • The fourth port, Firm Feed Prices Input Port, allows applications to publish multiple bid and offer prices to GTX as a stream.

Command Input Port

The Command input port is used to instruct the adapter to perform certain actions, such as connect or disconnect from the GTX server, get the status of an order, and so on.

The schema for the Command Input port is expected to contain the following fields:

Field Name Field Type Field Description
command string Contains the name of the command to execute. This field is required to be non-null for all supported commands. See below for a list of the available commands.
state boolean For commands of type SET_MASTER_SWITCH_STATE, must contain the desired state (true=enabled) of the Firm Feed master switch.

This field may be left null for all other commands.

orderID string For commands of type GET_ORDER_STATUS, must contain the ID of the order (as given by the Status output port's orderID field) for which status is desired.

This field may be left null for all other commands.

includeExecReports boolean For commands of type GET_ORDER_STATUS, set to true to request the execReports field to be filled out when generating the ORDER_STATUS tuple on the Status output port. If left null or set to false, the execReports field will be left null.

This field may be left null for all other commands.

seqNum long For commands of type DOWNLOAD_TRADES, will cause a tuple of type DOWNLOADED_TRADES to be issued on the Status port containing all trades done since the trade which had the specified sequence number.

For commands of type ACKNOWLEDGE_REPORT, will cause the report identified by this field to be acknowledged to the GTX server. This MUST be done for all Execution Reports received via the Input Adapter's Firm Feed Execution Report Output port (see Firm Feed Execution Report Output Port Schema).

This field may be left null for all other commands.

tradeDate timestamp For commands of type DOWNLOAD_TRADES, if seqNum is left null this will cause a tuple of type DOWNLOADED_TRADES to be issued on the Status port containing all trades done on the given date. Note that the trade date rolls at 17:00 New York time.

This field may be left null for all other commands.

Available commands include:

  • Connect: Log on to the configured GAIN GTX server. Required fields:

    • command: Should contain the value Connect. Case is unimportant.

  • Disconnect: Log out of the GAIN GTX server. Required fields:

    • command: Should contain the value Disconnect. Case is unimportant.

  • Get_Connection_Status: Request a Status tuple that describes the current state of the connection to the GTX server. The resulting tuple on the Status output port will be of statusType=CONNECTION_STATUS. Required fields:

    • command: Should contain the value Get_Connection_Status. Case is unimportant.

  • Get_Order_Status: Query the GTX server to obtain the status of the given order, via a tuple sent to the Status port. The resulting tuple will be of type statusType=ORDER_STATUS. Required fields:

    • command: Should contain the value Get_Order_Status. Case is unimportant.

    • orderID: The ID of the order for which status is desired, as given by the orderID field of the statusType=ORDER_SENT Status tuple previously issued for this order.

    • includeExecReports: If this field is non-null and its value is true, the execReports field of the resulting statusType=ORDER_STATUS Status tuple will contain the Exection Reports (see Trade Execution Report Output Port Schema) for all partial fills that have occurred on this order.

  • Download_Trades: Request from the GTX server a list of either: all trades of the current trading day starting with the given sequence number (if seqNum is non-null), or all trades that occurred on the given trading date (if tradeDate is non-null instead). Required fields:

    • command: Should contain the value Download_Trades. Case is unimportant.

    Also, one (and only one) of these fields must be specified:

    • seqNum: Return all trades done since the trade which had the specified sequence number. If value is zero, return all trades since the beginning of the current trading date (which rolls at 17:00 New York time Monday through Thursday and on Saturday).

    • tradeDate: Return all trades done on the specified trading date.

  • Acknowledge_Report: Each Execution Report received via the Input Adapter's Firm Feed Execution Report Output port (see Firm Feed Execution Report Output Port Schema) MUST be acknowledged via this command. Required fields:

    • command: Should contain the value Acknowledge_Report. Case is unimportant.

    • seqNum: Should contain the value found in the execution report tuple's sequenceNumber field..

  • Get_Master_Switch: Request from the GTX server the state of the Firm Feed master switch, controlling whether all Firm Feed subscriptions are allowed to display prices. Required fields:

    • command: Should contain the value Get_Master_Switch. Case is unimportant.

  • Set_Master_Switch: Explicitly set the state of the GTX server's master switch state which controls whether Firm Feed subscriptions are allowed to display prices. Required fields:

    • command: Should contain the value Set_Master_Switch. Case is unimportant.

    • state: True if the switch os to be enabled, false otherwise. If field is left null, a value of false is assumed.

Subscription Input Port

The Subscription Input port allows applications to subscribe to receive market data, trading and firm feed updates from the GAIN GTX server.

The schema for the Subscription Input port is expected to contain the following fields:

Field Name Field Type Description
subscriptionType string Contains the type of the subscription desired. This field is required to be non-null for all supported subscriptions. Subscription types include (case is unimportant):
  • MarketData - Indicates to the system that you wish to receive market data updates for the specified currency pair, to be received via the input adapter's Market Data output port (see Market Data Output Port Schema).

  • Trading - Indicated to the system that you wish to place trades via the output adapter's Trading input port (see Trading Input Port), as well as receive trading execution reports via the input adapter's Trading Execution Reports output port (see Trade Execution Report Output Port Schema).

  • FirmFeed - Indicates to the GTX system that you wish to publish multiple bid and offer prices as a stream for the given currency pair via the output adapter's Firm Feed Prices input port (see Firm Feed Prices Input Port), as well as receive execution reports via the input adapter's Firm Feed Execution Report output port (see Firm Feed Execution Report Output Port Schema).

symbol string For a subscriptionType of type MarketData or FirmFeed, designates the currency pair for which a subscription is desired. Otherwise, may be left null.
advancedBookPropertiesString string (MarketData subscriptions only) A semicolon-delimited string of tag=value properties such as "MarketDepth=3;AggregatedBook=Y" or "264=3;266=Y". May be left null.
advancedBookProperties list<tuple> (MarketData subscriptions only) Convenience construct allowing to specify tag=value properties as with the advancedBookPropertiesString field without having to construct the string directly.
^ tag string  
^ value string  
removeSubscription boolean Must be non-null and true if the desire is to unsubscribe instead of subscribing.
lastSequenceNumber long For a subscriptionType of type Trading, subscribes for all trades done by any user of your firm since the trade which had the specified sequence number. If left null or if the value is 0, returns all trades since the beginning of the current trade date.

These trade execution reports are sent via the input adapter's Trade Execution Report output stream.

key int For a subscriptionType of type FirmFeed, this is used in conjunction with the symbol field to uniquely identify the subscription. This key will need to be specified for all subsequent command involving this Firm Feed subscription.

Trading Input Port

The Trading Input port allows you to place and cancel orders with the GTX system (once you have subscribed for trading — see Subscription Input Port).

The schema is expected to contain the following fields:

Field Name Field Type Description
type string The type of operation to perform. One of:
  • SEND_ORDER

  • SEND_ORDER_ASYNC

  • CANCEL

  • CANCEL_ALL

Required field. Case is unimportant.

Orders can be sent synchronously or asynchronously. If an order is sent asynchronously using SEND_ORDER_ASYNC, server messages regarding that order are emitted by the input adapter on the port for asynchronous order status messages. See Order Status Output Port Schema.

orderID string For type=SEND_ORDER or SEND_ORDER_ASYNC, this should contain a user-provided identifier which will be used by the adapter as the value of tempOrderID in the resulting ORDER_SENT status tuple (if SEND_ORDER was used) or in the resulting ACCEPTED order status tuple (if SEND_ORDER_ASYNC was used). In that same status tuple, the GTX-supplied, "real" order ID will be placed in the orderID field. This way applications can obtain the "real" ID for their order, which must be used in all subsequent operations for this order (such as Cancel, Order Status).

For type=CANCEL, this must contain the "real" GTX-supplied order ID (as found in the ORDER_SENT status tuple, or ACCEPTED order status tuple) of the order to cancel.

For type=CANCEL_ALL, this field may be left null.

symbol string The currency pair in AAABBB format (such as EURUSD).

For CANCEL and CANCEL_ALL operations, this field will be ignored and may be left null.

side string The word "Buy" or "Sell" referring to whether the first (LHS) currency is being bought or sold. Case is ignored.

For CANCEL and CANCEL_ALL operations, this field will be ignored and may be left null.

qty double The amount of the first (LHS) currency to buy or sell, or null if a cashOrderQty is specified.

For CANCEL and CANCEL_ALL operations, this field will be ignored and may be left null.

cashQty double The amount of the second (RHS) currency that is desired, or null if an ordinary LHS orderQty is specified.

For CANCEL and CANCEL_ALL operations, this field will be ignored and may be left null.

limitPrice double The limit price, or null for a market order. If the desired quantity cannot be filled at or better than the limit price, then nothing is done (the entire quantity is cancelled).

For CANCEL and CANCEL_ALL operations, this field will be ignored and may be left null.

advancedOrderProperties double A list of tag | value tuples representing additional FIX order fields to use when sending this order.

For CANCEL and CANCEL_ALL operations, this field will be ignored and may be left null.

^ tag string FIX tag, either in numerical form (such as "11") or by name (such as "ClOrdID").
^ value string FIX value.

Firm Feed Prices Input Port

The Firm Feed Prices Input port allows applications to publish multiple bid and offer prices to GTX as a stream (once you have subscribed for Firm Feed functionality — see Subscription Input Port).

The schema for the Firm Feed Prices Input port is expected to contain the following fields:

Field Name Field Type Description
type string The type of operation to perform. One of:
  • SET_SPOT_TIERS - Transmits the new bids (positive size) and offers (negative size) for immediate display on GTX. All previously transmitted prices are invalidated.

  • CLEAR_SPOT_TIERS - Transmits a "null book" equivalent to passing empty lists to SET_SPOT_TIERS.

  • PUT_FEED_PROPERTIES

Required field. Case is unimportant.

symbol string The symbol identifying (along with key, below) this Firm Feed. This value must match the one passed in the symbol field when subscribing to this Firm Feed (see Subscription Input Port).

Required field.

key int The key identifying (along with symbol, above) this Firm Feed. This value must match the one passed in the key field when subscribing to this Firm Feed (see Subscription Input Port).

Required field.

sizes list<double> List of the new bids (if positive values) or offers (if negative) to transmit to GTX for immediate display.

Required for SET_SPOT_TIERS. May be left null for other operations.

prices list<double> List of prices to display.

Required for SET_SPOT_TIERS. May be left null for other operations.

feedItemNum int For type=SET_SPOT_TIERS, this value will later be used by GTX in any ExecutionReport (in the ourCustomOrderInfo field) resulting from a match with these prices. Note there can be multiple matches against the same "item".

Required for SET_SPOT_TIERS. May be left null for other operations.

feedValueDate timestamp The prices will not be displayed if the date in this field does not match the GTX spot date. Pass null to bypass this validity check.

Operations other than SET_SPOT_TIERS will ignore this value.

feedProperties double For type=PUT_FEED_PROPERTIES, contains the list of price feed properties to set. Valid properties are:
  • MSI - (Match Size Increment) Only match in multiples of this amount, such as "1" to avoid cents, or "1000000" for standard lots only.

  • MMS - (Minimum Match Size) Only match amounts larger than this amount.

  • RGM - (Routing Group Mask) Integer routing group mask, such as "68" to only show this feed to counterparties in routing groups 2 and 6 (68 = 2^2 + 2^6).

  • EXP - (Expire Times) Key for the comma-separated list of numeric expire times. If there is one value, it applies to all current bids and offers.

  • LRD - (Liquidity Restore Delay) Key for the liquidity restore delay, such as "500" to prevent any single counterparty from executing two trades against this feed with less than 500 millisecond separation.

  • FLG - (Flags) Key for the string form of an integer bitmask of the following flags:

    • 0x02 - strict limit

    • 0x08 - support price (expressing a willingness but not a desire to deal at this price)

    • 0x10 - enable Crobar adjustment to not cross other feeds

This field will be ignored by other operations.

^ tag string  
^ value string  

Typechecking and Error Handling

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

  • A required property is missing.

  • One or more required fields in the Command input port is missing or is of the wrong type or size.

Suspend and Resume Behavior

When suspended, the adapter remains connected to the GTX server if it was already connected, but all incoming messages and events from the server are dropped.

When resumed, the adapter starts routing incoming messages and events from the server to the StreamBase application again.

Related Topics