API Reference

lean data generate

Introduction

Generate realistic market data.

$ lean data generate [options]

Description

Runs the random data generator in the LEAN ToolBox to generate realistic market data using a Brownian motion model. Requires --start <yyyyMMdd> and --symbol-count <amount> to be set, the rest of the options have defaults.

If --end <yyyyMMdd> is not set data is generated from the start date until the current date. If the --end option is set data is generated between the given --start and --end values (inclusive).

By default dense data is generated, which means the generated data contains at least one data point per resolution step. You can use --data-density Sparse to change this to at least one data point per 5 resolution steps, or --data-density VerySparse to change it to at least one data point per 50 resolution steps.

If the security type is set to Equity this command will automatically generate coarse universe data. Use the --include-coarse false option to disable this behavior.

The following combinations of security types and resolutions are supported:

Security typeSupported resolutions
EquityTick, Second, Minute, Hour, and Daily
ForexTick, Second, Minute, Hour, and Daily
CFDTick, Second, Minute, Hour, and Daily
FutureTick, Second, Minute, Hour, and Daily
CryptoTick, Second, Minute, Hour, and Daily
OptionMinute

By default, the official LEAN engine image is used. You can override this using the --image <value> option. Alternatively, you can set the default engine image for all commands using lean config set engine-image <value>. The image is pulled before running the random data generator if it doesn't exist locally yet or if you pass the --update flag.

Options

The lean data generate command supports the following options:

OptionDescription
--start <yyyyMMdd>The inclusive start date for the data to generate in yyyyMMdd format. Must be at least 19980101.
--end <yyyyMMdd>The inclusive end date for the data to generate in yyyyMMdd format (defaults to today).
--symbol-count <value>The number of symbols to generate data for.
--security-type <value>The security type to generate data for (defaults to Equity). Must be one of Equity, Forex, Cfd, Future, Crypto or Option.
--resolution <value>The resolution of the generated data (defaults to Minute). Must be one of Tick, Second, Minute, Hour or Daily. See the description for the supported combinations of security types and resolutions.
--data-density <value>The density of the generated data (defaults to Dense). Must be one of Dense (at least one data point per resolution step), Sparse (at least one data point per 5 resolution steps), or VerySparse (at least one data point per 50 resolution steps).
--include-coarse <true/false>Whether coarse universe data must be generated for equity data (defaults to true).
--market <market>The market to generate data for. This option defaults to LEAN's default market for the requested security type.
--image <value>The LEAN engine image to use (defaults to quantconnect/lean:latest).
--updatePull the LEAN engine image before running the generator.
--lean-config <path>The Lean configuration file that should be used (defaults to the nearest lean.json file).
--verboseEnable debug logging.
--helpDisplay the help text of the lean data generate command and exit.

You can also see our Videos. You can also get in touch with us via Chat.

Did you find this page helpful?

Contribute to the documentation: