com.apama.md.adapter
Event CrossRateServiceHelper


Routes:
com.apama.md.BBA - 
com.apama.md.ES - 
com.apama.md.WrappedBBA - 
com.apama.md.WrappedES - 
com.apama.md.WrappedX - 
com.apama.md.WrappedXES - 
com.apama.md.X - 
com.apama.md.XES - 
Sends:
com.apama.md.BBA - 
com.apama.md.ES - 
com.apama.md.WrappedBBA - 
com.apama.md.WrappedES - 
com.apama.md.WrappedX - 
com.apama.md.WrappedXES - 
com.apama.md.X - 
com.apama.md.XES - 
Listens:
com.apama.md.crossrate.EnableThrottling - 

Import summary
 TimeFormatPlugintimeMgr
 
Constant summary
 constant stringNULL := ""
 
Member summary
 com.apama.md.adapter.CrossRateServiceParamsparams
 com.apama.md.DatastreamConstantsdatastreamConsts
 com.apama.md.constants.Constantsconstants
 com.apama.md.symbol.SymbolConversionTableInterfacesymbolConversionIface
 booleanhasSymbolConversionTable
 action<>userSetupSymbolConversionTable
 dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentBBAInterface>bbaData
 dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentDepthInterface>depthData
 dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentAggregatedBookInterface>aggData
 dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentOrderbookInterface>orderbookData
 dictionary<com.apama.md.adapter.ConnectionKey, boolean>needWrapped
 dictionary<com.apama.md.adapter.ConnectionKey, boolean>needWrappedES
 dictionary<com.apama.md.adapter.ConnectionKey, boolean>routeData
 com.apama.md.ESlastOutputES
 integerminQuantity

Initialised with Integer.MAX value. Used only in case when user want complete leg quantity as minimum quantity.
 booleantokenPending

Initialised to false. Used to avoid having multiple listeners in case when throttling is switched ON.
 booleantokenPendingEnableThrottle
 booleanlastUpdatedLeg1
 
Action summary
 booleancalculateCrossRatesfromBBA(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentBBAInterface currBBA, string channel)
 booleanconvertBBAToCrossRatePricePoint(com.apama.md.client.CurrentBBAInterface currBBA, com.apama.md.adapter.CrossRatePricePoint outputXR)

The convertBBAToCrossRatePricePoint() action uses the latest BBA interface object to generate a new CrossRatePricePoint for the required synthetic cross.
 booleanconvertToCrossRate(com.apama.md.adapter.CrossRatePricePoint leg1, com.apama.md.adapter.CrossRatePricePoint leg2, boolean leg1Parity, boolean leg2Parity, com.apama.md.adapter.CrossRatePricePoint outputXR, com.apama.md.adapter.QuantitiesRemaining outputQtys, com.apama.md.adapter.MinimumTradeQuantity minTrade)

The convertToCrossRate() action calculates a synthetic cross rate based on the two input legs.
 com.apama.md.adapter.CrossRateServiceParamsextractParams(string symbol, com.apama.session.CtrlParams ctrlParams)
 booleangenerateAggWrappedEvent(com.apama.md.adapter.ConnectionKey crossConnKey, dictionary<string, com.apama.md.adapter.ConnectionKey> legConnections, string channel)
 booleangenerateBBAWrappedEvent(com.apama.md.adapter.ConnectionKey crossConnKey, dictionary<string, com.apama.md.adapter.ConnectionKey> legConnections, string channel)
 booleangenerateWrappedEvent(com.apama.md.adapter.ConnectionKey crossConnKey, string datastreamType, dictionary<string, com.apama.md.adapter.ConnectionKey> legConnections, string channel)
 booleangetLegCallbacks(string symbol, com.apama.md.adapter.GenericLegInterface getLegIface)
 voidmergeEPSchemas(dictionary<com.apama.md.XEPKey, dictionary<string, com.apama.md.ESI>> source, dictionary<com.apama.md.XEPKey, dictionary<string, com.apama.md.ESI>> dest)
 voidmergeEPValues(dictionary<com.apama.md.XEPKey, dictionary<string, string>> source, dictionary<com.apama.md.XEPKey, dictionary<string, string>> dest)
 integermin(integer m, integer n)

