Many of the ADL blocks allow you to define formulas to calculate output values. The Formula Builder contains a canvas onto which you can drag-and-drop components of an equation, including:
- Logical operators
- Numerical operators
- Variables, including numbers, values of other ADL blocks, values of message fields, and values of input connectors
- Misc symbols to define the order of operations
Example Define a formula that compares a fill quantity with the quantity available at the Best Ask.
Note Based on the block type, some Formula Builders will provide or restrict components that do not pertain to the block functionality.
The Formula Builder includes tiles that allow you to add values that update dynamically as the algo runs.
: Lets you to enter a specific number.
: Lets you reference the output of any other block in the algorithm.
: Lets you extract any of the following information embedded within a discrete event message.
- limitPrice: Price of an new order
- orderQuantity: Total order quantity
- workingQuantity: Working quantity of an order
- fillPrice: Price of a fill
- fillQuantity: Quantity of a fill
- cumQuantity: Sum of fill quantities
- disclosedQuantity: Quantity of a disclosed order visible in the market
- deletedQuantity: Canceled quantity of a deleted order
- tradeQuantity: Quantity of the last trade for a specified instrument
- tradePrice: Price of the last trade for a specified instrument
- stopTrigger: Price at which the respective stop order is activated
- isBuy: Whether a fill was a buy side execution
- isQuotingOrder: Whether the message was generated by a submitted quote order (valid only for Autospreader order blocks)
- isHedgeOrder: Whether the message was generated by a submitted hedge order (valid only for Autospreader order blocks
- isExternalEvent: Whether the message was generated from a source outside of the algorithm
- isTriggered: Whether an order resulted from a trigger condition
- instrument: Instrument associated with the message
- userFieldN: One of four empty fields that can be populated by a Value Injector and then accessed by a Value Extractor
: (Alert block only) Lets you add customized text to a message string.
Blocks that use the Formula Builder
The following ADL blocks allow you to create custom formulas.
How to create a formula
To create a formula:
From an ADL block, open the Formula Builder.
Drag a field tile onto the canvas.
If necessary, select a value for the field and click OK.
The field updates with the selected value.
Drag another field tile onto the canvas, in this case the + operator.
Notice in this case, the canvas turns red after adding the operator. The red canvas indicates that the formula currently on the canvas is not valid.
Continue adding field tiles until the formula is complete. In this case, you add a Block Value field and select the Price Incr block to add one tick to the fill price.
- When finished, click OK.