---
title: "Custom Data"
description: "Importing custom data from local files in your algorithm when running the LEAN engine locally"
canonical: https://www.quantconnect.com/docs/v2/lean-cli/datasets/custom-data
markdown: https://www.quantconnect.com/docs/v2/lean-cli/datasets/custom-data.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/05%20Lean%20CLI/05%20Datasets/04%20Custom%20Data
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# Custom Data

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Lean CLI](https://www.quantconnect.com/docs/v2/lean-cli.md) > Datasets > Custom 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. Besides market data, LEAN also supports importing custom data into your algorithm. This page explains how to access data from local files in your algorithm when running the LEAN engine locally.

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.

## Import Local Files

When running LEAN locally using the CLI, you can already use all of the features explained in the [Importing Data](https://www.quantconnect.com/docs/v2/writing-algorithms/importing-data/key-concepts.md) page of the LEAN documentation. However, sometimes you may not want to upload your file to a cloud storage service like Dropbox. You can follow these steps to convert your custom data class (the class extending `PythonData`) to retrieve data from a local file instead of a remote one:

1. Copy the data file that you want to use to the `data` directory in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md).
2. Open the source file containing your custom data class in an editor.
3. Update your `get_source` method to load data from the local file in your `data` directory. Make sure you only use forward slashes. Backward slashes as path separators don't work. For the [Weather](https://www.quantconnect.com/docs/v1/algorithm-reference/importing-custom-data#Importing-Custom-Data-Creating-and-Reading-Custom-Data) example in the LEAN documentation, that is done like this:

   ```python
   import os

   from QuantConnect import Globals, SubscriptionTransportMedium
   from QuantConnect.Data import SubscriptionDataSource
   from QuantConnect.Python import PythonData

   class Weather(PythonData):
       def get_source(self, config: SubscriptionDataConfig, date: datetime, is_live: bool) -> SubscriptionDataSource:
           # Old:
           # source = "https://www.dropbox.com/s/8v6z949n25hyk9o/custom_weather_data.csv?dl=1"
           # return SubscriptionDataSource(source, SubscriptionTransportMedium.REMOTE_FILE)

           # New:
           # Replace custom_weather_data.csv with the path to your data file in the data directory
           source = os.path.join(Globals.data_folder, "custom_weather_data.csv")
           return SubscriptionDataSource(source, SubscriptionTransportMedium.LOCAL_FILE)
   ```
4. Save the source file.
