Alpha Trading Systems EMAPI Order Entry Adapter

This adapter is part of the TIBCO StreamBase CEP Connectivity Package.

Introduction

The TIBCO StreamBase® Adapter for Alpha EMAPI Order Entry allows a StreamBase application to submit trade requests to the Alpha Trading System venue. The adapter appears as two icons on the EventFlow canvas in StreamBase Studio: an output adapter for sending orders, and an input adapter for receiving order status updates from the venue.

The two icons share a single connection to the Alpha Trading System, which is configured through the input adapter. The currently supported Alpha EMAPI version is V4.5.

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 input adapter's Properties view. A single global ID entered in both adapters' Properties views binds the input and output adapters. There must be exactly one input and one output Alpha Trading System EMAPI OE in an application.

The input adapter icon has a single input port from submitting command requests and six output ports for status events and private order book changes. The output adapter icon has one input port for submitting order entries and one output port for order entry responses.

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.

Adapter Properties

The Alpha Trading System input adapter has the following parameters in its Properties view:

Property Description
Alpha OE Pair ID An identification string that associates an Alpha Trading System input and output adapter.
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.
Symbols A comma-separated list of symbols to subscribe to. Enter _ALL_ to subscribe to all symbols in the view.
Snapshot Subscription If checked, flows that support snapshots are subscribed to with this feature.
Command Port If checked, the Input adapter has a input port that can be used to control the connection to the Alpha Trading System.
EMAPI Login Flag The integer flag value supplied in the Login Request to Alpha.
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 Alpha Trading System output adapter has the following parameter in its Properties view:

Property Description
Alpha OE Pair ID An identification string that associates an Alpha Trading System input and output adapter.

Using the Adapter in a StreamBase Application

Both input and output icons are required to communicate with the Alpha OE trading system.

Each icon 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.

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 an AlphaEMAPIOE input component to the canvas.

  3. From the Operators and Adapter drawer, drag an AlphaEMAPIOE output component to the canvas.

  4. Select the AlphaEMAPIOE input adapter icon, and in the Properties view, select the Adapter Properties tab.

  5. Enter a Alpha OE pair ID used to bind the Alpha EMAPI input and output adapters.

  6. Enter the remaining required parameters.

  7. Select the Alpha EMAPI output adapter icon, and in the Properties view, select the Adapter Settings tab.

  8. Enter the same Global ID as used for the input adapter above.

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

  10. Configure the schemas of the input streams with the fields listed in the sections below that describe market data and trade adapter input ports. Note that the adapter generates typecheck errors when the input streams are missing required fields, when unexpected fields are present, or when fields are of the wrong type.

Adapter Port Schemas

Some terms in this section reference terms and structures in the Alpha EMAPI documentation. For example, an schema's int field might be described as an enumeration of EmapiDiscretionaryConditionTypes. Consult the Alpha EMAPI documentation to resolve these terms.

Alpha Order Entry Input Adapter - Input Port

The Alpha EMAPI OE Input Adapter has one optional input port, which is enabled with the Command Port property setting.

By setting the reconnect interval to zero and using the command input port stream, the StreamBase application can control when the adapter connects to and disconnects from the Alpha Trading System.

The schema of the command input port is:

  • command, string: The command being requested, from the following list:

    • CONNECT. If not already connected, perform a single connection attempt.

    • DISCONNECT. If connected, issue an immediate disconnect.

Alpha Order Entry Input Adapter - Output Ports

The Alpha Order Entry Input Adapter has six output ports.

The Alpha EMAPI OE Input Adapter, as well as the MDF 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 adapter does all the scaling, and if necessary rounding, for converting from user supplied actual prices to price fields used by Alpha. Similarly, Alpha price fields are scaled/converted to a double data type for user actual prices.

For input prices, the scaling/rounding is done by:

AlphaPrice=Math.round(UserSuppliedPrice * EMAPIPriceMultiplier)

