AlgoTraderAlgoTrader Documentation

Chapter 9. Database

9.1. Data Source

AlgoTrader uses MySQL to store transaction data. In addition an embedded in-memory H2 database can be used for simulations.

AlgoTrader uses the database migration library flyway to keep databases in-line with the current version of AlgoTrader

The directory /bootstrap/conf contains all relevant database files:

With the embedded database H2 all H2 scripts that are available in the class path under the following wild card pathname will be loaded by the system: h2/h2-*.sql and /db/h2/h2-*.sql.

AlgoTrader provides different Data Source for different scenarios. One of the available Data Sources needs to be configured via the following VM argument:

-Dspring.profiles.active=<dataSource>

dataSource can be one of the following

  • pooledDataSource: A Data Source that uses connection pooling based on C3P0

  • singleDataSource: A Data Source that uses one single database connection and no connection pooling.

  • embeddedDataSource: An H2 based in-memory / in-process Data Source that is ideal for simulation of strategies. Using the embeddedDataSource reduces the duration of back-test runs by 30%-50% and allows multiple parallel simulations on the same machine without needing to installing a physical database.