Contents
This adapter is part of the TIBCO StreamBase CEP Connectivity Package.
The TIBCO StreamBase® Adapter for Alpha EMAPI Market Data Feed (MDF) allows a StreamBase application to subscribe to market data from from the Alpha Trading System venue. You can configure one to thirteen Alpha output flows as separate output ports for the adapter. For some of these output flows, Alpha supports replay capability, snapshot capability, or both. An individual instance of the StreamBase EMAPI MDF adapter can be configured to subscribe to current data, subscribe with snapshot, or replay from a point in time for all the output flows configured. If configured for replay, flows that do not support replay use snapshot subscriptions.
The Replay option requires interaction with the StreamBase application to identify the last seen sequence number for a given sequence stream. See the description of the Replay input port below for details.
Some terms and schemas on this page are derived from the Alpha Trading System External Message API documentation. See the EMAPI documentation for further information.
The Alpha EMAPI MDF adapter is configured using two tabs, Adapter Properties and Output Flow Selection.
The Adapter Properties tab has the following required and optional parameters:
Property | Description |
---|---|
User ID | The trading system user ID. |
Member ID | The trading system member ID. |
Password | The user password to authorize login. |
Market ID | The Market ID for the views to be used. |
Server | The Alpha Trading System Access point (TAX) server name (or IP address). |
Port | The port number the Alpha Trading System Access point server is listening on. |
Reconnect Wait Interval | The number of seconds to wait between connection attempts to the TAX. |
Symbol List | A comma-separated list of symbols to subscribe to. Enter _ALL_ to subscribe to all symbols in the view.
|
Symbol File | Path to a text file with individual symbols listed, one per line. This parameter is only available when the Symbol List field is empty. |
Snapshot Subscription | Check this box to get a complete order book snapshot (for flows that support this), which will be followed by real time data updates. |
Replay Subscription | Check this box to replay flows from the last received sequence number. |
Replay port | Alpha Replay port used to support replay flows. |
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, and ALL. |
The Output Flow Selection tab has the following parameters, all of which are check boxes. Each active check box specifies an output port for this adapter. There is no default, so you must select at least one output port.
Property | Description |
---|---|
Public Orderbook Flow | Delta-Change full order book view. |
Public Orderbook Flow Auction Event | This output is used to disseminate calculated indicative and final auction prices and imbalances for the public order book. |
Public Orderbook Flow State Change Event | This output indicates when the public order book is halted or a halt is lifted. |
Public Trade Flow | Public Trade ticker or report information. |
MBL L1 Flow | Market By Level and aggregated volume for the top of the book. |
MBL L1 Flow Auction Event | This output is used to disseminate calculated indicative and final auction prices and imbalances for the top of book. |
MBL L1 Flow State Change Event | This output indicates when the top of book is halted or a halt is lifted. |
MBL L2 Flow | Market By Level and aggregated volume for the top five levels. |
MBL L2 Flow Auction Event | This output is used to disseminate calculated indicative and final auction prices and imbalances for the top five levels. |
MBL L2 Flow State Change Event | This output indicates when the top five levels are halted or a halt is lifted. |
MBL Full Flow | Market By Level and aggregated volume for all levels. |
MBL Full Flow Auction Event | This output is used to disseminate calculated indicative and final auction prices and imbalances for all levels. |
MBL Full Flow State Change Event | This output indicates when any level is halted or a halt is lifted. |
The adapter has one to fourteen output ports, depending on your choices on the Output Flow selection tab. The Status port is always present, and is always the first port.
The Alpha EMAPI MDF Input Adapter, as well as the OE adapter, use a data type of double for prices. The underlying Alpha trading messages have price fields that are of type long and are scaled by divisor factors. The MDF adapter does all the scaling for converting from Alpha price data types to actual user prices.
Alpha also uses a scale factor for quantities, and again the StreamBase adapter does all the scaling for converting from Alpha quantity data types to actual user quantities.
-
Status: This port broadcasts basic adapter state transitions and related information. The schema of the status port is:
-
Type, string: The basic state reported, from the following list:
-
CONNECTION
-
SUBSCRIPTION
-
ERROR
-
-
Object, string: The EventFlow canvas name of the adapter reporting the status.
-
Action, string: The action that occurred, from the following list:
-
CONNECTED
-
DISCONNECTED
-
INITIALIZING
-
WAITINGREPLAYREQUEST
-
UNAVAILABLE
-
SUBSCRIBED
-
UNSUBSCRIBED
-
-
Message, string: A human-readable string that may provide additional context for the status message.
-
Time, timestamp: The time the action occurred.
-
-
PublicOrderBookFlow: This output port delivers the public view of a change to an order book :
-
ticker, string: A string representing the Alpha symbol.
-
flow, int: An integer representing the EmapiBroadcastFlows identifier.
-
sequenceStream, int: The sequence stream to which the data belongs.
-
sequenceNum, long: Logical timestamp.
-
businessSequenceStream, long: Business sequence number.
-
businessSequenceNum, long: The Alpha key that uniquely identifies the business stream to which the business sequence number belongs.
-
alphaTimeStamp, long: Alpha event timestamp as milliseconds since Jan 1 1970 UTC.
-
eventType, int: The type of event.
-
orderBook, long: The order book the order is bound for.
-
isBid, boolean:
true
if the order is a bid order,false
if it is an offer. -
allOrNone, boolean: True if the order is an All-Or-None.
-
publicOrderId, string: string The ID of the order on the Public flow, unique within the system and over time.
-
priority, long: Used to sort orders of the same price. Unique within the order book.
-
priorityGroup, int: Order priority group.
-
publicMember, string: The member information shown to the public. If unattributed order, it is set to 001.
-
publicOrderQty, long: The part of the order volume shown to other market participants.
-
price, double: The actual price of the order.
-
orderBookType, int: This attribute defines in what order book container the order resides (EmapiOrderBookTypes).
-
specialTerms, int: Indicates that the trades resulting from this order should be settled under particular, nonstandard settlement terms (EmapiSpecialTermsConditionTypes).
-
specialTermsData, string: string special settlement date if the
specialTerms
field is DELAYED_DELIVERY. The syntax for the date isyyyy-MM-dd
. -
sequenceIndicator, boolean: True if this event is part of a sequence of public order book events that are sent out as a result of the same triggering event (e.g. order insert, state change etc.).
-
-
PublicTradeFlow: This output port delivers the public view of trade events, and has the flowing schema:
-
ticker, string: A string representing the Alpha symbol.
-
flow, int: An integer representing the EmapiBroadcastFlows identifier.
-
sequenceStream, int: The sequence stream to which the data belongs.
-
sequenceNum, long: Logical timestamp.
-
businessSequenceStream, long: Business sequence number.
-
businessSequenceNum, long: The Alpha key that uniquely identifies the business stream to which the business sequence number belongs.
-
alphaTimeStamp, long: Alpha event timestamp as milliseconds since Jan 1 1970 UTC.
-
eventType, int: The type of event.
-
orderBook, long: The order book the order is bound for.
-
typeOfTrade, int: Type of trade event, indicating whether this is a new or a busted trade (EmapiTradeTypes).
-
subTypeOfTrade, int: Subtype of trade. Indicates if the trade occurred in an auction, in continuous matching, or resulted from a cross (EmapiSubTradeTypes).
-
timeOfTrade, string: Time of the trade. The format is
yyyy-MM-ddTHH:mm:ss.SSS
. -
tradeQty, long: Trade quantity.
-
lastAuctionPrice, double: Reflects the price of the last auction.
-
highPrice, double: Highest trade price for the current day.
-
lowPrice, double: Lowest trade price for the current day.
-
price, double: The price of the trade.
-
lastTradePrice, double: Set to the last sale price on Alpha marketplace for the tradeable instrument that the trade is for.
-
referencePrice, double: Reflects the price of the last trade.
-
specialTerms, int: Indicates that the trade will be settled under particular, non-standard settlement terms (EmapiSpecialTermsConditionTypes).
-
specialityPriceCrossType, int: Specialty price cross type (EmapiSpecialityPriceCrossTypes).
-
shortIndicator, int: Indicates whether the sell order has short sell properties (EmapiShortIndicatorTypes).
-
bidTradingMember, string: The trading member for the bid side. If the order responsible for the bid side is unattributed, then this field contains 001.
-
askTradingMember, string: The trading member for the ask side. If the order responsible for the ask side is unattributed, then this field contains 001.
-
bidPublicOrderId, string: The public order ID of the book order participating in the trade.
-
askPublicOrderId, string: The public order ID of the book order participating in the trade.
-
totalVolumeTraded, long: Total volume traded in this order book.
-
totalTurnover, long: Total turnover traded today in this order book.
-
buyOrderWasInBook, boolean: Set to TRUE if a buy order hit book before the trade occurred (that is, a corresponding Public Order message is to be expected). Set to FALSE if the order did not hit book before the trade occurred (that is, public order ID is synthetic and no corresponding Public Order message is to be expected).
-
sellOrderWasInBook, boolean: Set to TRUE if a sell order hit book before the trade occurred (that is, a corresponding Public Order message is to be expected). Set to FALSE if a sell order did not hit book before trade occurred (that is, public order ID is synthetic and no corresponding Public Order message is to be expected).
-
isInternalCross, boolean: This flag indicates that the cross is a trade between two accounts of the same client of the member.
-
isBypass, boolean: Bypass is true if the trade is the result of a bypass order or a bypass cross.
-
-
PublicOrderBookFlowAuction, MBL1FlowAuction, MBL2FlowAuction, MBLFullFlowAuction: During certain time periods preceding an auction as well as during the auction, EmapiAuctionEvent messages are disseminated on Public Order Book flow, L1, L2 and Full MBL flows. These messages are used to disseminate calculated indicative and final auction prices and imbalances. The schema for these four outputs is:
-
ticker, string:
-
flow, int:
-
sequenceStream, int: The sequence stream to which the data belongs.
-
sequenceNum, long: Logical timestamp.
-
businessSequenceStream, long: Business sequence number.
-
businessSequenceNum, long: The Alpha key that uniquely identifies the business stream to which the business sequence number belongs.
-
alphaTimeStamp, long: Alpha event timestamp as milliseconds since Jan 1 1970 UTC.
-
orderBook, long: The order book the order is bound for.
-
imbalance, long: The imbalance at the calculated auction matching price. The value is > 0 if there are buy orders that will not be filled, < 0 if there are sell orders.
-
matchedQuantity, long: The quantity matched at the calculated auction matching price.
-
calculatedAuctionPrice, double: Calculated auction matching price. The field represents a decimal value. A zero price means that there is no auction price available.
-
executionTime, string: This field is not used and will not be populated.
-
finalized, boolean: Flag indicating if the values for imbalance, matchedQuantity and calculatedAuctionPrice are finalized (TRUE) or indicative (FALSE).
-
auctionType, int: The auction type, indicating whether the auction is opening, closing, or post-halt (EmapiAuctionTypes).
-
-
PublicOrderBookFlowStateChange, MBL1FlowStateChange, MBL2FlowStateChange, MBLFullFlowStateChange: For each flow, a state change message is sent when the order book changes state, is halted, or a halt is lifted. The schema for these fours output ports is:
-
ticker, string:
-
flow, int:
-
sequenceStream, int: The sequence stream to which the data belongs.
-
sequenceNum, long: Logical timestamp.
-
businessSequenceStream, long: Business sequence number.
-
businessSequenceNum, long: The Alpha key that uniquely identifies the business stream to which the business sequence number belongs.
-
alphaTimeStamp, long: Alpha event timestamp as milliseconds since Jan 1 1970 UTC.
-
automatch, boolean: The order book is in Automatch state.
-
auction, boolean: Indicates whether the trading phase will end in an auction.
-
auctionType, integer: The Auction type, indicating whether the auction is opening, closing, or post-halt. (EmapiAuctionTypes).
-
orderbookTradingPhase, string: The current trading phase. Can be NULL if order book is halted.
-
orderbookObsolete, boolean: If this attribute is set to
true
, the contents of the Public order book are invalid and should be discarded. Any client application should make sure to empty their public order book in this case. -
tradeHaltEvent, integer: Type of trade halt event. This attribute is NULL if the order book is not halted (EmapiTradeHaltEventTypes).
-
tradeHaltType, integer: The type of trade halt. This attribute is NULL if it was no trade halt event (EmapiTradeHaltTypes).
-
tradeHaltReason, integer: The reason for the trade halt. This attribute is NULL if the order book is not halted (EmapiTradeHaltReasonTypes).
-
resumeTime, string: The planned time for resuming regular trading schedule after halt. The time is specified in the following 24 hour clock according to the ISO 8601 format.
YYYY-MM-DDThh:mm:ss.sTZD
(for example,1997-07-16T19:20:30.45+01:00
). -
orderBook, long: The order book that is affected by this state change.
-
-
MBL1Flow, MBL2Flow, MBLFullFlow: The schema for these three output ports is:
-
ticker, string:
-
orderBook, long: The order book the order is bound for.
-
levels, int: The maximum number of levels configured to be exposed.
-
priceData, list of tuples: Each tuple in the list has the price and volume information for a side and price level in the order book. The tuple's schema is:
-
operation, int: Type of operation: ADD, DELETE, UPDATE
-
price, double: Price.
-
quantity, long: Aggregated volume.
-
isBid, boolean: True if the order is a Bid order, false if it is an Offer.
-
numberOfOrders, integer: Number of orders at this level.
-
-
If you select the Replay option, an input port is added to the adapter. This port is used to control replay behavior for those flows that support Replay. Alpha supports Replay on the following flows:
-
Public Order Book Flow
-
Public Trade Flow
When Replay is selected, the StreamBase application is responsible for sending zero or more replayflow
commands to the adapter. These commands must contain the sequenceNum
PLUS ONE of each flow-sequenceStream pair that has been delivered to the application in the current trading day. After all
replayflow
commands have been sent, the application must send a connect
command. Until the connect
command is received, the adapter does not attempt to connect to the Alpha server. If there are no previous flows for the
day — for example, at the beginning of the day — just sending a connect
command causes Alpha to replay any messages it has from the beginning of the day.
The Alpha EMAPI MDF sample has a simple implementation of the logic needed to support the Replay option where no messages are lost and none are repeated. The sample's logic shows how to handle two cases: when the StreamBase application is restarted, and when the application stays up but the connection to the Alpha server is interrupted.
-
ReplayControl: This input port is used to control the Replay flows, and has the following schema:
-
command, string: The action to be performed. One of:
-
replayflow
— the flow, sequenceStream, and sequenceNum fields contain replay request parameters. -
connect
— after allreplayflow
requests have been made, the connect command begins the process of connecting to Alpha server.
-
-
flow, int: The Alpha EmapiBroadcastFlows enumeration. This field is provided in all outputs.
-
sequenceStream, int: The Alpha sequence stream number. This field is provided in all outputs.
-
sequenceNum, long: The Alpha sequence number for the flow/sequenceStream pair; this field is provided for all outputs
-
The Alpha MDF adapter can provide access to a configured number of Alpha message flows. If neither the Snapshot nor Replay options are selected, real time messages are delivered. Selecting Snapshot subscriptions causes all current values for the selected symbols to be received, followed by real time messages.
If Replay is selected, an input port is added to the adapter. See the input port description above for further information.
As with other StreamBase adapters and operators, you can optionally enable an Error Output Port, as described in Using Error Ports and Error Streams.
Add an instance of the adapter to a new StreamBase EventFlow application as follows:
-
In StreamBase Studio, create a project, including an empty StreamBase EventFlow application file to host the adapter.
-
From the Operators and Adapter drawer of the Palette view, drag an Alpha EMAPI MDF adapter component to the canvas.
-
Select the Alpha EMAPI MDF icon on the canvas and select the Adapter Properties tab in the Properties view. Provide the required parameters to connect to your site's Alpha connection.
-
Select the Output Flow tab and chose the flows you are interested in.
-
Connect Output Streams to the adapters' output ports.
The Alpha EMAPI MDF 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.
-
An inconsistent set of parameters is selected.
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 Alpha Trading System server.
-
The adapter incurs an error emitting a tuple.
-
The adapter adapter is suspended or resumed.
When suspended, the adapter continues to receive and process Alpha Trading System messages, but no longer emits tuples on its output ports.
When resumed, the adapter once again starts emitting tuples on its output ports.