User Guides

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 configuration is the place in which CLI defaults and API credentials are stored. The exact location of the global configuration files varies by operating system:

  • Windows: C:\Users\<username>\.lean
  • macOS: /Users/<username>/.lean
  • Linux: /home/<username>/.lean

The global configuration is divided into three files and one directory:

  • credentials: This file contains the API credentials given via lean login.
  • config: This file contains the CLI defaults, like the default project language used when running lean create-project.
  • cache: This 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.
  • ssh: This 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 running the LEAN engine locally. 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 repository. When you run lean init the latest version of this file is downloaded and stored on your local drive. Before the file is stored, some properties are automatically removed because the CLI sets them automatically.

Project configuration

Project-specific configuration is stored in the project directory in the config.json file. This file is automatically generated when you run lean create-project or lean cloud pull. Just like the global and Lean configuration files, the project configuration is stored as JSON but without support for comments. The following properties are stored in the config.json file:

  • description: This property contains the project's description, which is displayed in backtest reports. It must always be a string.
  • parameters: This property is a key/value object containing the project's parameters. Both the keys and the values must be strings. See ParametrizedAlgorithm.py and ParametrizedAlgorithm.cs for examples of how to retrieve parameters in your algorithm.
  • cloud-id: This property is set automatically after the project has been pulled from or pushed to the cloud. It contains the id of the project's counterpart in the cloud and must not be modified or removed manually.
  • local-id: This property is set automatically when the CLI needs to uniquely identify the current project. It contains a unique id that is specific to the project and must not be modified or removed manually.
  • algorithm-language: This property contains the language of the project. It is automatically set when the project is created and must not be modified or removed manually.

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: