Interface
caplin.trading.derivation

Derivation

A Derivation specifies how derived field values can be calculated using fields from the trade model as their input.

For example, an ESP FX Trade will have a bid/ask rate that is determined by (amongst other things) the amount to be traded, and the various tier limits; when the user changes the amount, then the derivation manager will re-calculate the bid/ask amount. The fields within the trade model are made available to Derivation instances using a caplin.trading.trademodel.DataHolder, an object that stores all the fields held within the trade model.

Constructor Summary

Attributes Name and Description
caplin.trading.derivation.Derivation()

Method Summary

Attributes Name and Description
Array getDerivedFields()

Returns the list of fields that this derivation will provide.

Array getInputFields()

Returns the list of fields that are required to perform the derivation.

void recalculateDerivedFields(caplin.trading.trademodel.DataHolder oDataHolder)

Allows the derivation to recalculate the derived fields using the supplied trade data as input.

Constructor Detail

caplin.trading.derivation.Derivation()

Method Detail

Array getDerivedFields()

Returns the list of fields that this derivation will provide.

These fields may be required as input fields to another derivation, and will be appended to the data-holder when #recalculateDerivedFields is called.

Returns
A list of derived field names as strings.

Array getInputFields()

Returns the list of fields that are required to perform the derivation.

The input fields of one derivation may be the derived fields of another derivation, and so will determine the order in which the derivations will be performed.

Returns
A list of input field names as strings.

void recalculateDerivedFields(caplin.trading.trademodel.DataHolder oDataHolder)

Allows the derivation to recalculate the derived fields using the supplied trade data as input.

Derivations must be designed not to throw exceptions; in general, recalculation of the derived fields can occur due to a wide range of stimuli, and therefore exception handling would be dispersed and difficult to manage.

Parameters
caplin.trading.trademodel.DataHolder oDataHolder The trade data to be updated.