ADL®

Value Bucket Block

The Value Bucket Block can be used to store multiple pairs of numeric values which can be retrieved as needed. Each pair consists of a KEY which the user can use to locate a specific pair, and a VALUE which is the actual numeric value of interest to the user. The Value Bucket Block operates in the following manner:

  1. A discrete event message received through the Msg port triggers the Value Bucket Block.

  2. When triggered, the Value Bucket Block adds to its internal hash table (see: Internal data collection for more information about hash tables) a new entry consisting of a KEY and a VALUE.

  3. After the addition of the new entry, the Value Bucket Block will look at the input message, and search through its internal hash table to locate the entry whose key value matches the input Hole port.

  4. Once it finds the correct entry, it outputs the entry's value through the Value output port.

  5. Afterwards, it passes on the original message unchanged through its Msg port.

  6. Optionally, you can also set up the Value Bucket Block to empty its internal hash table and reset its value to a NaN (Not A Number) when a discrete event message triggers the reset port.

Internal data collection

The Value Bucket's internal Hash Table can be conceptualized as a simple table with two columns: KEY and VALUE. In the following example, suppose that the Value Bucket Block is triggered by a discrete event message every time a trade occurs in a given instrument. When triggered, the Value Bucket will extract and use the Trade Price as the KEY; and the Trade Quantity as the VALUE of each new entry. A user might create such table to maintain and use the running volume at different prices during a trading session.

  1. Suppose that the Value Bucket Block already has three entries in its internal hash table, as shown in the following illustration.

  2. Suppose that a new trade occurs at Price 1290 25, for a Quantity of 3. A discrete event message containing this information will trigger the Value Bucket Block. When triggered, the block will extract and add a new entry to its internal hash table using the Trade price and the Trade Quantity.

  3. Suppose that the user specifies the Hole input as 1289 50. The block will search through its internal hash table to locate the entry whose KEY value matches the input Hole value. Afterwards, it will output the VALUE of the corresponding entry as 7.

Block settings

To change default block settings, double-click the block to open the Block Editor.

Setting Description
Name Name to display beneath the block on the ADL canvas
BodyColor Background color of the block
Mode

Occasionally, two entries in the hash table will end up with the same KEYs. In this case, the Value Bucket will resolve the conflict through one of the three methods chosen by the user:

  • Sum: Sum the values of the two conflicting entries and consolidate them into a single entry
  • Average: Take the average of the values of the two conflicting entries and consolidate them into a single entry
  • Last: Retain the recent entry and discard the older one
StoreKey Formula

Equation used to calculate the value of the entry's key

If not yet defined, the field displays a Click to edit formula link that opens the Formula Builder.

StoreValue Formula

Equation used to calculate the value of the entry's value

If not yet defined, the field displays a Click to edit formula link that opens the Formula Builder.

Description Optional text to explain how the block is used