API Reference

lean library add

Introduction

Add a custom library to a project.

$ lean library add <project> <name> [options]

Description

Adds a custom library to a project so it can be used in local backtesting, local live trading, local optimizations, and the local research environment. Additionally, this command updates your local environment so you get autocomplete on these custom libraries.

Custom C# libraries are added to your C# project file (the file ending in .csproj). If dotnet is on your PATH and --no-local is not given the CLI also restores all dependencies using dotnet restore to make local autocomplete work.

Custom Python libraries are added to your project's requirements.txt file. If pip is on your PATH and --no-local is not given the CLI also installs the Python package in your local Python environment to make local autocomplete work.

If --version is not given the package is pinned to the latest compatible version. For C# projects this is the latest available version. For Python projects, this is the latest version compatible with Python 3.6 (which is what the Docker images use).

If --version is given and the project is a Python project, the CLI will additionally check whether the given version is compatible with Python 3.6. If this is not the case, the command aborts because libraries incompatible with Python 3.6 cannot be installed in the official Docker images.

Arguments

The lean library add command expects the following arguments:

ArgumentDescription
<project>The path to the project directory.
<name>For C# projects, the name of the NuGet package to add. For Python projects, the name of the PyPI package to add.

Options

The lean library add command supports the following options:

OptionDescription
--version <value>The version of the package to add to the project (defaults to the latest compatible version).
--no-localSkip making changes to the local environment.
--verboseEnable debug logging.
--helpDisplay the help text of the lean library add command and exit.

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: