Integration

There are several types of integrations available with 3rd parties:

  • Historic data feeds

  • Live data feeds

  • Brokers implementations

  • Exchange rates

In some cases a single 3rd party provides all types of functionality, or sometimes they are just specialised for a subset. You can combine several of these 3rd parties together in a single run, for example use a data feed from one provider and the broker functionality from another one.

One of the design principles is that roboquant tries to avoid exposing 3rd party APIs directly and typically wraps them in roboquant equivalent types. This makes it easier to switch between different providers and also reduces the learning curve.

Modules & Packages

The third party integrations have their own modules and are not part of the core roboquant module:

  • roboquant-extra for the "traditional" broker and data feed providers

  • roboquant-crypto for cryptocurrency related 3rd parties

  • roboquant-ibkr for Interactive Brokers

Include these modules in your Maven or Gradle build. Except roboquant-ibkr, they are by default included in the Jupyter Notebooks.

In order to use the 3rd party integration, you’ll first have to import the package. All third party integration have their own package directly under org.roboquant. So you can import all the required classes for OANDA as follows:

import org.roboquant.oanda.*

Configuration

When you want to integrate with a 3rd party, you most likely require credentials to gain access to their APIs. Often this is in the form of an API key and secret. You can of course embed these credentials directly in your source code, however roboquant offers better and more secure alternatives.

The following list shows the steps how roboquant resolves these configuration parameters:

  1. If the credentials are provided directly in the code when calling the API use these, otherwise go to next step.

  2. If the credentials are provided as startup parameter to the JVM with the -D syntax use these, otherwise go to next step.

  3. If the credentials are set as system environment variable (export MY_KEY="some value") use these, otherwise go to next step.

  4. If the credentials are set in a property file called ".env" in the working directory use these, otherwise go to next step.

  5. If the credentials are set in a property file called "dotenv" in the working directory use these, otherwise go to next step.

  6. If the credentials are set in a property file called ".env" in the $HOME/.roboquant directory use these, otherwise go to next step.

The following provides an overview of the used properties in roboquant

# This property file contains environment settings that will be made available in roboquant
# Many data providers and brokers require authentication and this is one of the ways to provide those credentials
#
# If you store credentials in here, make sure other people don't have access to it and for example don't version control
# it to a public repo by mistake.

# Sample entry
sample.public.key=some_key_value
sample.secret.key=another_key_value

# Uncomment the following two lines and change the values for Alpaca API access
# alpaca.public.key=your_api_key_id
# alpaca.secret.key=your_api_secret_key

# Uncomment the following two lines and change values for IEX Cloud access
# iex.public.key=your_publishable_key
# iex.secret.key=your_secret_key

# Uncomment the following line and change the value for Alpha Vantage access
# alphavantage.key=your_api_key

# Uncomment the following two lines and change the values for Binance access
# binance.public.key=your_key
# binance.secret.key=you_secret

# Uncomment the following two lines and change the values for OANDA access
# oanda.account=your_account
# oanda.key=your_key

Supported 3rd parties

The following table shows which 3rd parties are supported out of the box and what functionality the integration offers:

3rd party Historic feed Live feed Broker Exchange rates

Interactive Brokers

Alpaca

OANDA

IEX Cloud

Yahoo Finance

Alpha Vantage

Binance

Crypto Exchanges

ECB

roboquant is open source software that is developed independently of these 3rd party companies. There are no direct or indirect ties to any of these companies.

Adding new 3rd party integrations

Adding integration with a 3rd party is not hard. Integration with 3rd party data providers is straight forward and requires implementing a single interface. Depending on the client library that is available, this could take as little as a few hours to a few days. You can read more about the Feed interface that you need to implement right here

Integrating with a new broker is also not hard but requires more effort. The most amount of work will be the translation of object exposes by the broker versus those used by roboquant. For example an Order in roboquant might be slightly different from an Order expected by the client library of the broker and a conversion needs to happen.

For both custom Feed and Broker integrations, it is recommended to first look at some existing integrations and use them as a starting point. And if you have questions, you can always reach out via one of the channels mentioned on the community page