Connecting to the cross rate service
Making a connection to the Cross Rate Service is done in exactly the same way as any other MDA datasource. The following code excerpt demonstrates connecting to the synthetic cross rate EUR/JPY using two underlying legs, EUR/USD from SessionId 1, and USD/JPY from SessionId 2.
// This code excerpt assumes that the Cross Rate Service and a
// MDManagerInterface have already been created
aggManager := mgr.createAggregatedBookManager();
// We want to use "EUR/USD" from Session 1 and "USD/JPY" from Session 2
// for the cross rate calculation
sequence<string> legSymbols := ["EUR/USD","USD/JPY"];
sequence<integer> legSessions:= [1,2];
com.apama.session.CtrlParams controlParams := new com.apama.session.CtrlParams;
controlParams.addParam("legSymbols",legSymbols);
controlParams.addParam("legSessions", legSessions);
aggManager.connect( "EUR/JPY", controlParams,
onSessionError, onConnectionSuccess, onConnectionFailure );
If the connection was successful, the AggregatedBookManagerInterface can be used in the normal way to examine the aggregated book data that is being published by the Cross Rate Service.