Caplin Trader 4.8.0

Class: module:caplin/trading/derivation/DerivationManager

module:caplin/trading/derivation/DerivationManager

A Derivation manager manages multiple individual module:caplin/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:caplin/trading/derivation/DerivationManager#recalculateDerivedFields method is invoked ensures all derivations are executed in the correct order.

Constructor

new module:caplin/trading/derivation/DerivationManager()

Methods

addDerivation(derivation)

Adds a Derivation to be executed.
Parameters:
Name Type Description
derivation module:caplin/trading/derivation/Derivation The derivation to add.
Throws:
If the Derivation instance is not an instance of module:caplin/trading/derivation/Derivation.
Type
module:caplin/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:caplin/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:caplin/trading/trademodel/DataHolder.
Type
module:caplin/core/Error