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:
- A discrete event message triggers the Value Bucket Block.
Upon trigger, the Value Bucket Block adds to its internal hash table (see: Details section below for more information about hash tables) a new entry consisting of a KEY and a VALUE:
- KEY: The user can define the key of each new entry by double-clicking on the block and using the "Bucket Hole" side of the green canvas.
- VALUE: The user can have the Value Bucket Block either extract a numeric value contained within , or retrieve a value unrelated to . Specify this by double-clicking on the block and using the "Bucket Value" side of the green canvas.
- After the addition of the new entry, the Value Bucket Block will look at the input , and search through its internal hash table to locate the entry whose Key value matches the input .
- Once it finds the correct entry, it outputs the entry's Value as the .
Afterwards, it passes on the original message unchanged through its upper-right port.
- (Optional) The user can also set up the Value Bucket Block to empty its internal hash table and reset its to a NaN (Not A Number) when a discrete event message triggers the reset port.
The Value Bucket’s internal Hash Table should 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.
Suppose that the Value Bucket Block already has three entries in its internal hash table, as shown in the following illustration.
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. Upon trigger, the block will extract and add a new entry to its internal hash table using the Trade price and the Trade Quantity.
Suppose that the user specifies the input as 1289 50. The block will search through its internal hash table to locate the entry whose KEY value matches the input . Afterwards, it will output the VALUE of the corresponding entry as .
Double-Click Edit Window
Double-click on the block to bring up an edit window:
- Clicking on the formula link will display a green canvas where the user can define an equation which will determine the KEY (Bucket Hole) and the VALUE (Bucket Value) of the new entry that is added to the hash table at the moment the block is triggered by .
Store Type: 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
Internalized Logic Canvas
Internalized Logic Canvas: Several blocks in ADL contain an internalized logic canvas which can be accessed by double-clicking on the block.
Example. Internal Logic Canvas
The canvas is used to define user-made equations which will play an important role in the overall operation of the respective block. The following icons can be dragged onto the green canvas to define an equation:
- : These icons can be linked to define an arithmetic equation or a True/False statement.
- : The Block Value Icon allows the user to reference the output of any other block in the algorithm. When dragged onto the canvas, the Block Value Icon will display a menu from which the user will be able to choose a block within the algorithm (except for the blocks contained in a virtualized block).
: The Message Info Icon allows the user to extract certain information embedded within a discrete event message, such as a Fill Confirmation Message. When dragged onto the canvas, the Message Info Icon will display the following selectable fields:
Field Description Limit The price of the respective order or the order about to be submitted OrderQty The total order quantity of the respective order or the order about to be submitted WorkingQty The working quantity of the respective order or the order about to be submitted FillPrice Fill price FillQty Fill quantity Instrument Instrument of the submitted order ExeQty Total filled quantity of the respective order DisclosedQty The disclosed quantity or percentage (%) of total goal quantity viewable to the market DeletedQty The canceled quantity of the deleted order or the order about to be deleted IsBuy When this field is selected, the respective block will evaluate the user's fill confirmations messages (not trade data message disseminated by the exchange) and will output a Boolean value of TRUE if the user's fill was a buy side execution StopTrigger The price at which the respective stop-limit or stop-market order is activated TradeQty Quantity of the last trade for a specific instrument TradePrice Price of the last trade for a specific instrument IsQuotingOrder Applies to discrete event messages generated by an ASE Order Block. The field will output a Boolean value of TRUE if the message was generated from an order submission for the quote leg of the respective spread IsHedgeOrder Applies to discrete event messages generated by an ASE Order Block. The field will output a Boolean value of TRUE if the message was generated from an order submission for the hedge leg of the respective spread User Field 1 - 4 An empty field that can be populated with a value using a Value Injector Block. The value may then be extracted using a Value Extractor Block