Initialization

Configuration

Introduction

The CLI stores its persistent configuration in various places depending on the context of the configuration. We make the distinction between global configuration, Lean configuration, and project configuration, all of which store a specific subset of configurable properties.

Global Configuration

The global CLI configuration directory stores the CLI defaults and API credentials. The exact location of the directory depends on your operating system. The following table shows the path of each operating system:

Operating SystemPath
WindowsC: \ Users \ <username> \ .lean
macOS/ Users / <username> / .lean
Linux/ home / <username> / .lean

The global CLI configuration directory contains three files and one directory. The following table describes the files and directory:

NameDescription
credentialsThis file contains the API credentials given via lean login.
configThis file contains the CLI defaults, like the default project language used when running lean project-create.
cacheThis file contains an internal cache that the CLI uses whenever it needs to persistently store data. One of its uses is to store the last time an update check has run to make sure we don't check for updates too often.
sshThis directory contains the SSH keys that are needed to debug over SSH when debugging with Rider.

The global configuration files are always updated via the CLI and should not be updated or removed manually, unless when you are uninstalling the CLI.

Lean Configuration

The Lean configuration contains settings for locally running the LEAN engine. This configuration is created in the lean.json file when you run lean init in an empty directory. The configuration is stored as JSON, with support for both single-line and multiline comments.

The Lean configuration file is based on the Launcher / config.json file from the Lean GitHub repository. When you run lean init, the latest version of this file is downloaded and stored in your organization workspace. Before the file is stored, some properties are automatically removed because the CLI automatically sets them.

The CLI commands can update most of the values of the lean.json file. The following table shows the configuration settings that you need to manually adjust in the lean.json file if you want to change their values:

NameDescriptionDefault
show-missing-data-logsLog missing data files. This is useful for debugging.true
maximum-warmup-history-days-look-backThe maximum number of days of data the history provider will provide during warm-up in live trading. The history provider expects older data to be on disk.5
maximum-chart-seriesThe maximum number of chart series you can create in backtests.30
maximum-data-points-per-chart-seriesThe maximum number of data points you can add to a chart series in backtests.1,000,000

Project Configuration

For information about project configuration, see Projects > Configuration.

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

Did you find this page helpful?

Contribute to the documentation: