Apama Capital Markets Foundation
10.7.0.0
|
The Market Data Library provides the interfaces for market data management and publishing.
The Market Data Library communicates with your adapter via the AP_MDM_AdapterInterface structure. You must initialize an AP_MDM_AdapterInterface structure with working functions before the library is initialized.
The Market Data Library is initialized by a call to AP_MDM_Init() in the event transport constructor of the adapter, where you provide an AP_MDM_AdapterInterface, a pointer to the transport internals and an AP_SESSION_Interface that this Market Data Interface will run on. This will initialize a AP_MDM_Interface which is then used in all subsequent Market Data API calls. During the event transport destructor, call AP_MDM_DeInit().
Once a user has found and connected to a Session in the correlator, it will attempt a subscription to a specific datastream type and symbol. The Market Data library will extract the control parameters, datastream type and symbol and call AP_MDM_AdapterInterface::getKey where the adapter should generate a unique subscription key. If this a new subscription key, the library will then call AP_MDM_AdapterInterface::connect where the adapter should subscribe to the symbol on the external datasource. If this external subscription is successful, call AP_MDM_ConnectSuccess(), else call AP_MDM_ConnectFailed() with a description on why it failed.
When a user no longer requires a subscription, it will attempt a disconnect and the library will call AP_MDM_AdapterInterface::disconnect and the adapter should attempt to unsubscribe the symbol from the external datasource. If this unsubscription succeeds, call AP_MDM_DisconnectSuccess(), else call AP_MDM_DisconnectFailed() with a description on why it failed.
By default, the Market Data Library can process these control parameters:-
Parameter | Description | Type | Allowed Values | Default |
---|---|---|---|---|
TRANSFER_MODE | The mode which updates are sent | string | 'COMPOUND_DELTA' or 'SNAPSHOT_ONLY' | 'COMPOUND_DELTA' |
NUM_LEVELS | The maximum number of levels a book data type will send (applies to Depth, Orderbook and Quotebook) | integer | - | 5 |
DISABLE_EP | Whether to disable Extra Parameter output | boolean | true/false | false |
INCLUDE_INDICATIVE_PRICES | Whether to include indicative prices in the Quotebook | boolean | true/false | true |
But an adapter can add there own control parameters which they can process and store on connect/disconnect.
Once a subscription is made to a symbol on the external datasource, market data updates should be processed and normalized by the adapter. This data is then set in the Market Data Library using the following APIs, dependent on the datastream type the subscription was for.
Type | Description | API |
---|---|---|
STREAMTYPE_BBA | Best Bid and Ask | BBA Processing API |
STREAMTYPE_TRADE | Trade | Trade Processing API |
STREAMTYPE_MBP | Market by Price / Depth | Depth Processing API |
STREAMTYPE_MBO | Market by Order / Orderbook | Orderbook Processing API |
STREAMTYPE_QUOTEBOOK | Quotebook | Quotebook Processing API |
STREAMTYPE_NEWS | News | News Processing API |
STREAMTYPE_EP | Extra Parameters | Extra Params Processing API |
Market Data that cannot be normalized should be added as an "Extra Parameter" using the Extra Params Processing API. This is a key:value string dictionary to allow any format of data to be sent into the correlator.
When an update from the external datasource has been fully processed and the relevant Market Data API calls made, the data then needs to be committed to the data store using one of the commit API calls. This will cause the library to process the data, detect any differences, construct an event of the differences and send the event to the correlator.