---
title: "lean data generate"
description: "API reference for the command `lean data generate` in command line console."
canonical: https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-data-generate
markdown: https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-data-generate.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/05%20Lean%20CLI/99%20API%20Reference/26%20lean%20data%20generate
modified: 2026-10-28
index: https://www.quantconnect.com/llms.txt
---

# lean data generate

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Lean CLI](https://www.quantconnect.com/docs/v2/lean-cli.md) > [API Reference](https://www.quantconnect.com/docs/v2/lean-cli/api-reference.md) > lean data generate

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Generate random market data.

```
$ lean data generate [OPTIONS]
```

To use the CLI, you must be a member in an [organization](https://www.quantconnect.com/docs/v2/cloud-platform/organizations/tier-features.md) on a paid tier.

## 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 default values.

If `--end <yyyyMMdd>` isn't 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 map files, factor files, and coarse universe data. To not generate coarse universe data, set the `--include-coarse `option to `false`.

The following combinations of security types and resolutions are supported:

| Security Type Security Type | Supported Resolutions Tick | Second | Minute | Hour | Daily |
| --- | --- | --- | --- | --- | --- |
| Equity | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| Forex | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| CFD | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| Future | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| Crypto | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| Option |  |  | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |  |  |

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:

| Option | Description |
| --- | --- |
| `--start <yyyyMMdd>` | [required] |
| `--end <yyyyMMdd>` | End date for the data to generate in yyyyMMdd format (defaults to today) |
| `--symbol-count <integer> <range>` | [x>=0] |
| `--tickers <string>` | Comma separated list of tickers to use for generated data |
| `--security-type <enum: Equity                        Forex                        Cfd                        Future                        Crypto                        Option>` | The security type to generate data for (defaults to Equity) |
| `--resolution <enum: Tick                     Second                     Minute                     Hour                     Daily>` | The resolution of the generated data (defaults to Minute) |
| `--data-density <enum: Dense\|Sparse\|VerySparse>` | The density of the generated data (defaults to Dense) |
| `--include-coarse <boolean>` | Whether coarse universe data should be generated for Equity data (defaults to True) |
| `--market <string>` | The market to generate data for (defaults to standard market for the security type) |
| `--quote-trade-ratio <float>` | The ratio of generated quotes to generated trades. Values larger than 1 mean more quotes than trades. Only used for Option, Future and Crypto (defaults to 1) |
| `--random-seed <integer> <range>` | The random number generator seed. Defaults to None, which means no seed will be used [x>=0] |
| `--ipo-percentage <float>` | The probability each equity generated will have an IPO event. Note that this is not the total probability for all symbols generated. Only used for Equity (defaults to 5.0) |
| `--rename-percentage <float>` | The probability each equity generated will have a rename event. Note that this is not the total probability for all symbols generated. Only used for Equity (defaults to 30.0) |
| `--splits-percentage <float>` | The probability each equity generated will have a stock split event. Note that this is not the total probability for all symbols generated. Only used for Equity (defaults to 15.0) |
| `--dividends-percentage <float>` | The probability each equity generated will have dividends. Note that this is not the probability for all symbols genearted. Only used for Equity (defaults to 60.0) |
| `--dividend-every-quarter-percentage <float>` | The probability each equity generated will have a dividend event every quarter. Note that this is not the total probability for all symbols generated. Only used for Equity (defaults to 30.0) |
| `--option-price-engine <string>` | The stochastic process, and returns new pricing engine to run calculations for that option (defaults to BaroneAdesiWhaleyApproximationEngine) |
| `--volatility-model-resolution <enum: Tick                                      Second                                      Minute                                      Hour                                      Daily>` | The volatility model period span (defaults to Daily) |
| `--chain-symbol-count <integer> <range>` | [x>=0] |
| `--image <string>` | The LEAN engine image to use (defaults to quantconnect/lean:latest) |
| `--update` | Pull the LEAN engine image before running the generator |
| `--lean-config <file>` | The Lean configuration file that should be used (defaults to the nearest lean.json) |
| `--verbose` | Enable debug logging |
| `--help` | Display the help text of the `lean data generate` command and exit |
