Caplin Trader 5.1.0

Class: module:ct-trading/derivation/DerivationManager

module:ct-trading/derivation/DerivationManager()

A Derivation manager manages multiple individual module:ct-trading/derivation/Derivations.

When an individual Derivation is performed (its recalculateDerivedFields() method is run) it extracts the appropriate values from the trade data that are required to perform the derivation and appends new derived values into that trading data object.

The input to one Derivation may depend upon the output of another Derivation.

When Derivations are added to the manager it examines these dependencies and when the module:ct-trading/derivation/DerivationManager#recalculateDerivedFields method is invoked ensures all derivations are executed in the correct order.

Constructor

new module:ct-trading/derivation/DerivationManager()

Methods

addDerivation(derivation)

Adds a Derivation to be executed.

Parameters:
Name Type Description
derivation module:ct-trading/derivation/Derivation

The derivation to add.

Throws:

If the Derivation instance is not an instance of module:ct-trading/derivation/Derivation.

Type
module:ct-core/Error

recalculateDerivedFields(oTradeDataHolder)

Recalculates the derived fields for all the derivations held within the DerivationManager, given the new trade data.

Parameters:
Name Type Description
oTradeDataHolder module:ct-trading/trademodel/DataHolder

The data to be augmented by the set of managed Derivations.

Throws:

If the DataHolder instance is not an instance of module:ct-trading/trademodel/DataHolder.

Type
module:ct-core/Error