com.apama.ccyconverter
Event CurrencyConverter


The Currency Converter is designed to allow an application to get a value it can use to convert a price or value of an instrument from one currency to another.

When creating a Currency Converter you supply a Calculation Extension interface which is where the Currency Converter will obtain its values from. Typically this will connect to an FX datastream and periodically update the values in the Currency Converter. You may also create your own Extension.

Depending on the parameters supplied, the Currency Converter will also construct symbols that the Extension should try to supply values for.

This event object should not be created directly, the Currency Converter Factory object should be used to create an instance of it instead. For example:

monitor MyMonitor {
context mainContext := context.current();

action onload() {
// Create an instance of a Calculation Extension
com.apama.ccyconverter.CalculationExtension extension := (new com.apama.ccyconverter.BBAMidPriceExtension).create();

// Create an instance of the Currency Converter
com.apama.ccyconverter.CurrencyConverter iface :=
(new com.apama.ccyconverter.CurrencyConverterFactory).create( mainContext, "MyCurrencyConverter", extension );
}
}
This event object should not be routed or enqueued.
See Also:
com.apama.ccyconverter.CurrencyConverterFactory - The Currency Converter Factory object that is used to constructed Currency Converter objects
com.apama.ccyconverter.CalculationExtension - The Calculation Extension object that is supplied when creatinga Currency Converter.
com.apama.ccyconverter.Consts - The Currency Converter constant for the parameters.

Member Summary
 action< > returns stringgetCurrencyConverterName

This action returns the name that the Currency Converter was created with. This name must be unique within the application.
 action< > returns com.apama.utils.ParamsgetParams

This action returns the set of configuration parameters that have been set by the application for the Currency Converter.
 action<com.apama.utils.Params >setParams

This action sets any configuration parameters that are required for this instance of the Currency Converter. This replaces any existing parameters that were defined for the Currency Converter.
 action<string, string > returns floatgetValue

This action gets the current default value from the cache for the supplied to and from currencies. If no direct value can be found, it will also try switching the currencies and going through any cross currency pairs set up.
 action<string, string, string > returns floatgetCustomValue

This action gets the value of the supplied field from the cache for the supplied to and from currencies. If no direct value can be found, it will also try switching the currencies and going through any cross currency pairs set up.
 action<string, float >setValue

This action sets the current default value in the cache for the supplied symbol (of the form 'CCY1/CCY2').
 action<string, string, float >setCustomValue

This action sets the value of the supplied field in the cache for the supplied symbol (of the form 'CCY1/CCY2').
 action<action<com.apama.ccyconverter.CurrencyConverter > > returns integeraddUpdateCallback

This action allows applications to add a callback action that will be called by the Currency Converter whenever the update timeout fires, which signifies the values may have been updated.
 action<integer >removeUpdateCallback

This action allows applications to remove a specific update callback action that was previously added to the Currency Converter.
 action< >clearUpdateCallbacks

This action allows applications to remove all update callback actions that were previously added to the Currency Converter.
 action< > returns booleanisRemote

This action returns a boolean that indicates whether or not this instance of the Currency Converter event object was a remote connection to a Currency Converter, rather than the main instance of the Currency Converter itself.
 action< >delete

This action destroys the Currency Converter object, and cleans up any data or listeners that have been created by the Currency Converter.
 action<action<com.apama.ccyconverter.CurrencyConvertercom.apama.utils.Error > > returns integeraddErrorCallback

This action allows applications to override the default error handling action used by the Currency Converter to report any errors that occur from actions called on the interface.
 action<integer >removeErrorCallback

This action allows the application to remove error callback that was added by the addErrorCallback() action using the reference Id provided.
 action< >clearErrorCallbacks

This action allows the application to remove all error callbacks that were added by the addErrorCallback() action.
 action<com.apama.ccyconverter.CurrencyConvertercom.apama.utils.Error >defaultErrorCallback

This is the default action that will be called by this instance of the Currency Converter when an error is encountered.
 
Member Detail

addErrorCallback

action<action<com.apama.ccyconverter.CurrencyConvertercom.apama.utils.Error > > returns integer addErrorCallback
This action allows applications to override the default error handling action used by the Currency Converter to report any errors that occur from actions called on the interface.

For example, errors from creating the Currency Converter, etc

Parameters:
cbOnError - The application defined error callback action.
Returns:
A reference Id that can be used to remove the callback at a later date.
See Also:
com.apama.ccyconverter.ErrorConsts - The set of constants that define the errors generated by the Currency Converter.
com.apama.ccyconverter.CurrencyConverter#removeErrorCallback - This action removes a specific instance of an error callbacks that was registered with the Currency Converter.
com.apama.ccyconverter.CurrencyConverter#clearErrorCallbacks - This action clears all the error callbacks that were registered with the Currency Converter.

addUpdateCallback

action<action<com.apama.ccyconverter.CurrencyConverter > > returns integer addUpdateCallback
This action allows applications to add a callback action that will be called by the Currency Converter whenever the update timeout fires, which signifies the values may have been updated.

Multiple callback actions may be added to the Currency Converter if required.

Parameters:
cbOnUpdate - The application defined callback action that will be called by the Currency Converter
Returns:
A reference Id that can be used to remove the callback at a later date.
See Also:
com.apama.ccyconverter.CurrencyConverter#removeUpdateCallback - This action removes a specific update callback that was added to the Currency Converter.
com.apama.ccyconverter.CurrencyConverter#clearUpdateCallbacks - This action clears all the update callbacks that were added to the Currency Converter.

clearErrorCallbacks

action< > clearErrorCallbacks
This action allows the application to remove all error callbacks that were added by the addErrorCallback() action.
See Also:
com.apama.ccyconverter.CurrencyConverter#addErrorCallback - This action adds an error callback to the set of callbacks that will be called when an error occurs
com.apama.ccyconverter.CurrencyConverter#removeErrorCallback - This action removes an existing error callback using the reference identifier provided

