AlgoTraderAlgoTrader Documentation

Appendix K. Example Strategy "Dividend Capture"

The purpose of this strategy is to only illustrate the concept of capturing the dividend.

The idea is to receive a dividend from a company by holding its stock prior to ex-date.

The Strategy enters a LONG position as soon as dividend date is announced and closes the position on ex-date thus obtaining the right to the dividend.

This strategy requires a dividend event feed, which the Intrinio adapter provides. You therefore need an Intrinio API key to run it.

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

The Dividend Capture Strategy consist of the following artifacts:

/src/main/java/ch/algotrader/strategy/dividends/DividendCaptureService.java

The strategy service class providing the main methods invoked by the application on certain events.

/src/main/resources/conf-dividends.properties

Contains parameters used by the strategy (e.g. tradableSecurities and dividendAdapter and orderQuantity and accountId)

/src/main/resources/db/mysql/mysql-data.sql

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

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

To setup the strategy for back testing and live trading on a development workstation please execute the following steps:

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:

https://gitlab.algotrader.ch/general/examples/blob/master/dividend-capture/docker-compose.yml

Run docker compose

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

docker-compose up -d

Note

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