Locally backtest your strategy

This page will guide you through the steps to backtest your strategy locally

Let us do a small backtest with our strategy locally in different programming platforms supported by Algorum, to ensure our algo logic is working and behaving as expected.

.NET 5 & C#

Python 3.9+

๐Ÿ“˜

Historic data for backtesting

For USA users, the historic data for backtesting is directly streamed from their Alpaca Data Subscription. Ensure that you are on the Unlimited plan of Alpaca for the historic data streaming to work without Alpaca API rate limits.

For India users, the historic data for backtesting is provided as part of your Algorum subscription itself (no extra charges). During testing phase, we enable historic data for F&O segment from Jan 2018 till Jan 31 2022. For cash segment the historic data is available from Jan 01 2021 till Jan 31 2022. For cash segment, this is very limited data, and will be expanded for last 4 years very soon (checkout this section later). For NIFTY 50 and BANKNIFTY indices we have historic tick data from Jan 01 2020 till Jan 31 2022. This will also be expanded for last 4 years very soon (checkout this section later).

๐Ÿšง

Common issues during local backtesting

Backtest connection to your quant engine closes immediately after connecting.

This could happen if you had refreshed your Algorum API Key, but you are using the old API key in your strategy code. Always use the current Algorum API Key

Backtest is stuck at "Open" log message?

When your local backtest is stuck at a log message with text "Open", you probably have to look at the below and make sure they are correct...

India Users

Make sure the stock symbol information you gave is correct when subscribing for the symbols

USA Users

  1. Make sure the stock symbol information you gave is correct when subscribing for the symbols
  2. Make sure the Alpaca API and Secret Key are correct and valid, and you have the "Unlimited" data plan from the Alpaca.

Other possibility is that your preload candles call is taking time to preload the candles for the given back period. So wait for a few more seconds before you see any backtest progress output.

In case your backtest is still not showing up any thing on the screen!!

In this case you have to investigate your logs using Algorum CLI log listing & download commands ...

Algorum CLI Log Commands