Skip to content

Conversation

@MarcDahlem
Copy link
Contributor

@MarcDahlem MarcDahlem commented Apr 22, 2021

Added an adapter which allows to backtest a strategy with ta4j given a recorded ta4j baseseries as json.

Some remarks/limitations:

  • The simulation adapter is based on a current "tick", which is increased every time the "getTicker" is called
    • This means especially, that a strategy must call getTicker in its execute phase at all
    • This means especially, that a strategy most not call getTicker multiple times in the same execution phase
  • JSON handling
    • It is assumed, that the recorded base series (and stored as json) added every ticker update from the real market in an own "bar"
    • Furthermore it is assumed, that the getHigh of each bar contains the ask-price
    • Furthermore it is assumed, that the getLow of each bar contains the bid-price
    • An example on how to capture a barseries and how to store it to json will be added in an example strategy
  • ta4j can't differentiate costs for sell and buy orders, thats why only one fee can be configured
  • one can configure if the recorded and backtested orders should be printed to a graph. This needs a display (x11) to be available for the java runtime
  • For comparison reasons, a rudimentary "optimal order" calculation is added
  • As the backend cannot be stopped normaly (as far as I saw), the ta4j-simulation adapter throws a tradingApiException as soon as the end of the available barseries is reached
  • Orders are "recorded" in ta4j rules as execution indexes for buy and sell order. This concept only works, if a strategy places only at least one order at a execution phase
    • Only one open order is allowed at a time tick. Normal flow: place BUY order, wait for BUY to fulfill, place SELL order, wait for SELL order to fulfill
  • As the gradle build was very slow, I added the following as suggested by many answers on stack overflow and co. https://docs.spring.io/dependency-management-plugin/docs/current/reference/html/#maven-exclusions-disabling

@MarcDahlem MarcDahlem changed the title Feature/ta4j backtesting WIP: Feature/ta4j backtesting Apr 22, 2021
@MarcDahlem MarcDahlem changed the title WIP: Feature/ta4j backtesting Feature/ta4j backtesting Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ToDo

Development

Successfully merging this pull request may close these issues.

2 participants