Hi all,
So I'm trying to perform a relatively simple task, finding the max of a list. I'm getting the error:
max() arg is an empty sequence
I've checked the lists to ensure they're not empty, so I'm stumped.
Can anyone help?
QUANTCONNECT COMMUNITY
Hi all,
So I'm trying to perform a relatively simple task, finding the max of a list. I'm getting the error:
max() arg is an empty sequence
I've checked the lists to ensure they're not empty, so I'm stumped.
Can anyone help?
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.
.ekz.
When I ran it, obvList was empty.
There's an issue with your IF condition that's causing the program to check obvList before your windows were ready.
Replace this:
With this:
Varad Kabade
Hi Nicholas Fitzgerald,
Thank you .ekz. for your response.
Alternatively, instead of using the list and max() method, we can use the IndicatorExtensionsOf and the maximum indicator; this will reduce the overall runtime and align the algorithm with the best practices
and whenever we want to get the max value we need to use:
Best,
Varad Kabade
Nicholas Fitzgerald
Hi Ekz and Varad,
Ekz that did indeed fix my issue, thank you!
For your solution Varad, just setting up the indicators in this way allow me to slice the data though? I need to retrieve the max value excluding the most recent price?
Regards,
Nick
Varad Kabade
Hi Nicholas,
To exclude the latest entry we just need to add the following:
after the following inside Initialize:
Note that all the indicators were created using IndicatorExtensions.Of will be automatically updated when we update self.obv. We have created an example algorithm showing the use of the above features.
Best,
Varad Kabade
Nicholas Fitzgerald
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!