Helper function to return the minimum value based on comparing two integers.
 floatminFloat(float m, float n)

Helper function to return the minimum value based on comparing two floats.
 voidpopulateAskXLeg(com.apama.md.XLeg xLeg, com.apama.md.adapter.BookLevelCallbacks callbacks)
 voidpopulateBidXLeg(com.apama.md.XLeg xLeg, com.apama.md.adapter.BookLevelCallbacks callbacks)
 voidpublish(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.X xrOut, string channel)
 booleanreadParamsMinTradeQuantity(boolean leg1HasMinQuantity, boolean leg2HasMinQuantity, com.apama.md.adapter.MinimumTradeQuantity minTrade, integer leg1SessionId, integer leg1BidQty, integer leg1AskQty, integer leg2SessionId, integer leg2BidQty, integer leg2AskQty)

Helper function to populate MinimumTradeQuantity event from Minimum Trade Quantity parameters.
 voidsendES(com.apama.md.adapter.ConnectionKey crossConnKey, dictionary<integer, float> __timestamps, dictionary<string, com.apama.md.ESI> currES, string streamType, string channel)
 voidsendWrappedX(com.apama.md.X x, com.apama.md.adapter.ConnectionKey crossConnKey, string channel)
 voidsendWrappedXES(com.apama.md.XES xes, com.apama.md.adapter.ConnectionKey crossConnKey, string channel)
 voidsetParams(com.apama.md.adapter.CrossRateServiceParams params)
 voidsetupSymbolConversionTable(string sessionName, string transportName, action<> userSetupSymbolConversionTable)
 voidsymbolConversionTableCreated(string sessionName, string transportName)
 voidsymbolConversionTableFailed(string sessionName, string transportName, string errMsg)
 voidtearDown(com.apama.md.adapter.ConnectionKey ck)

The tearDown() action clears up all the dictionaries storing cached data.
 booleantransformAggBook(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentAggregatedBookInterface currAgg, string channel)

The transformAggBook() action uses the latest AggregatedBook interface object to publish a new com.apama.md.XR event based on the updated information.
 booleantransformBBA(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentBBAInterface currBBA, string channel)

The transformBBA() action creates a CrossRatePricePoint event for the calculation of the BBA synthetic cross rate.
 booleantransformDepthBook(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentDepthInterface currDepth, string channel)

The transformDepthBook() action uses the latest Depth interface object to publish a new com.apama.md.XR event based on the updated information.
 booleantransformOrderbook(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentOrderbookInterface currOrderbook, string channel)

The transformOrderbook() action uses the latest Orderbook interface object to publish a new com.apama.md.XR event based on the updated information.
 integerupdateStaticData(com.apama.md.X xrOut, com.apama.md.XLegStaticData xStaticData)
 booleanvalidateParams(string crossSymbol, com.apama.md.adapter.CrossRateServiceParams givenParams)
 booleanwalkTheBook(com.apama.md.adapter.ConnectionKey crossConnKey, string leg1Symbol, string leg2Symbol, boolean lastUpdatedLeg1, string channel)

This action is a generic function to walk different types of book data. To do this it uses the BookLevelCallbacks as an interface to call the correct callbacks to get data for the specific book type that we are walking.
 booleanwalkTheBookCalculation(com.apama.md.adapter.ConnectionKey crossConnKey, string leg1Symbol, string leg2Symbol, boolean lastUpdatedLeg1, string channel)
 
Import detail

timeMgr

TimeFormatPlugin timeMgr

Constant detail

NULL

constant string NULL := ""

Member detail

aggData

dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentAggregatedBookInterfaceaggData

bbaData

dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentBBAInterfacebbaData

constants

com.apama.md.constants.Constants constants

datastreamConsts

com.apama.md.DatastreamConstants datastreamConsts

depthData

dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentDepthInterfacedepthData

hasSymbolConversionTable

boolean hasSymbolConversionTable

lastOutputES

com.apama.md.ES lastOutputES

lastUpdatedLeg1

boolean lastUpdatedLeg1

minQuantity

