Datasets
Generating Data
Introduction
Running the LEAN engine locally with the CLI requires you to have your own local data, but real market data can be expensive and governed by difficult redistribution licenses. Instead of using actual market data, you can also opt to use realistic fake data by using LEAN's random data generator. This generator uses a Brownian motion model to generate realistic market data. It is capable of generating data for most of LEAN's supported security types and resolutions, which makes it a good solution to design and test algorithms without the need to buy real financial data.
Run the Generator
Follow these steps to generate random data:
- Open a terminal in one of your organization workspaces.
-
Run
lean data generate --start 20150101 --symbol-count 10
to generate dense minute Equity data since 01-01-2015 for 10 random symbols.$ lean data generate --start 20150101 --symbol-count 10 Begin data generation of 10 randomly generated Equity assets...
You can also specify an end date using
--end <yyyyMMdd>
, generate data for a different security type using--security-type <type>
, for a different resolution using--resolution <resolution>
, or with a different density using--data-density <density>
.For a full list of options, run
lean data generate --help
or see Options.
The following image shows an example time series of simulated data: