Contents
Open Source
Generating Random Backtest Data
Introduction
Real market data is often expensive and governed by difficult redistribution licenses. QuantConnect wanted to give the LEAN users a way to design and test their algorithms, without needing to download and buy real financial data. The RandomDataGenerator seeks to address that by randomly generating data in the LEAN format, for the various asset types we support.
Using the Random Data Generator
The LEAN Random Data Generator is located in the LEAN ToolBox and can be accessed by executing the QuantConnect.ToolBox.exe
CLI program.
We recommend cloning LEAN and building from the source code directly from Github. However, if this is not possible for you we have made a snapshot of the build available for your convenience here:
2019-01-19-QuantConnect.ToolBox.Binaries.zip
To run the ToolBox open a command window and execute it from the command line. To execute it you will need C# or Mono installed:
Windows:
.\QuantConnect.ToolBox.exe --app=randomdatagenerator
Linux and Mac:
mono QuantConnect.ToolBox.exe --app=randomdatagenerator
Complete Example:
QuantConnect.ToolBox.exe --app=randomdatagenerator --resolution=Minute --from-date=2018-01-01 --to-date=2019-01-01 --market=usa --data-density=Dense --include-coarse=true --symbol-count=100
The Random Data Generator has many parameters you can configure to generate the various datasets LEAN supports. Please see the next section for documentation on these parameters.
Command Parameters
Random Data Generator Parameters | |
---|---|
security-type | Security type to generate. --security-type=Equity
|
resolution | Resolution of data to store. --resolution=Minute
|
from-date | Start date for the data to generate: format yyyy-mm-dd. --from-date=2018-01-01
|
to-date | Final date of the generated data: format yyyy-mm-dd. --to-date=2019-01-01
|
Symbol Count | Number of tickers to generate --symbol-count=100
|
data-density | Tick density of the data generated to model low volume data. --density=Dense
|
include-coarse | Generate the coarse universe data when generating Equity data. --include-coarse=true
|
Supported Assets and Resolutions
The Random Data Generator currently supports the following asset types and resolutions:
Supported Data Types and Resolutions | |
---|---|
Equity Trade Only | Resolutions Tick, Second, Minute, Hour and Daily All Equity data resolutions are supported. |
Forex, CFD Quotes Only |
Resolutions Tick, Second, Minute, Hour and Daily
Forex and CFD generator supports quote (spread) data in all resolutions. |
Futures, Crypto Trades and Quotes | Resolutions Tick, Second, Minute, Hour and Daily All Futures and crypto data types and resolutions are supported |
Options Trades and Quotes | Resolution Minute Options are partially supported. Currently option random data is generated independent of a random underlying asset making its usefulness limited. This will be fixed by Github Issue #2839. |
Final Notes
The Random Data Generator uses Brownian motion to generate the data prices. You can see how these prices and ticker strings are generated in the RandomValueGenerator class.
If you'd like to use a different system for providing the randomness you can implement your own IRandomValueGenerator
or
extend the RandomValueGenerator
class.
You can also see our Documentation and Videos. You can also get in touch with us via Chat.
Did you find this page helpful?