integer minQuantity
Initialised with Integer.MAX value. Used only in case when user want complete leg quantity as minimum quantity.

needWrapped

dictionary<com.apama.md.adapter.ConnectionKey, boolean> needWrapped

needWrappedES

dictionary<com.apama.md.adapter.ConnectionKey, boolean> needWrappedES

orderbookData

dictionary<com.apama.md.adapter.ConnectionKeycom.apama.md.client.CurrentOrderbookInterfaceorderbookData

params

com.apama.md.adapter.CrossRateServiceParams params

routeData

dictionary<com.apama.md.adapter.ConnectionKey, boolean> routeData

symbolConversionIface

com.apama.md.symbol.SymbolConversionTableInterface symbolConversionIface

tokenPending

boolean tokenPending
Initialised to false. Used to avoid having multiple listeners in case when throttling is switched ON.

tokenPendingEnableThrottle

boolean tokenPendingEnableThrottle

userSetupSymbolConversionTable

action<> userSetupSymbolConversionTable

Action detail

calculateCrossRatesfromBBA

boolean calculateCrossRatesfromBBA(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentBBAInterface currBBA, string channel)
Parameters:
crossConnKey
currBBA
channel
Routes:
com.apama.md.BBA - 
com.apama.md.WrappedBBA - 
Sends:
com.apama.md.BBA - 
com.apama.md.WrappedBBA - 

convertBBAToCrossRatePricePoint

boolean convertBBAToCrossRatePricePoint(com.apama.md.client.CurrentBBAInterface currBBA, com.apama.md.adapter.CrossRatePricePoint outputXR)
The convertBBAToCrossRatePricePoint() action uses the latest BBA interface object to generate a new CrossRatePricePoint for the required synthetic cross.
Parameters:
currBBA - The latest BBA interface that was received which is to be used to update the synthetic cross
outputXR - This is a reference parameter that is passed in which will be updated with the latest synthetic cross details
Returns:
true if the update was successful, false otherwise
Since:
CMF 2.2.0

convertToCrossRate

boolean convertToCrossRate(com.apama.md.adapter.CrossRatePricePoint leg1, com.apama.md.adapter.CrossRatePricePoint leg2, boolean leg1Parity, boolean leg2Parity, com.apama.md.adapter.CrossRatePricePoint outputXR, com.apama.md.adapter.QuantitiesRemaining outputQtys, com.apama.md.adapter.MinimumTradeQuantity minTrade)
The convertToCrossRate() action calculates a synthetic cross rate based on the two input legs.

It returns the synthetic cross rate details, and a set of quantities that are remaining on either leg as a result of the calculation (this can be used to carry over quantities when walking a Quote/Depth book).
Parameters:
leg1 - The front leg that will be used to calculate the synthetic cross rate
leg2 - The back leg that will be used to calculate the synthetic cross rate
leg1Parity - true if the front leg is in the right direction for the cross, false if the leg was inverted
leg2Parity
outputXR - This is an output parameter that is passed in as a reference which will be updated with the latest synthetic cross details
outputQtys
minTrade
Returns:
true if the cross was successfully calculated, false otherwise
Since:
CMF 2.2.0

extractParams

com.apama.md.adapter.CrossRateServiceParams extractParams(string symbol, com.apama.session.CtrlParams ctrlParams)
Parameters:
symbol
ctrlParams

generateAggWrappedEvent

boolean generateAggWrappedEvent(com.apama.md.adapter.ConnectionKey crossConnKey, dictionary<string, com.apama.md.adapter.ConnectionKey> legConnections, string channel)
Parameters:
crossConnKey
legConnections
channel

generateBBAWrappedEvent

boolean generateBBAWrappedEvent(com.apama.md.adapter.ConnectionKey crossConnKey, dictionary<string, com.apama.md.adapter.ConnectionKey> legConnections, string channel)
Parameters:
crossConnKey
legConnections
channel
Routes:
com.apama.md.WrappedBBA - 
Sends:
com.apama.md.WrappedBBA - 

generateWrappedEvent

