Building your first algo

Building your first algo

Blocks and connections for your algo

Below are the blocks and connections used in this tutorial.

To build this entry-exit order algo, you will use the following blocks.

  • Main trading blocks
  • Supporting blocks

Main trading blocks

This entry-exit algo uses two main trading blocks:

  • Instrument block


    The Instrument block provides access to market data for contracts you want to trade using an ADL algo. This algo uses only one contract, so you will need to add one Instrument block.

  • Order block


    The Order block submits buy or sell orders to an exchange. It specifies the order type, such as Limit or Market, and identifies the instrument, price and quantity through its input ports. For this algo, you will need to add two Order blocks, one for the entry Buy order and one for the exit Sell order.

Supporting blocks

Between the Instrument block and the Order block, you use other blocks that support the algo by extracting market data, specifying quantities, and accessing information from messages. This entry-exit algo uses the following supporting blocks:

  • Field block


    The Field block lets you extract market data from an Instrument, such as prices and quantities, that you can then use in your algo. This algo uses two Field blocks to get the bid price for the Buy order and the ask price for the Sell order.

  • Number block


    The Number block outputs a numerical value. This algo uses the Number block to set the order quantity to 1.

  • MsgInfo Extractor block


    The MsgInfo Extractor block lets you extract information from a discrete event message generated by another block, such as an Order block. This algo uses a MsgInfo Extractor block to capture the quantity of the fill for the Buy order managed by the Buy Order block.

After placing the blocks needed for the algo, you need to connect the inputs and outputs of the blocks to indicate how data will flow through the algo and between blocks.

  • Connections to access market data from the Instrument block
  • Connections to send the market data and other information to the Order blocks
  • Connections to extract information from one Order block and send it to another.