There are two different ways to install and use roboquant:
Interactively in a Jupyter Notebook. If you want to be up and running quickly, this is the easiest approach. Also, if you are less experienced software developer, this is a good starting point. Additionally, you get many charts out-of-the-box that help you to understand how the strategy is performing.
As a library in your standalone Kotlin or Java application. If you plan to develop large and complex trading strategies, this is a good approach since you’ll have the full power of an IDE like IntelliJ IDEA at your disposal.
Install Jupyter Notebook
If you have already Docker installed on your local machine, all it takes is a single command to have a fully functional Jupyter Notebook environment available that is ready to use.
docker run --rm -p 8888:8888 roboquant/jupyter
By default, this will start a new Jupyter-Lab environment and disposes of it as soon as you stop the container. The installation comes with several how-to notebooks included 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 use a publicly hosted notebook environment. Launch the notebooks right now on MyBinder.org by clicking|
The AWS SageMaker notebook instances don’t have Kotlin support enabled by default. But there is an easy way to add it the first time an instance is created. You can add a
lifecycle script that will be run when the environment is created and in our case add the Kotlin kernel.
When creating a new notebook instance from the SageMaker menu, open the
additional configuration option and select
create new lifecycle configuration from the lifecycle configuration dropdown. Then add the following snippet to the
Start notebook tab.
#!/bin/bash set -eux # This script installs the Kotlin kernel before starting the notebook sudo -u ec2-user -i <<'EOF' source /home/ec2-user/anaconda3/bin/activate JupyterSystemEnv pip install kotlin-jupyter-kernel source /home/ec2-user/anaconda3/bin/deactivate EOF
This has been tested with the platform identifier set to "Amazon Linux 2/Jupyter Lab 3" and "Give users root access to the notebook" enabled (default).
Install the roboquant libraries
roboquant as a dependency to your build tool, like Maven or Gradle. Regular versions of the Roboquant modules are published to Maven Central and snapshots are published to OSS Sonatype (https://s01.oss.sonatype.org/content/repositories/snapshots).
The latest available versions:
The following modules are available for inclusion in your application:
roboquant: the core module of the platform
roboquant-crypto: support for many of today’s popular crypto exchanges
roboquant-extra: integrations with 3rd party brokers and market data providers
roboquant-ibkr: integration with Interactive Brokers
roboquant-ta: over 150 technical analysis indicators and strategies
roboquant-jupyteradditional Jupyter Notebook functionality like charting
Add the following snippet to your pom.xml file in the dependencies section:
<dependency> <groupId>org.roboquant</groupId> <artifactId>roboquant</artifactId> <version>VERSION</version> </dependency>
Include the following line in your build.gradle script:
implementation group: 'org.roboquant', name: 'roboquant', version: 'VERSION'
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 the libraries locally, is as easy as:
The build and install is tested using JDK 17 runtime, however the generated libraries are targeted against JDK 11 in order to provide greater compatibility for projects that still use older versions of the JDK.
If you plan to make regular changes and updates to the source code, checkout the Maven Daemon project that provides faster builds. Additionally, you can set the Kotlin incremental compiler property to true (in the main
Unfortunately we are 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.17 from here: https://interactivebrokers.github.io and within the downloaded archive file you’ll find the required
Then install the jar file in your 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.17 -Dpackaging=jar
If this artefact cannot be found in your local Maven repository during a build, the module
roboquant-ibkr will automatically be skipped. So if you don’t require integration with Interactive Brokers for your trading, you can skip this step all together.