boolean generateWrappedEvent(com.apama.md.adapter.ConnectionKey crossConnKey, string datastreamType, dictionary<string, com.apama.md.adapter.ConnectionKey> legConnections, string channel)
Parameters:
crossConnKey
datastreamType
legConnections
channel

getLegCallbacks

boolean getLegCallbacks(string symbol, com.apama.md.adapter.GenericLegInterface getLegIface)
Parameters:
symbol
getLegIface

mergeEPSchemas

void mergeEPSchemas(dictionary<com.apama.md.XEPKey, dictionary<string, com.apama.md.ESI>> source, dictionary<com.apama.md.XEPKey, dictionary<string, com.apama.md.ESI>> dest)
Parameters:
source
dest

mergeEPValues

void mergeEPValues(dictionary<com.apama.md.XEPKey, dictionary<string, string>> source, dictionary<com.apama.md.XEPKey, dictionary<string, string>> dest)
Parameters:
source
dest

min

integer min(integer m, integer n)
Helper function to return the minimum value based on comparing two integers.
Parameters:
m - The first integer value to compare
n - The second integer value to compare
Returns:
The minimum integer value based on comparing the two inputs
Since:
CMF 2.2.0

minFloat

float minFloat(float m, float n)
Helper function to return the minimum value based on comparing two floats.
Parameters:
m - The first float value to compare
n - The second float value to compare
Returns:
The minimum float value based on comparing the two inputs
Since:
CMF 2.2.0

populateAskXLeg

void populateAskXLeg(com.apama.md.XLeg xLeg, com.apama.md.adapter.BookLevelCallbacks callbacks)
Parameters:
xLeg
callbacks

populateBidXLeg

void populateBidXLeg(com.apama.md.XLeg xLeg, com.apama.md.adapter.BookLevelCallbacks callbacks)
Parameters:
xLeg
callbacks

publish

void publish(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.X xrOut, string channel)
Parameters:
crossConnKey
xrOut
channel
Routes:
com.apama.md.X - 
com.apama.md.XES - 
Sends:
com.apama.md.X - 
com.apama.md.XES - 

readParamsMinTradeQuantity

boolean readParamsMinTradeQuantity(boolean leg1HasMinQuantity, boolean leg2HasMinQuantity, com.apama.md.adapter.MinimumTradeQuantity minTrade, integer leg1SessionId, integer leg1BidQty, integer leg1AskQty, integer leg2SessionId, integer leg2BidQty, integer leg2AskQty)
Helper function to populate MinimumTradeQuantity event from Minimum Trade Quantity parameters.
Parameters:
leg1HasMinQuantity - Boolean saying if minimum trade quantity parameter for leg 1 exists
leg2HasMinQuantity - Boolean saying if minimum trade quantity parameter for leg 2 exists
minTrade - MinimumTradeQuantity event to populate
leg1SessionId - Session Id of leg1
leg1BidQty - Bid quantity on leg 1
leg1AskQty - Ask quantity on leg 1
leg2SessionId - Session Id of leg2
leg2BidQty - Bid quantity on leg 2
leg2AskQty - Ask quantity on leg 2
Returns:
Boolean true
Since:
CMF 2.3.0

sendES

void sendES(com.apama.md.adapter.ConnectionKey crossConnKey, dictionary<integer, float> __timestamps, dictionary<string, com.apama.md.ESI> currES, string streamType, string channel)
Parameters:
crossConnKey
__timestamps
currES
streamType
channel
Routes:
com.apama.md.ES - 
com.apama.md.WrappedES - 
Sends:
com.apama.md.ES - 
com.apama.md.WrappedES - 

sendWrappedX

void sendWrappedX(com.apama.md.X x, com.apama.md.adapter.ConnectionKey crossConnKey, string channel)
Parameters:
x
crossConnKey
channel
Routes:
com.apama.md.WrappedX - 
Sends:
com.apama.md.WrappedX - 

sendWrappedXES

void sendWrappedXES(com.apama.md.XES xes, com.apama.md.adapter.ConnectionKey crossConnKey, string channel)
Parameters:
xes
crossConnKey
channel
Routes:
com.apama.md.WrappedXES - 
Sends:
com.apama.md.WrappedXES - 

setParams

