Caplin Trader 5.1.0

Class: module:ct-trading/derivation/SimpleDerivation

module:ct-trading/derivation/SimpleDerivation(sOutputFieldName)

new module:ct-trading/derivation/SimpleDerivation(sOutputFieldName)

Adds a value into a single output field. Input may be either a constant value OR a field.

Extends:
Parameters:
Name Type Description
sOutputFieldName String

the name of the field to use when adding the derived data.

Extends

Methods

addPrecondition(sFieldName, sExpectedValue)

Adds a precondition that must verified before the derived field can be calculated.

Parameters:
Name Type Description
sFieldName String

the field name to check

sExpectedValue String

the expected field value

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.

Overrides:
Returns:

A list of derived field names as strings.

Type
Array

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.

Overrides:
Returns:

A list of input field names as strings.

Type
Array

recalculateDerivedFields(oData)

Copies the value in the named input field to that in the named output field.

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

Data that is augmented by this derivation. Mandatory.

Overrides:

setInputFieldName(sFieldName)

Sets a required input field for this derivation

Parameters:
Name Type Description
sFieldName String

the input field for this derivation.

setOutputValue(sOutputValue)

Sets the output value (constant), to be used if no input field is defined.

Parameters:
Name Type Description
sOutputValue String

output value, to be used if no input field is defined.