So with a EMAPIPriceMultiplier of 1000000, a user supplied price of 39.99999999 would be rounded to a Alpha Trading price of 40000000.

Alpha also uses a scale factor for quantities, and again the StreamBase adapter does all the scaling for converting to/from user supplied actual volumes and volume fields used by Alpha.

Output Port 1, Status

This port is used to broadcast basic adapter state transitions and related information. The status port's schema is:

  • Type, string: The basic state being reported on:

    • CONNECTION

    • SUBSCRIPTION

    • ERROR

  • Object, string: The canvas name of the adapter reporting the status

  • Action, string: What action has occurred:

    • CONNECTED

    • DISCONNECTED

    • INITIALIZING

    • UNAVAILABLE

    • SUBSCRIBED

    • UNSUBSCRIBED

  • Message, string: A human readable string that may provide additional context for the status

  • Time, timestamp: The time the action occurred.

Output Port 2, PrivateOrderBookFlow, Output Port 5, PrivateTTMOrderFlow

These output ports reflect a change to a private order and Trade Through Manager order respectively. The schema for both ports is:

  • symbol, string: A string representing the Alpha symbol.

  • 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.

  • discretionaryCondition, int: (EmapiDiscretionaryConditionTypes) The discretionary condition defines whether and how this order offers discretionary pricing.

  • discretionaryOffsetTicks, int: This defines the offset to the base price, specified as a number of ticks. It is used to calculate the discretionary price.

  • minVolCondition, int: (EmapiMinimumVolumeConditionTypes) Determines whether there is a minimum volume condition and how it should be applied.

  • triggerCondition, int: (EmapiTriggerConditionTypes) If present, this order is a trigger order.

  • validFrom, int: (EmapiValidFromTypes) Valid From type.

  • validTill, int: (EmapiValidTillTypes) Valid Till type.

  • minimumQty, long: The minimum quantity that this order may match. Setting this field to the same value as the total volume is the same as an AON order. If the minimumVolumeCondition is NONE, then this field must contain 0. If the minimumVolumeCondition is not NONE, this field must contain a value larger than the Round Lot.

  • orderQty, long: Order volume available for matching, but can be negative after an update if decreased with more than the current quantity. When updating an order this field is always interpreted as a relative value.

  • orderQtyOpen, long: This indicates how much of orderQty that should be shown publicly. An Iceberg order is accomplished by supplying an orderQtyOpen value smaller than orderQty. If orderQtyOpen is not set, the system assumes that the entire orderQty is open. This field is set by the client who entered the order.

  • triggerPrice, double: If this order is a Stop-Loss or other trigger order, this is the trigger price of the order. The field represents a decimal value. The decimal value is derived by dividing this field with the constant.

  • infoText, string: Used at the discretion of the client application. There is no recommended usage for this field, and it can be used for any purpose. This data is a pure pass-through from the trading system point of view.

  • orderRef, string: Used at the discretion of the client application. The recommended usage for this field is to include end user data. This data is a pure pass-through from a trading system point of view.

  • account, string: Used at the discretion of the client application. The recommended usage for this field is to include account data. This data is a pure pass-through from the trading system point of view.

  • validTillData, string: Parameter whose value depends on type of ValidTill condition.

  • isValidForTrading, boolean: If false, the order is not currently valid for trading. For example, an untriggered stop order has isValidForTrading set to false.

  • sourceOfEvent, int: (EmapiSourceOfEventTypes) The source of the event.

  • orgOrderQty, long: The original quantity of the order. This field is only changed if the member explicitly updates the order.

  • user, string: The trader responsible for the order.

  • member, string: The member to which the order belongs.

  • tradingMember, string: The trading member through which the member trades.

  • clearingMember, string: The member that will clear any executions deriving from this request.

  • privateOrderId, string: Generated automatically by the system. Unique within the system and over time.

  • timeOfModification, string: Changed whenever the order is modified in any way. This includes explicit modifications by the client as well as system-initiated modification (typically a match). The format is yyyy-MMddTHH:mm:ss.SSS.

  • eventSubType, int: (EmapiOrderEventSubTypes) Type of sub event.

  • eventType, int: (EmapiOrderEventTypes) Type of event.

  • isBid, boolean: True if the order is a bid order, false if it is an offer.

  • price, double: The price of the order.

  • shortIndicator, int: (EmapiShortIndicatorTypes) Indicates whether the sell side of the cross is short or short exempt.

  • ownerType, int: (EmapiOwnerTypes) Owner type.

  • orderBook, long: Order book ID to which the message applies.

  • actualPrice, double: The actual price of the order. This field is set by the trading system to be the price used in matching. The actual price differs from the price for market and peg orders. For market order this price is zero.

  • priority, long: Used to sort orders of the same price. Unique within the order book.

  • priorityGroup, int: Order priority group.

  • publicOrderQty, long: The part of the order volume that is shown to other market participants.

  • timeOfEntry, string: Time of entry, set by the system when the order is inserted. Note that the field is changed if the order is cancelled and then re-inserted on the public flow, such as when the open volume is refilled. The format is yyyy-MMddTHH:mm:ss.SSS.

  • publicOrderId, string: The ID of the order on the public flow, unique within the system and over time.

  • tradeId, string: If the order event was caused by a trade, then this field contains the ID of the trade.

  • ttmFlag, boolean: This flag indicates whether the order could be sent to the TTM or not.

  • attributed, boolean: True means that the member is disclosed on the public order and trade messages.

  • programTrade, boolean: This flag indicates whether the order offsets a transaction in derivatives.

  • jitneyMember, string: This field indicates whether the order is on behalf of another member.

  • regulationId, string: (EmapiRegulationIdTypes) Type of regulation ID.

  • insideMatchPercentage, int: Used when the trigger condition is INSIDE_MATCH to calculate the price limits. The valid range is 10, 20, 30, 40, 50, 60, 70, 80, and 90.

  • specialTerms, int: (EmapiSpecialTermsConditionTypes) Indicates that the trades resulting from this order should be settled under particular, non-standard settlement terms.

  • specialTermsData, string: Special settlement date if the specialTerms field is DELAYED_DELIVERY. The syntax for the date is yyyy-MM-dd.

  • orderBookType, character (EmapiOrderBookTypes) Identifies the type of order book that the order resides in.

  • parentOrderId, string: If this is a child order on the order router order flow, this attribute contains the ID of the order's parent.

  • marketBbo, tuple with schema EmapiMarketBbo, as defined in the Alpha EMAPI documentation. See the sample for this adapter or the EMAPI documentation for the structure of this tuple. Holds parent order events on the order router order flow, and contains the market BBO that was used in the routing decision.

  • awayOrderMarketPlace, string: Used if the order was traded outside Alpha.

  • actingUser, string: User whose action caused the order to be updated.

  • isBypass, boolean: Bypass is true for order book events for bypass orders.

  • isRouteOutClose, boolean: Order is managed by the Alpha Order Router.

  • actionComment, string: Filled in by TRADExpress to communicate the reason for the action.

  • cancelOnLogout, boolean: Indicates if the order will be cancelled upon client disconnect.

  • passiveOnly, boolean: Set to true for order book events for a Passive Only order.

  • visibility, int: Indicates if order is Dark or Transparent: If set to DARK, priceCondition must be set to PEG_BEST_BID or PEG_BEST_OFFER. If not set, default is TRANSPARENT.

  • pegOffsetType, int: For pegged orders, indicates the peg offset type. Required if priceCondition is set to PEG_BEST_BID or PEG_BEST_OFFER. Must be set to PERCENT Dark Orders.

  • pegOffset, int: Allowed only for Dark Orders. Set as percentage of NBBO spread with allowed values of: 10, 20, 30, 40, 50, 60, 70, 80, and 90. Bid Dark Order is pegged to NBB + pegOffset. Ask Dark Order is pegged to NBO – pegOffset. Required if priceCondition is set PEG_BEST_BID or PEG_BEST_OFFER.

  • seekDarkLiquidity, boolean: This flag indicates whether the order seeks match with Dark order(s) or not.

  • routingInstruction, int: Value defines routing instruction for the order. Can only be set if ttmFlag = TRUE

  • selfTradeKey, int: Used at the discretion of the client application. Indicates that if the order trades with an order including same selfTradeKey from same Subscriber, the trade will be suppressed from public trade flow.

  • seekUCrossPassive, boolean: Specifies whether the order is a Seek uCross Passive Order (SUP).

  • isUCrossPassive, boolean: Specifies whether the order is a uCross Passive Order (UP).

  • NCIB, boolean: Indicates that order is a Normal Course Issuer Bid

  • protectionType, int: Describes the type of protection assigned to the order to prevent locking/crossing or trading through:

    • 1: Protect Cancel

    • 2: Protect Reprice

  • contraOrderTypeMatchingPreference, int: The type of contra orders that a Dark order will trade against:

    • 1: SDL orders only (Default)

    • 2: Other Dark orders only

    • 3: Both SDL and Dark orders

  • shortMarkingExempt, int: Order designation type indicating that an order is being entered by an account that is exempt from marking an order as "short" (i.e. "short-marking exempt"):

    • o: SME order

    • 1: Buy side of a cross is SME order

    • 2: Sell side of a cross is SME order

    • 3: Both sides of the cross are SME orders