void setParams(com.apama.md.adapter.CrossRateServiceParams params)
Parameters:
params

setupSymbolConversionTable

void setupSymbolConversionTable(string sessionName, string transportName, action<> userSetupSymbolConversionTable)
Parameters:
sessionName
transportName
userSetupSymbolConversionTable

symbolConversionTableCreated

void symbolConversionTableCreated(string sessionName, string transportName)
Parameters:
sessionName
transportName

symbolConversionTableFailed

void symbolConversionTableFailed(string sessionName, string transportName, string errMsg)
Parameters:
sessionName
transportName
errMsg

tearDown

void tearDown(com.apama.md.adapter.ConnectionKey ck)
The tearDown() action clears up all the dictionaries storing cached data.
Parameters:
ck

transformAggBook

boolean transformAggBook(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentAggregatedBookInterface currAgg, string channel)
The transformAggBook() action uses the latest AggregatedBook interface object to publish a new com.apama.md.XR event based on the updated information.
Parameters:
crossConnKey - The connection key information for the synthetic cross we are publishing
currAgg - The current AggregatedBook interface which will be used to update the synthetic source
channel
Returns:
true if the update was successful, false otherwise
Since:
CMF 2.2.0

transformBBA

boolean transformBBA(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentBBAInterface currBBA, string channel)
The transformBBA() action creates a CrossRatePricePoint event for the calculation of the BBA synthetic cross rate.

If a valid cross rate is calculated, constructs a BBA event within which to return the calculated synthetic cross. The action wraps events if required.
Parameters:
crossConnKey - The connection key information for the synthetic cross we are publishing
currBBA - The current BBA interface which will be used to update the synthetic source
channel
Returns:
true if the update was successful, false otherwise
Since:
CMF 2.2.0
Listens:
com.apama.md.crossrate.EnableThrottling - 

transformDepthBook

boolean transformDepthBook(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentDepthInterface currDepth, string channel)
The transformDepthBook() action uses the latest Depth interface object to publish a new com.apama.md.XR event based on the updated information.
Parameters:
crossConnKey - The connection key information for the synthetic cross we are publishing
currDepth - The latest Depth interface that was received which is to be used to update the synthetic cross
channel - Channel on which the event should be sent
Returns:
true if the update was successful, false otherwise
Since:
CMF 2.2.0

transformOrderbook

boolean transformOrderbook(com.apama.md.adapter.ConnectionKey crossConnKey, com.apama.md.client.CurrentOrderbookInterface currOrderbook, string channel)
The transformOrderbook() action uses the latest Orderbook interface object to publish a new com.apama.md.XR event based on the updated information.
Parameters:
crossConnKey - The connection key information for the synthetic cross we are publishing
currOrderbook - The current Orderbook interface which will be used to update the synthetic source
channel
Returns:
true if the update was successful, false otherwise
Since:
CMF 2.2.0

updateStaticData

integer updateStaticData(com.apama.md.X xrOut, com.apama.md.XLegStaticData xStaticData)
Parameters:
xrOut
xStaticData

validateParams

boolean validateParams(string crossSymbol, com.apama.md.adapter.CrossRateServiceParams givenParams)
Parameters:
crossSymbol
givenParams

walkTheBook

boolean walkTheBook(com.apama.md.adapter.ConnectionKey crossConnKey, string leg1Symbol, string leg2Symbol, boolean lastUpdatedLeg1, string channel)
This action is a generic function to walk different types of book data. To do this it uses the BookLevelCallbacks as an interface to call the correct callbacks to get data for the specific book type that we are walking.
Parameters:
crossConnKey
leg1Symbol
leg2Symbol
lastUpdatedLeg1
channel
Returns:
Returns a com.apama.md.XR event object for this book
Since:
CMF 2.2.0
Listens:
com.apama.md.crossrate.EnableThrottling - 

walkTheBookCalculation

boolean walkTheBookCalculation(com.apama.md.adapter.ConnectionKey crossConnKey, string leg1Symbol, string leg2Symbol, boolean lastUpdatedLeg1, string channel)
Parameters:
crossConnKey
leg1Symbol
leg2Symbol
lastUpdatedLeg1
channel