Python 3.9+

This page guides you through the steps required to backtest your strategy in Algorum Cloud in Python 3.9+

Now that you have tested your strategy logic locally, let us deploy it onto Algorum Cloud for faster and reliable backtesting.

Create Docker Image for your strategy

Algorum runs your strategy in Algorum Cloud using Docker Image of your strategy. So, first step is to download and install the Docker Desktop for your OS. If you are on a Linux desktop like Ubuntu 20.4, use the URL Install Docker for Linux to install Docker Engine. Docker Desktop for Linux (DD4L) is coming soon, Watch out for it here.

Once the Docker Desktop or Docker Engine is installed, add a Docker File to your Python project root folder.

Docker file sample

FROM python:3.9-slim
WORKDIR /app
COPY src/requirements.txt src/requirements.txt
RUN pip3 install -r src/requirements.txt
COPY src/ src/
CMD ["python3", "src/main.py"]

As you can see in the above docker file sample, we are running the pip3 install command with the requirements.txt file that contains the dependencies that our strategy project requires. Below is the requirements.txt file for our strategy project.

jsonpickle
websocket-client
algorum-quant-client-py3~=1.0.19

Once the docker file is ready, use the below docker command to create a docker image for your strategy project.

docker build -t algorumstrategygoldencrossover .
sudo docker build -t algorumstrategygoldencrossover .

This will build the docker image for your strategy with the name algorumstrategygoldencrossover. Now that you have your strategy docker image, let us see how to create a strategy container in Algorum Cloud and upload your strategy docker image to it.

Create Strategy in Algorum Cloud

Using Algorum CLI strategy-create command, you can create your strategy container in Algorum Cloud. This command just needs a strategy name and an optional description.

977

Algorum CLI - Create a Strategy

Upload Strategy Docker Image to your Strategy in Algorum Cloud

After a strategy is created in Algorum Cloud, upload your strategy docker image from your local system to Algorum Cloud using the strategy-package-push command. This command takes the name of the strategy in Algorum Cloud where you wan to push your docker images, and the docker image name from your local docker repository. If you want to see the list of docker images in your local docker repository use the docker-images Algorum CLI command.

976

Algorum CLI - Uploading Strategy Docker Image

Starting backtest for your strategy in Algorum Cloud

Use strategy-backtest command to start the backtest for your strategy. This command takes strategy name, backtesting start date, end date and brokerage API Key and Secret Key (applicable in Alpaca Brokerage Platform users). It will start the backtest on Algorum Cloud, and will keep pushing the progress and metrics events to the Algorum CLI console.

977

Algorum CLI - Backtesting a Strategy