Output Port 3, OrderBookStateChange

A state change message is sent when the order book changes state, is halted, or a halt is lifted. The schema 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 if 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.

  • 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.

Output Port 4, PrivateTradeFlow, Output Port 6, PrivateTTMTradeFlow

These output ports reflect private trade events for the trade participant member. The schema for both ports is:

  • symbol, string: A string representing the Alpha symbol.

  • 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 in which the trade occurred.

  • typeOfTrade, int: (EmapiTradeTypes) Type of trade event, indicating whether this is a new or a busted trade.

  • subTypeOfTrade, int: (EmapiSubTradeTypes) Subtype of trade. Indicates if the trade occurred in an auction, in continuous matching, or resulted from a cross.

  • timeOfTrade, string: Time of trade. The format is yyyy-MM-ddTHH:mm:ss.SSS.

  • tradeQty, long: Trade volume.

  • price, double: The price of the trade.

  • tradeId, string: An ID is assigned to each individual trade. This ID is guaranteed to be unique within the system and over time.

  • dealId, string: An ID is assigned to each deal. A deal is defined as all trades generated by a single event. For example, an event is an incoming order or an uncross. Thus, all trades resulting from the same event will have the same deal number. This ID is guaranteed to be unique.

  • isAggressor, boolean: True when the owned side was the active one. That is, the incoming order.

  • isBid, boolean: True if the trade is a bid one. That is, the member is owner of the bid side order. Otherwise false. Note that if a Member is trading with himself (an internal trade), then two private trades are received, one with the isBid field set to True and one where the isBid is set to False.

  • auctionType, int: (EmapiAuctionTypes) The auction type, indicating whether the auction is opening, closing, or post-halt.

  • referenceTradeId, string: Optional trade ID referring to an associated trade. This ID can be used to tie related trades together, such as to connect a busted trade with its replacement trade.

  • ownMember, string: The member responsible for our own side of the execution.

  • ownUser, string: The user responsible for our own side of the execution.

  • ownActingUser, string: The gateway user responsible for own side of the execution.

  • ownTradingMember, string: The trading member responsible for own side of the execution.

  • ownClearingMember, string: The member that will clear the execution for our own side.

  • ownAccount, string: Included on EmapiPrivateTradeEvent if originally included on the order insert or update.

  • counterpartyTradingMember, string: The trading member responsible for the counterparty side of the execution. If the order on the other side of the execution was unattributed, then this field contains 001.

  • ownPrivateOrderId, string: ID of member's own order that participated in this trade on the side specified by isBid.

  • orderBookType character (EmapiOrderBookTypes) Identifies the type of the order book in which the trade occurred.

  • specialityPriceCrossType integer(EmapiSpecialityPriceCrossTypes) If trade resulted from a specialty price cross, indicates the type of the cross.

  • specialTerms, int: (EmapiSpecialTermsConditionTypes)Indicates that the trade will be settled under particular, nonstandard settlement terms.

  • settlementDate, string: Indicates the settlement date for the trade. The format is yyyy-MM.

  • shortIndicator, int: (EmapiShortIndicatorTypes) Indicates whether the sell order has short sell properties.

  • ownOwnerType, int: (EmapiOwnerTypes) Own account type.

  • orderbookTradingPhase, string: The trading phase the book was in when execution took place. Note this field may be NULL when for example an auction occurs, the trade results from a trade report or the trade occurred on an away market.

  • marketPlace, string: (EmapiMarketMicCodes) The marketplace where the execution took place.

  • ownMessageRef, string: Included on EmapiPrivateTradeEvent if originally included on the order insert or update.

  • ownOrderRef, string: Included on EmapiPrivateTradeEvent if originally included on the order insert or update.

  • regulationId, string: (EmapiRegulationIdTypes) Included on EmapiPrivateTradeEvent if originally included on the order insert or update.

  • ownInfoText, string: Included on EmapiPrivateTradeEvent if originally included on the order insert or update.

  • programTrade, boolean: Included on EmapiPrivateTradeEvent if originally included on the order insert or update.

  • programTrade, boolean: Included on EmapiPrivateTradeEvent if originally included on the order insert or update.

  • tradingFee, double: The trading fee.

  • isPrincipalTrade, boolean: This field will be set to true if the trade has owner type values of client on one side and house or non-client on the other.

  • isTtm, boolean: Is true if the trade originates from a TTM order.

  • isBypass, boolean: Bypass is true if the trade is the result of a bypass order or a bypass cross.

  • isRouteOutClose, boolean: The trade is a route out closing trade.

  • selfTradeKey, string: Option key used for self trade matching.

  • isSelfTrade, boolean: Is true if the trade is a self trade within the same trading member.

  • seekUCrossPassive, boolean: Specifies whether the order is a Seek uCross Passive Order (SUP).

  • isUCrossPassive, boolean: Specifies whether the order is a uCross Passive Order (UP).

  • NCIB, boolean: Indicates that order is a Normal Course Issuer Bid

  • matchingPriority, string: Indicates the type of priority used to match the order in a trade. Currently, the only value used is BROKER.

  • shortMarkingExempt, int: Order designation type indicating that an order is being entered by an account that is exempt from marking an order as "short" (i.e. "short-marking exempt"):

    • o: SME order

    • 1: Buy side of a cross is SME order

    • 2: Sell side of a cross is SME order

    • 3: Both sides of the cross are SME orders

