QuantConnect / lean-cli

CLI for running the LEAN engine locally and in the cloud
https://www.lean.io/cli
Apache License 2.0
194 stars 99 forks source link

Pull cloud project with parameters failing #327

Closed Martin-Molinero closed 1 year ago

Martin-Molinero commented 1 year ago
> lean cloud pull --project 15268993
Error: 1 validation error for QCParameter
type
  Field required [type=missing, input_value={'key': 'Test', 'value': ...x': 184.5, 'step': 12.3}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.0.1/v/missing

> lean --version
lean 1.0.157
image
yukewang1 commented 1 year ago

I'm also getting a similar error when pulling. Seems this is because my cloud project has parameters and the CLI didn't recognize them correctly.

# lean login
┌──────────────────────────────────────────────── Announcements ─────────────────────────────────────────────────┐
│ 2022-08-26: We've added support for python 3.10 and deprecated python version 3.6.                             │
│ 2022-05-23: We've added new json based approach of adding new modules to reduce the overhead and duplications. │
│ 2022-02-02: We've added cloud live support for Samco and Zerodha brokerages for India Market                   │
│ 2022-01-26: We've added support for Samco brokerage for India Market and FTX.US Exchange                       │
│ 2021-11-17: We've added support for Kraken and FTX brokerages                                                  │
│ 2021-06-21: We've just released a new opening video of the CLI:                                                │
│             https://youtube.com/watch?v=QJibe1XpP-U                                                            │
│ 2021-06-21: Building an Algo on Privacy Keywords using TiingoNews:                                             │
│             https://quantconnect.com/blog/building-an-algo-on-privacy-keywords-using-tiingonews/               │
│ 2021-06-11: Check out our mini video series on how to use the CLI:                                             │
│             https://youtube.com/playlist?list=PLD7-B3LE6mz61Hojce6gKshv5-7Qo4y0r                               │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Your user id and API token are needed to make authenticated requests to the QuantConnect API
You can request these credentials on https://www.quantconnect.com/account
Both will be saved in /root/.lean/credentials
User id: 76518
API token: ****************************************************************
Successfully logged in
# lean init
Select the organization to use for this Lean CLI instance: Yuke Wang
Using selected organization "Yuke Wang"
This command will create a Lean configuration file and data directory in the current directory
The current directory is not empty, continue? [y/N]: y
Downloading latest sample data from the Lean repository...
Download Progress 10.0 MB
Download Progress 30.0 MB
Download Progress 50.0 MB
Download Progress 70.0 MB
Download Progress 90.0 MB
Download Progress 110.0 MB
Download Progress 130.0 MB
Download Progress 150.0 MB
Download Progress 170.0 MB
Download Progress 190.0 MB
What should the default language for new projects be? (python, csharp) [python]: 
The following objects have been created:
- lean.json contains the configuration used when running the LEAN engine locally
- data/ contains the data that is used when running the LEAN engine locally

The following documentation pages may be useful:
- Setting up local autocomplete: https://www.lean.io/docs/v2/lean-cli/projects/autocomplete
- Synchronizing projects with the cloud: https://www.lean.io/docs/v2/lean-cli/projects/cloud-synchronization

Here are some commands to get you going:
- Run `lean create-project "My Project"` to create a new project with starter code
- Run `lean cloud pull` to download all your QuantConnect projects to your local drive
- Run `lean backtest "My Project"` to backtest a project locally with the data in data/
# lean cloud pull
Error: 4 validation errors for QCParameter
min
  Field required [type=missing, input_value={'key': 'length', 'value': '20'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.1.2/v/missing
max
  Field required [type=missing, input_value={'key': 'length', 'value': '20'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.1.2/v/missing
step
  Field required [type=missing, input_value={'key': 'length', 'value': '20'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.1.2/v/missing
type
  Field required [type=missing, input_value={'key': 'length', 'value': '20'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.1.2/v/missing
# lean --version
lean 1.0.157
# python3 --version
Python 3.8.17
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
cyyyz2048 commented 1 year ago

I have encountered similar issue. When running "lean cloud pull", the below error messages occurred:

Screenshot 2023-07-09 at 10 29 58 PM

When running "lean cloud push", only projects without built-in parameters can be pushed. Those with parameters generated the same error messages as above.

cyyyz2048 commented 1 year ago

Many thanks to John and Martin. Problem solved!