Caplin Trader 5.1.0

Interface: module:ct-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 module:ct-trading/trademodel/DataHolder, an object that stores all the fields held within the trade model.


getDerivedFields() → {Array}

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 module:ct-trading/derivation/Derivation#recalculateDerivedFields is called.


A list of derived field names as strings.


getInputFields() → {Array}

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.


A list of input field names as strings.



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.

Name Type Description
oDataHolder module:ct-trading/trademodel/DataHolder

The trade data to be updated.