Alpha Order Entry Output Adapter - Input Port

The output adapter has a single input port used to insert, update, or cancel orders. The schema is:

  • BuyOrders: This input is used to issue buy orders.

    • action, string: The action to perform from insert, update, or cancel.

    • possDup, boolean: The possible duplicate flag.

    • orderBook, long: The order book the order belongs to.

    • user, string: The trader responsible for the order.

    • clearingMember, string: The member that will clear any executions deriving from this request. This field is optional. If no clearingMember is supplied, the system applies the default clearing member for the user in question. If a clearing member is supplied, then it must be a valid clearing member within Alpha.

    • isBid, boolean: True if the order is a bid order, false if it is an offer.

    • price, double: The price of the order.

    • shortIndicator, int: (EmapiShortIndicatorTypes) Indicates whether the order has short sell properties.

    • priceCondition, int: (EmapiPriceConditionTypes) Determines how the order is priced.

    • ownerType, int: (EmapiOwnerTypes) Account type.

    • orderQty, long: Order volume available for matching. This field is always interpreted as a relative value.

    • orderQtyOpen, long: This indicates how much of orderQty that should be shown publicly. An Iceberg order is accomplished by supplying an orderQtyOpen value smaller than orderQty. If orderQtyOpen is not set, the system assumes that the entire orderQty is open. This field is set by the client that entered the order. This field is always interpreted as an absolute value.

    • messageRef, string: Used at the discretion of the client application. The usage of this field is that the application assigns some sort of ID that is used to identify the message on the Private flow. This data is echoed back on Private order and trade messages and is not otherwise processed by Alpha.

    • orderRef, string: Used at the discretion of the client application. The recommended usage for this field is to include end user data. This data is echoed back on Private order and trade messages and is not otherwise processed by Alpha.

    • account, string: Used at the discretion of the client application. The recommended usage for this field is to include account data. This data is echoed back on Private order and trade messages and is not otherwise processed by Alpha.

    • infoText, string: Used at the discretion of the client application. There is no recommended usage for this field, which can be used for any purpose. This data is echoed back on Private order and trade messages and is not otherwise processed by Alpha.

    • triggerPrice, double: If this order is an on-stop or other trigger order, this is the trigger of the order.

    • validFrom, int: (EmapiValidFromTypes) Valid From constants.

    • triggerCondition, int: (EmapiTriggerConditionTypes) If present, this order is a trigger order. Used for identifying on-stop orders.

    • validTill, int: (EmapiValidTillTypes) Valid Till constant.

    • discretionaryCondition, int: (EmapiDiscretionaryConditionTypes) The discretionary condition defines if, and how, this order offers discretionary pricing. Used for identifying Price Improvement Iceberg Orders.

    • discretionaryOffsetTicks, int: This defines the offset to the base price, specified as a number ticks. It is used to calculate the discretionary price.

    • minimumVolumeCondition, int: (EmapiMinimumVolumeConditionTypes) Determines if there is a minimum volume condition and how it should be applied.

    • minimumQty, long: The minimum quantity that order may match. Setting this field to the same value as the total volume is the same as an AON order. If an AON order is updated, then orderQty contains a relative value and this field contains the new total quantity. This field is always interpreted as absolute value. If the minimumVolumeCondition is NONE, then this field must 0. If the minimumVolumeCondition is not NONE, this field must contain a value that is larger than the Round Lot.

    • ttmFlag, boolean: This flag indicates whether the order should be sent to the TTM ornot.

    • attributed, boolean: True means that the member disclosed on the Public order and trade messages.

    • programTrade, boolean: This flag indicates whether the order offsets a transaction in derivatives.

    • jitneyMember, string: If the order is entered through a Jitney arrangement, indicates the member that the order was on behalf of. This must be a valid member in Alpha.

    • regulationId, string: (EmapiRegulationIdTypes) Type of regulation ID.

    • insideMatchPercentage, int: Used when the trigger condition is INSIDE_MATCH to calculate the price limits. The valid range is 10, 20, 30, 40, 50, 60, 70, 80 and 90. The price limit for a buy inside match order will be calculated as Price = Best Bid + (Best Ask - Best Bid) * insideMatchPercentage/100. The price limit for a sell inside match order will be calculated asPrice = Best Ask - (Best Ask - Best Bid) * insideMatchPercentage/100.

    • specialTerms, int: Indicates that the trades resulting from this order should be settled under particular, non- settlement terms.

    • isBypass, boolean: FOK/FAK order tradeable only against disclosed order volume.

    • privateOderId, string: The alpha assigned private order ID returned from an order ADD.

    • passiveOnly, boolean: Indicates a Passive Only order.

    • cancelOnLogout, boolean: Indicates the order should be cancelled upon client disconnect.

    • isRouteOutClose, boolean: Order should be managed by the Alpha Order Router.

    • visibility, int: Indicates if order is Dark or Transparent: If set to DARK, priceCondition must be set to PEG_BEST_BID or PEG_BEST_OFFER. If not set, default is TRANSPARENT.

    • pegOffsetType, int: For pegged orders, indicates the peg offset type. Required if priceCondition is set to PEG_BEST_BID or PEG_BEST_OFFER. Must be set to PERCENT Dark Orders.

    • pegOffset, int: Allowed only for Dark Orders. Set as percentage of NBBO spread with allowed values of: 10, 20, 30, 40, 50, 60, 70, 80, and 90. Bid Dark Order is pegged to NBB + pegOffset. Ask Dark Order is pegged to NBO – pegOffset. Required if priceCondition is set PEG_BEST_BID or PEG_BEST_OFFER.

    • seekDarkLiquidity, boolean: This flag indicates whether the order seeks match with Dark order(s) or not.

    • routingInstruction, int: Value defines routing instruction for the order. Can only be set if ttmFlag = TRUE

    • selfTradeKey, int: Used at the discretion of the client application. Indicates that if the order trades with an order including same selfTradeKey from same Subscriber, the trade will be suppressed from public trade flow.

    • seekUCrossPassive, boolean: Indicates SUP order.

    • isUCrossPassive, boolean: Specifies that the order is a uCross Passive Order (UP).

    • NCIB, boolean: Indicates if order is a Normal Course Issuer Bid.

    • protectionType, int: Describes the type of protection assigned to the order to prevent locking/crossing or trading through:

      • 1: Protect Cancel

      • 2: Protect Reprice

    • contraOrderTypeMatchingPreference, int: The type of contra orders that a Dark order will trade against:

      • 1: SDL orders only (Default)

      • 2: Other Dark orders only

      • 3: Both SDL and Dark orders

    • shortMarkingExempt, int: Order designation type indicating that an order is being entered by an account that is exempt from marking an order as "short" (i.e. "short-marking exempt"):

      • o: SME order

      • 1: Buy side of a cross is SME order

      • 2: Sell side of a cross is SME order

      • 3: Both sides of the cross are SME orders

