Skip to content

Latest commit

 

History

History
162 lines (116 loc) · 7.57 KB

INSTALL.adoc

File metadata and controls

162 lines (116 loc) · 7.57 KB

Installation

There are two ways to use roboquant:

  1. Interactively in a Jupyter notebook. If you want to get up and running quickly, and want to experiment with many strategies, this is the best approach. Additionally, you get many charts out-of-the-box.

  2. As a library in your own Kotlin or Java application. If you plan to develop large and complex trading strategies, this is the good approach since you have the full power of an IDE like IntelliJ IDEA at your disposal.

Jupyter Notebook

If you have already Docker installed, it only takes a single command to have a fully functional Jupyter Lab environment available:

docker run --rm -p 8888:8888 roboquant/jupyter

This will pull the image from DockerHub and run it on your local machine. The image comes with several notebooks that demonstrate how to develop and run your own strategies.

If you don’t have Docker yet installed on your computer, check out Docker get started and download Docker for Desktop from there. If you are running Linux, then your distribution likely already has Docker included.

If you don’t want to install anything locally, you can:

  1. Try some same notebooks right now in your browser by clicking: Binder

  2. Go to JetBrains Datalore and create an account there. It supports Kotlin Notebooks and has a free tier available if you just want to try it out.

Standalone Application

Just add roboquant as a dependency to your build tool, like Maven or Gradle.

Maven

<dependency>
    <groupId>org.roboquant</groupId>
    <artifactId>roboquant</artifactId>
    <version>VERSION</version>
</dependency>

Gradle

implementation group: 'org.roboquant', name: 'roboquant', version: 'VERSION'

Next to roboquant, the following additional artefacts are available for inclusion in your application:

  • roboquant-crypto Adds support for many of today’s most popular crypto exchanges

  • roboquant-extra Adds out-of-the-box integrations with 3rd party brokers and market data providers.

  • roboquant-ta Adds support for technical analysis indicators and strategies

  • roboquant-jupyter Adds support for running roboquant inside Jupyter Notebooks

  • roboquant-ibkr Adds support for Interactive Brokers

Building from source

First start with cloning the roboquant GitHub repository to your local disk. The quickest way to be up and running is then to install IntelliJ IDEA (either the free community edition or the paid Ultimate version) and open the directory you just cloned. IntelliJ IDEA will recognize it as Kotlin/Maven project, and you can build it and run test directly from the IDE.

Roboquant uses a directory setup that is similar to most other Kotlin projects:

root
    submodule1
        src/main/kotlin
        src/test/kotlin
    submodule2
        src/main/kotlin
        src/test/kotlin

All source code is written in Kotlin, so there are no Java or other language source files.

Roboquant uses Maven for the build process and assuming you already have this installed, building and installing the libraries locally, is as easy as:

mvn clean install

The build and install is tested using JDK 17 runtime, however the generated libraries are targeted against JDK 11 in order to provide better compatibility for projects that still use older versions of the JDK.

Tip
If you plan to make many changes and updates to the source code, checkout the Maven Daemon project that provides much faster builds. It is an almost 100% drop-in replacement of the regular maven and is much faster.

If you want to deploy a release (and not just a SNAPSHOT) to Maven Central, use the -P release option. This will then also generate source- and documentation-jar files which are mandatory when deploying a release to Maven Central. It will also always build and deploy the roboquant-ibkr module, so you’ll need the locally install IBKR Java client library.

mvn clean deploy -P release

Of course this requires the having the right credentials for deploying to the Maven Central repo.

Interactive Brokers

If you don’t require integration with Interactive Brokers for your trading, you can skip this step.

Unfortunately it is not allowed to redistribute the Interactive Brokers Java client, so you’ll have to download the TwsApi.jar file yourself. You can download version 10.20 from here: https://interactivebrokers.github.io/# and within the downloaded archive file you’ll find the required TwsApi.jar.

Then install the jar file in the local Maven repository on your machine using the following command:

mvn install:install-file -Dfile=TwsApi.jar -DgroupId=com.interactivebrokers -DartifactId=tws-api -Dversion=10.20 -Dpackaging=jar

After this step, you can install the modules including the roboquant-ibkr module

mvn install -P ibkr
Warning
If the artefact cannot be found in your local Maven repository during a build, the ibkr profile with the module roboquant-ibkr will be skipped.

Documentation

There is a special doc profile to generate documentation and see if there is something missing

mvn dokka:dokka -P doc

Please note the release profile has its own dokka task to generate a javadoc jar file.

Performance Test

To run the built-in performance test, you can use the following command

mvn test -Dtest="org.roboquant.PerformanceTest" -DTEST_PERFORMANCE -pl roboquant

The output should look something like this:

[main] INFO org.roboquant.PerformanceTest - ******  500.000 candlesticks  ******
[main] INFO org.roboquant.PerformanceTest -      feed filter                            92 ms
[main] INFO org.roboquant.PerformanceTest -      base run                               91 ms
[main] INFO org.roboquant.PerformanceTest -      parallel runs (x4)                    170 ms
[main] INFO org.roboquant.PerformanceTest -      extended run                          440 ms
[main] INFO org.roboquant.PerformanceTest - ******  1.000.000 candlesticks  ******
[main] INFO org.roboquant.PerformanceTest -      feed filter                           172 ms
[main] INFO org.roboquant.PerformanceTest -      base run                              186 ms
[main] INFO org.roboquant.PerformanceTest -      parallel runs (x4)                    415 ms
[main] INFO org.roboquant.PerformanceTest -      extended run                         1345 ms
[main] INFO org.roboquant.PerformanceTest - ******  5.000.000 candlesticks  ******
[main] INFO org.roboquant.PerformanceTest -      feed filter                           874 ms
[main] INFO org.roboquant.PerformanceTest -      base run                              906 ms
[main] INFO org.roboquant.PerformanceTest -      parallel runs (x4)                   1003 ms
[main] INFO org.roboquant.PerformanceTest -      extended run                        10161 ms
[main] INFO org.roboquant.PerformanceTest - ******  10.000.000 candlesticks  ******
[main] INFO org.roboquant.PerformanceTest -      feed filter                          1890 ms
[main] INFO org.roboquant.PerformanceTest -      base run                             1817 ms
[main] INFO org.roboquant.PerformanceTest -      parallel runs (x4)                   1989 ms
[main] INFO org.roboquant.PerformanceTest -      extended run                        11821 ms