ADL treats the act of sending request and receiving confirmation messages from the exchange server as discrete events, or events which occur at a single moment in time (see: Continuous Vs. Discrete Event Messages for more information). In addition to these events, the user can define custom discrete events by double-clicking on the State Block and defining True/False statements within the green logic canvas. When these True/False statements turn TRUE, ADL will consider it as an occurrence of a discrete event. By default, the user may define up to two discrete events, but an option exists to allow the user to add extra slots and define more than two events (see: Double-Click Edit Window section below for more information).
After the statements are defined, the State Block must be triggered by a discrete event message . The block does not act upon the trigger, but merely becomes "loaded," ready to "fire" a discrete event message from one of its outputs when a user-made True/False statement turns TRUE.
When a user-made True/False statement turns TRUE, the State Block generates and outputs a discrete event message in the following manner:
- Outputs if the statement tied to the #1 output turned TRUE
- Outputs if the statement tied to #2 output turned TRUE
- Outputs a message from the top-most port when multiple True/False statements turn TRUE at once
After outputting a discrete event message, the State Block must be reloaded by another incoming discrete event message.
Note: The State Block will not "queue" up multiple incoming discrete event messages - even if multiple message enter the State Block, the block can only output a single discrete event message.
Double-Click Edit Window
Double-click on the block to bring up an edit window:
- Using the column, the user must first select a slot (each slot represents an output port). By using the text box, the user can also label the output port.
- Once an output port is selected, the user can define a custom discrete event in the form of True/False statement on the green canvas using the white arithmetic and boolean icons. When the equation resolves to a True, the State Block will output a discrete event message from the corresponding output port.
By clicking on the "+" icon located at the bottom of the Transitions column, the user can add extra slots and define unlimited number of discrete events. As additional slots are added, corresponding output ports are automatically exposed on the right-side of the block. The user may remove states by selecting a state, and then clicking the "-" icon.
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