Capital Markets Adapters 10.11 | Apama Capital Markets Adapters Documentation 10.11 | Apama Base FIX Adapter | FIX service monitors | Client session | FIX_SubscriptionManager | Subscribing/unsubscribing
 
Subscribing/unsubscribing
A subscription is created by issuing a com.apama.marketdata.SubscribeDepth/Tick event specifying the following inputs:
Input
Description
Symbol
The instrument (as defined by the exchange)
ServiceId
"FIX"
Market
The session (that is, transport) to use
extraParams
Any extra parameters to be sent with the request (Note, genuine FIX field names will be automatically translated to their integer tag equivalent)
The subscription manager supports market data through the following FIX mechanisms:
*MarketDataRequest - A com.apama.marketedata.SubscribeDepth/Tick event will be converted into this type of request by default.
*RequestForQuote - Can be issued instead by setting the extra parameter Quote=Y. (Note, only a continuous stream of replacement quotes and MassQuotes is supported currently).
The resultant market data updates (or quote stream events) that are generated as a result of the subscription request are converted into com.apama.marketdata.Depth and com.apama.marketdata.Tick events and routed. Note, each subscription maintains a reference count which is simply incremented for duplicate requests (same symbol + extra parameters) rather than issuing another request to the exchange.
To stop (and completely remove) a subscription, a com.apama.marketdata.UnsubscribeDepth/Tick event must be routed. This will be translated into the equivalent FIX request and sent to the exchange providing the reference count for the subscription is at zero otherwise the count is reduced.
Extra parameters
As discussed in Event mappings, any FIX tags which are received from an exchange but are not mapped as top level fields in the event mapping are automatically copied to extra parameters. Since FIX market data messages are composed of a series of repeating entries, the subscription manager associates each parameter with its side and depth level using the following format:
(<SIDE><LEVEL>_<NAME>=<VALUE>)
For example:
"ASK1_Currency=EUR;ASK1_MDEntryOriginator=Bank3;ASK2_Currency=EUR;
ASK2_MDEntryOriginator=Bank1;BID1_Currency=EUR;
BID1_MDEntryOriginator=Bank3"
Note, standard FIX tag numbers will be translated to their field names. Where this is not possible (such as for custom tags), the tag will be output as is. For example:
"ASK1_9001=12.0;ASK2_9002=foo"
Subscription errors
The FIX adapter does not use the com.apama.marketdata.DepthSubscriptionError or com.apama.marketdata.TickSubscriptionError events to notify clients of a problem with the data stream. Instead, a com.apama.marketdata.Depth and/or com.apama.marketdata.Tick is issued with _ERROR and _FAULT set in the extra parameters.
You can use "_ERROR" to get the error message (corresponds to DepthSubscriptionError.status or TickSubscriptionError.status).
"_FAULT" indicates the status of the subscription (corresponds to DepthSubscriptionError.fault or TickSubscriptionError.fault).
Using Depth and Tick events instead of DepthSubscriptionError/TickSubscriptionError allows multiple subscriptions to the same symbol (with differing extra parameters) to be maintained.