---
title: "Generating Data"
description: "Generate random data to run backtest locally by Lean CLI"
canonical: https://www.quantconnect.com/docs/v2/lean-cli/datasets/generating-data
markdown: https://www.quantconnect.com/docs/v2/lean-cli/datasets/generating-data.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/05%20Lean%20CLI/05%20Datasets/03%20Generating%20Data
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# Generating Data

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Lean CLI](https://www.quantconnect.com/docs/v2/lean-cli.md) > Datasets > Generating Data

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

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

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.

## Supported Security Types

The random data generator supports the following security types and resolutions:

| 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) |  |  |

## Supported Densities

The random data generator supports the following densities:

| Density | Description |
| --- | --- |
| Dense | At least one data point per resolution step. |
| Sparse | At least one data point per 5 resolution steps. |
| VerySparse | At least one data point per 50 resolution steps. |

## Run the Generator

Follow these steps to generate random data:

1. Open a terminal in one of your [organization workspaces](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md).
2. 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](https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-data-generate.md#03-Options).

The following image shows an example time series of simulated data:

![time series of simulated data](https://cdn.quantconnect.com/tutorials/i/random-data.png)
