Transformer Pipeline Module API Reference
6.2.11.309924
|
Functions | |
validate.threshold (var newprice, var oldprice, var heldprice, var threshold) | |
Perform threshold checking on a value. More... | |
validate.single_threshold (var update, var incomingname, var fieldid) | |
Validate a single threshold field. More... | |
The validation package provides a single validation algorithm in validate.threshold(). The call to this is wrapped up the validate.single_threshold() function call which provides a more user friendly interface.
validate.single_threshold | ( | var | update, |
var | incomingname, | ||
var | fieldid | ||
) |
Validate a single threshold field.
update | - Outgoing update that we wish to validate |
incomingname | - Name of the incoming symbol |
fieldid | - Field id (in DataDictionary) of the field we wish to validate |
1 | - Publish this update |
nil | - Don't publish this update |
On incomingname we use the following database keys:
ValidationThreshold
On the data dictionary this function uses the following keys
fieldid
validate.threshold | ( | var | newprice, |
var | oldprice, | ||
var | heldprice, | ||
var | threshold | ||
) |
Perform threshold checking on a value.
newprice | - The new value |
oldprice | - The old value |
heldprice | - The currently held price |
threshold | - Threshold to check against (0.01 = 1%) |
First return value:
validate.OK | - this update is validated |
validate.HOLD | - this update should be held |
validate.RELEASE | - this update is ok, and the held value released |
validate.KILL | - this update is ok, and the held value discarded |
Second return value:
Percentage | change - Percentage change between new price and old price |
If heldprice is not nil then this function applies an auto-release principle in which if the next update is of the same order as the held value, the held value should be released.
If heldprice is nil then this function will simply perform validation on the new and oldprive and reutrn validate.OK or validate.HOLD as appropriate.
Example uses:
Newprice | Oldprice | Heldprice | Threshold | Result | 10.7 | 10.2 | 10.0 | 0.1 | validate.KILL |
12.2 | 10.0 | 11.2 | 0.1 | validate.RELEASE |
15.0 | 10.0 | 12.0 | 0.1 | validate.HOLD |
109.9 | 100 | nil | 0.1 | validate.OK |
110.1 | 100.0 | nil | 0.1 | validate.HOLD |