Alpha Order Entry Output Adapter - Output Ports

The output adapter has two outputs. The Status output will emit tuples for various error conditions. The ResponseOut output wil emit the response from an input request.

Output Port 1, Status

This port is used to signal error conditions, especially when the error condition prevents the normal ResponseOut from being available. The status port's schema is:

  • Type, string: The basic state being reported on:

    • CONNECTION

    • SUBSCRIPTION

    • ERROR

  • Object, string: The canvas name of the adapter reporting the status

  • Action, string: What action has occurred:

    • DISCONNECTED

    • INITIALIZING

    • UNAVAILABLE

    • UNSUBSCRIBED

  • Message, string: A human readable string that may provide additional context for the status

  • Time, timestamp: The time the action occurred.

  • Output Port 2 ResponseOut: This output port provides the response to the input request.

    • responseType, string: The action this message is in response to: Order, Update, or Cancel.

    • statusCode, int: EMAPI status code.

    • statusMessage, string: Status text associated with the EMAPI status code returned.

    • internalCode, int: Internal status code from the trading system.

    • transactionId, string: Unique transaction ID returned from the trading system.

    • timestamp, long: Response timestamp as milliseconds since Jan 1 1970 UTC.

    • quantityCancelled, long: The remaining quantity of the order before applying the cancel.

    • remainingQuantity, long: The remaining quantity after insertion of the order. If the order trades fully or partially upon entry, then the quantity remaining after the trade is returned.

    • privateOrderId, string: The order ID of the order request.

    • inputTuple, tuple: A copy of the input order tuple.

Typechecking and Error Handling

The Alpha EMAPI adapters use 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 such as the TAX Server name, or Global ID, is missing.

  • 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 Alpha Trading System.

  • 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 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.

Related Topics