clearUpdateCallbacks

action< > clearUpdateCallbacks
This action allows applications to remove all update callback actions that were previously added to the Currency Converter.
See Also:
com.apama.ccyconverter.CurrencyConverter#addUpdateCallback - This action adds an application defined callback action that will be called by the Currency Converter whenever the update timeout fires.
com.apama.ccyconverter.CurrencyConverter#removeUpdateCallback - This action removes a specific update callback that was added to the Currency Converter.

defaultErrorCallback

action<com.apama.ccyconverter.CurrencyConvertercom.apama.utils.Error > defaultErrorCallback
This is the default action that will be called by this instance of the Currency Converter when an error is encountered.

Parameters:
iface - The Currency Converter.
error - An error event.
See Also:
com.apama.ccyconverter.ErrorConsts - The set of constants that define the errors generated by the Currency Converter.

delete

action< > delete
This action destroys the Currency Converter object, and cleans up any data or listeners that have been created by the Currency Converter.

After calling this action the Currency Converter object cannot be re-used, a new instance must be created using the Currency Converter Factory object instead.

getCurrencyConverterName

action< > returns string getCurrencyConverterName
This action returns the name that the Currency Converter was created with. This name must be unique within the application.

Returns:
The name of this Currency Converter which is unique within the application.

getCustomValue

action<string, string, string > returns float getCustomValue
This action gets the value of the supplied field from the cache for the supplied to and from currencies. If no direct value can be found, it will also try switching the currencies and going through any cross currency pairs set up.

The value returned can then be used as a multiplier for either a price or value to convert from one currency to another. If it fails to find any value, zero will be returned and an error produced.

This action would be used if the Extension used to create the Currency Converter supplies values other than the default field.

Parameters:
fromCurrency - The currency you wish to convert from.
toCurrency - The currency you wish to convert to.
field - The field to get from the cache.
Returns:
The current value if found, else zero.

getParams

action< > returns com.apama.utils.Params getParams
This action returns the set of configuration parameters that have been set by the application for the Currency Converter.

The com.apama.ccyconverter.Consts event object defines a set of constants for the various configuration parameters, that the Currency Converter supports, and their default values.

Returns:
The set of configuration parameters that have been set by the application for the Currency Converter.
See Also:
com.apama.ccyconverter.Consts - This event object contains a set of constants that define the various configuration parameters that the Currency Converter supports.
com.apama.ccyconverter.CurrencyConverter#setParams - This action is used to set any configuration parameters that are required by the Currency Converter.

getValue

action<string, string > returns float getValue
This action gets the current default value from the cache for the supplied to and from currencies. If no direct value can be found, it will also try switching the currencies and going through any cross currency pairs set up.

The value returned can then be used as a multiplier for either a price or value to convert from one currency to another. If it fails to find any value, zero will be returned and an error produced.

Parameters:
fromCurrency - The currency you wish to convert from.
toCurrency - The currency you wish to convert to.
Returns:
The current value if found, else zero.

isRemote

action< > returns boolean isRemote
This action returns a boolean that indicates whether or not this instance of the Currency Converter event object was a remote connection to a Currency Converter, rather than the main instance of the Currency Converter itself.

Returns:
True if this instance of the Currency Converter was a remotely connected interface, False if it was the main Currency Converter instance.
See Also:
com.apama.ccyconverter.CurrencyConverterFactory#connect() - This action is used to remotely connect to and existing Currency Converter from another EPL monitor, context or scope.

removeErrorCallback

action<integer > removeErrorCallback
This action allows the application to remove error callback that was added by the addErrorCallback() action using the reference Id provided.

Parameters:
refId - The reference ID as returned from the call to the addErrorCallback() action.
See Also:
com.apama.ccyconverter.CurrencyConverter#addErrorCallback - This action adds an error callback to the set of callbacks that will be called when an error occurs
com.apama.ccyconverter.CurrencyConverter#clearErrorCallbacks - This action clears all the error callbacks that were registered with the Currency Converter

removeUpdateCallback

action<integer > removeUpdateCallback
This action allows applications to remove a specific update callback action that was previously added to the Currency Converter.

Parameters:
refId - The identifier of the update callback that should be removed.
See Also:
com.apama.ccyconverter.CurrencyConverter#addUpdateCallback - This action adds an application defined callback action that will be called by the Currency Converter whenever the update timeout fires.
com.apama.ccyconverter.CurrencyConverter#clearUpdateCallbacks - This action clears all the update callbacks that were added to the Currency Converter.

setCustomValue

action<string, string, float > setCustomValue
This action sets the value of the supplied field in the cache for the supplied symbol (of the form 'CCY1/CCY2').

If the Extension used to create the Currency Converter does not use the supplied field, an error will be produced.

Parameters:
symbol - The symbol to set the value of.
field - The field to set in the cache.
value - The value.

setParams

action<com.apama.utils.Params > setParams
This action sets any configuration parameters that are required for this instance of the Currency Converter. This replaces any existing parameters that were defined for the Currency Converter.

This action cannot be called from a remotely connected Currency Converter interface, otherwise an error will be generated.

Parameters:
config - The configuration parameters object to use for the Currency Converter.
See Also:
com.apama.ccyconverter.CurrencyConverter#getParams - This action is used to get any configuration parameters that were set on the Currency Converter.

setValue

action<string, float > setValue
This action sets the current default value in the cache for the supplied symbol (of the form 'CCY1/CCY2').

If the Extension used to create the Currency Converter does not use the default field, an error will be produced.

Parameters:
symbol - The symbol to set the value of.
value - The value.