AlgoTraderAlgoTrader Documentation

Appendix D. Example Strategy "IPO"

The strategy trades US equity IPOs (initial public offering). When a new stock is launched on the exchange for the first time the strategy tries to realize trading profits of the first trading day. New IPOs are announced on web pages like IPOScoop together with an indicative open price.

The IPO strategy is equipped with the following HTML5 custom widget which displays currently active IPOs and allows adding and removing IPOs while the strategy is running


It might be necessary to fully reload the browser on first startup to show the custom widget using Ctrl + Shift + R.

Inside the custom widget the user can enter a new IPO to be traded by populating the following fields:

  • Symbol to be traded

  • SecurityFamily the symbol belongs to

  • Limit The maximum limit price of the initial order

  • Multiplier to be applied to the opening price for secondary orders (see below)

For each symbol entered, the strategy will place orders at a configurable time in the morning (e.g. 4:30am).


Trading of IPOs usually starts within 2-3 hours after the official market open


  • Cash commitment = starting capital / number of symbols to be traded

  • Quantity per symbol = cash commitment / user-defined limit price

The strategy will place a limit-at-the-open order at user-defined limit price for the entry quantity specified above. Using a limit-at-the-open order will cause the order to participate in the opening auction of the IPO.

Immediately following the open of regular trading, the strategy will check to see if the entire cash commitment for the given symbol has been exhausted.

  1. If it has been exhausted, no further action will be taken

  2. If the cash commitment has not been exhausted and the stock opened above the LIMIT PRICE, the unfilled quantity will be cancelled, and no further action will be taken by the strategy.

  3. Otherwise, if the cash commitment for the name has NOT been exhausted a secondary limit order is placed as per below:

  • Remaining cash = Cash commitment - cash used on current position

  • Quantity per symbol = Remaining cash / opening price

  • Limit price = opening price * MULTIPLIER (e.g. 1.02)

If the secondary order is not filled by a configurable end time (e.g. 3:30pm), it will be cancelled by the system.

Immediately after executing any buy orders, the strategy will place a market-on-close order for the entire position.

The main artifacts needed for the Implementation of a new Strategy are described in Chapter 4, Strategy Development.

The following list will give an overview of the specific artifacts implemented by the IPO Strategy (Note: Most of the functionality is documented via Javadoc or Esper comments):


The strategy service class providing the main trading logic


Java POJO class representing a single IPO


Esper Module containing all statements for this strategy:

  • SEND_ATO_ORDERS: sends out at-the-open orders at the configured

  • SEND_LIMIT_ORDERS: triggers the secondary order service once the at-the-open order has been fully executed and the official open price (via GenericTickVO) has been disseminated. An Esper Join is used for this since either one of those events can arrive first

  • CLOSE_OPEN_ORDERS : cancels all orders at the configured time

  • DAILY_CLEAN_UP: unsubscribes all market data and resets the list of IPOs an initial capital


Contains default parameters used by the strategy


Contains Esper variables for the strategy


Contains ipoConfigParams, ipoEngine & ipoService.


Contains the MySQL database records. Needs to be imported into the database before running the strategy with the MySQL database.


HTML5 and JavaScript files needed for the strategy custom web UI

To start the Strategy please see the explanations in Chapter 3, Starting AlgoTrader.

To start the strategy in live trading mode on a development workstation please execute the following steps:

To start the strategy in live trading mode on a productive server please execute the following steps:

Copy docker compose file

Copy the following file to the server and make changes as needed:

Run docker compose

Invoke the following command inside the directory where the docker-compose.yml file is located:

docker-compose up -d


Prior to starting the strategy for the very first time please start the AlgoTrader server by itself by executing the following command inside /bootstrap/launch. this will load the MySQL sample data

docker-compose up -d mysql ibgateway algotrader