Apama 10.3 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Market Data Management | Synthetic datasources | Forward to Spot Convertor | Creating a market data manager
 
Creating a market data manager
Once the source has been created, call the startSession action to get the underlying MDManagerInterface which can then be used to query and create specific datastream managers.
action startSession(com.apama.session.SessionStart sStr,
action<integer> onSuccess, action<integer,string> onFailure) {
com.apama.md.user.MDManagerInterface underlyingMDManager :=
sourceHelper.getUnderlyingMDMangerForSessionId(
underlyingSession.getSessionId());
}
You can query the MDManagerInterface for the availability of required datastream and if available, use the relevant datastream manager to access it. The following is a list of the available actions for the built-in datastream types relevant to FTSC:
*hasDepth(), createDepthManager()
*hasOrderbook(), createOrderbookManager()
*hasBBA(), createBBAManager()
*hasTrade(), createTradeManager()
For example, to access the BBA datastream, the following code would be required in order to obtain the relevant manager.
if underlyingMDManager.hasBBA() then {
underlyingBBAIFace := underlyingMDManager.createBBAManager();
conData.add(localConsts.BBA(),new FTSConnectionData);
}
After the relevant datastream managers have been created, call the connect action to connect to them.
action connect(ConnectDatastream cds, string underlyingSymbolName,
action<com.apama.md.adapter.ConnectionKey,integer> onConnectSuccess,
action<com.apama.md.adapter.ConnectionKey,integer,string>
onConnectFailure);
Depending on the stream type of the underlying connection, a connection to the appropriate datastream manager is established. For example, to check for stream type BBA and connect to BBA manager:
if cds.streamType = localConsts.BBA() then {
underlyingBBAIFace.connect(underlyingSymbol, underlyingConnectionParams,
handleUnderlyingSessionError,
onUnderlyingConSuccessBBA,onUnderlyingConFailure);
}
After successful connection to the underlying datastream manager, call the createConnection() action to setup data listeners and register the connection.
action createConnection(com.apama.md.adapter.ConnectDatastream cds,
com.apama.md.adapter.ConnectionKey underlyingConnKey);

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.