Hi
I'm trying to plot price data on a custom chart, but the data loses its decimal places.
If I plot the close price directly, it works fine, but not with other data.
Values like:
- 1.17028 become 1,
- 0.687375 become 0,
- 109.842 become 109.
It looks like float data is being cast to integer, but I've no idea why.
Immediately before the call to self.Plot() in OnData(), Degug shows the data is fine.
It doesn't matter what order AddSeries() is called in Initialize(), or what order self.Plot() is called in OnData(), the close price is plotted fine, but not other data.
I've run out of ideas. Any help would be appreciated.
Thanks.
Tony Shacklock
For anyone else who experiences this, I discovered a solution.
Cast the data to float in (or before) the Plot() call. e.g. this works:
I have no idea why it needs this. Debug() prints the decimal places without it, but Plot() needs it for some reason.
Martin Molinero
Hey Tony,
Thanks for the report!
Believe similar to this other issue https://github.com/QuantConnect/Lean/pull/5879 where type ‘np.float64’ is not handled correctly by pythonNet. We will look into this ASAP.
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.
Tony Shacklock
Thank you, Martin.
At least I have a work-around for now.
Martin Molinero
Hey Tony,
We have deployed a fix for this issue, starting from Lean version 12776.
Thanks again for the report!
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.
Tony Shacklock
Many thanks.
Tony Shacklock
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!