I followed the instructions on this page https://www.quantconnect.com/docs/v2/lean-cli/optimization/deployment to set up my configuration file and use GetParamter() in my algorithm to get the corresponding default values, yet the below error messages still occurred when using "lean optimize" command:
CY Liang
I understand that MIN, MAX, and step should be provided for any optimzations, but according to information in
CY Liang
Shouldn't we provide these information in Terminal afterwards?
Mia Alissi
Based on the information provided, it seems like you're having trouble with the
lean optimize
command. The error message isn't visible in the provided context, but I can provide some general guidance on how to use thelean optimize
command.Firstly, ensure that you have logged into the CLI and converted your project to use project parameters instead of constants for all values that must be optimized. You can do this by following the steps outlined in the Deployment documentation.
Once you've done that, you can run the
lean optimize
command in your terminal. This command starts an interactive wizard which lets you configure the optimizer. Here's an example of how to use it:You'll be prompted to select the optimization strategy to use. After that, you'll need to enter the constraints of the optimization. An example optimization is "Drawdown <= 0.25", which discards all parameter combinations resulting in a drawdown higher than 25%.
After configuring the constraints, the optimizer starts running. You can view the results in the terminal after the optimizer finishes. The logs contain the optimal parameter combination.
If you're still encountering issues, please provide more details about the error message you're seeing.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
CY Liang
Apparently dear Mia is an AI and cannot help me with my issue this time. Really appreciate if someone else could help.
Mia Alissi
Based on the information provided, it seems like there might be a misunderstanding about how to use parameters in the configuration file and in the algorithm.
In the configuration file, parameters should be defined as key-value pairs where both the keys and the values are strings. Here is an example:
(Source: Parameters documentation)
Then, in your algorithm, you can use the
GetParameter(name)
method to retrieve the string value of a parameter and use that instead of constant values. Here is an example in Python:(Source: Parameters documentation)
When you run the
lean optimize
command, you will be prompted to enter the optimization parameters, including the minimum, maximum, and step size for each parameter you want to optimize. Here is an example:(Source: Deployment documentation)
Please update your configuration file and your algorithm accordingly and try running the
lean optimize
command again. If you're still encountering issues, please provide more details about the error message you're seeing.The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
CY Liang
Hi, I would like to submit a support ticket. My friends using different accounts and coding environments also encountered this issue. Apparently this has become a common bug.
To clarify, when using command “lean cloud pull” to retrieve cloud projects (with or w/o parameters built in), the following error messages occur:
Error: 4 validation errors for QCParameter
min
Field required [type=missing, input_value={'key': 'fast', 'value': '15'},
input_type=dict]
For further information visit https://errors.pydantic.dev/2.1.2/v/missing
max
Field required [type=missing, input_value={'key': 'fast', 'value': '15'},
input_type=dict]
For further information visit https://errors.pydantic.dev/2.1.2/v/missing
step
Field required [type=missing, input_value={'key': 'fast', 'value': '15'},
input_type=dict]
For further information visit https://errors.pydantic.dev/2.1.2/v/missing
type
Field required [type=missing, input_value={'key': 'fast', 'value': '15'},
input_type=dict]
For further information visit https://errors.pydantic.dev/2.1.2/v/missing
Please help.
Mia Alissi
I'm sorry to hear that you're encountering issues with the
lean cloud pull
command. Based on the error messages you've provided, it seems like the issue might be related to the format of your parameters in the configuration file.In the configuration file, parameters should be defined as key-value pairs where both the keys and the values are strings. Here is an example:
(Source: Parameters documentation)
Then, in your algorithm, you can use the
GetParameter(name)
method to retrieve the string value of a parameter and use that instead of constant values. Here is an example in Python:(Source: Parameters documentation)
When you run the
lean optimize
command, you will be prompted to enter the optimization parameters, including the minimum, maximum, and step size for each parameter you want to optimize.Please update your configuration file and your algorithm accordingly and try running the
lean optimize
command again. If you're still encountering issues, please provide more details about the error message you're seeing.The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
CY Liang
To add more details, I was able to push local projects without built-in parameters. When pushing local projects with parameters, the same error messages occur. For pulling cloud projects (either with or w/o parameters), the error messages always occur.
Mia Alissi
I'm sorry to hear that you're encountering issues with the
lean cloud pull
command. Based on the error messages you've provided, it seems like the issue might be related to the format of your parameters in the configuration file.In the configuration file, parameters should be defined as key-value pairs where both the keys and the values are strings. Here is an example:
(Source: Parameters documentation)
Then, in your algorithm, you can use the
GetParameter(name)
method to retrieve the string value of a parameter and use that instead of constant values. Here is an example in Python:(Source: Parameters documentation)
When you run the
lean optimize
command, you will be prompted to enter the optimization parameters, including the minimum, maximum, and step size for each parameter you want to optimize.Please update your configuration file and your algorithm accordingly and try running the
lean optimize
command again. If you're still encountering issues, please provide more details about the error message you're seeing.The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
CY Liang
After running “lean cloud download” in my local organization workspace directory, the interactive wizard didn't pop up. Instead, an error message occurred:
Error: Dataset.parse_options() got multiple values for argument 'values'
Why is the interactive wizard not showing up here?
Mia Alissi
I'm sorry to hear that you're encountering issues with the
lean cloud pull
command. The error message you're seeing,Error: Dataset.parse_options() got multiple values for argument 'values'
, suggests that there might be an issue with the way you're calling the command or with the dataset options you're providing.Unfortunately, the provided extracts do not contain specific information about this error or the
lean cloud pull
command. However, according to the documentation, thelean cloud pull
command is used to pull projects from QuantConnect to your local directory. If you provide a--project
option, you only pull a single project from the cloud.If you're still encountering issues, I would recommend checking the format of your command and the options you're providing. If the issue persists, it might be helpful to reach out to the QuantConnect community or support for more specific assistance.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
TBird
This happens to me when trying to run “lean cloud pull” on my server. When I remove the GetParameter() calls in the algo that throws the error on Quantconnect, the error moves on to the next algo that still contains GetParameter() calls. The algos with these GetParameters() in them work fine on Quantconnect, yet I can not pull them to my server due to this blocking error. I contacted customer service about this issue and they were not yet able to resolve this. Since this seems to be an issue others are having, I don't think this relates to my specific algos. Any help would be appreciated.
TBird
My situation: I start writing an algo on QC's web interface. I set up self.GetParameter() calls in my code and add the parameter in the side bar of the web interface. In that interface, I can not specify a ‘type’. Only ‘name’ and ‘value’. When I later do a `cloud pull` on the server I want to live trade this on, I get the error. You can see that ‘type’ is missing, but there doesn't seem to be a way for me to add or correct this within the QC web interface. What am I missing?
When I run the CLI command
I can see that the config that comes from QC is missing the ‘type’ key:value pair.
You can also see that the ‘min’, ‘max’, and ‘step’ values are not strings, which the documentation says they need to be. But, these values were input on the QC web based optimizer screen. I can't specify them to be strings in the resulting config file (which again, I can not update, I don't think).
MY SOLUTION
I deleted all the parameters in the sidebar of each of the algos. Like ‘cut_loss’ in the below example. That makes the error go away in the CLI. Not ideal, but at least I can proceed. The calls to self.GetParameter() like self.GetParameter('cut_loss', -0.10) can stay in the code.
CY Liang
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!