Quick Question. I am new to QuantConnect
When I am in a class like an Alpha where I do not have a reference to the Algorithm class, how can I write information to the Log?
Any help much appreciated.
Will
QUANTCONNECT COMMUNITY
Quick Question. I am new to QuantConnect
When I am in a class like an Alpha where I do not have a reference to the Algorithm class, how can I write information to the Log?
Any help much appreciated.
Will
Hi Franky,
You should see a log.txt file in the optimization's output directory. In there you can find the mapping between backtest ids and parameters in the lines that look like these:
2021-07-28T22:55:50.2692799Z TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 5b2353db-21e4-43e8-91be-2d82d925f2fa): launched backtest '71dc5085-4b29-4c71-bc37-e92527d38dbd' with parameters 'slow-period:50,fast-period:5'
2021-07-28T22:55:50.2712157Z TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 5b2353db-21e4-43e8-91be-2d82d925f2fa): launched backtest '605449d7-8599-43b1-95f8-662041d58b40' with parameters 'slow-period:51,fast-period:5'
2021-07-28T22:55:50.2721825Z TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 5b2353db-21e4-43e8-91be-2d82d925f2fa): launched backtest '5e323122-23fa-45d0-8703-0820f0eb10df' with parameters 'slow-period:52,fast-period:5'
2021-07-28T22:55:50.2732631Z TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 5b2353db-21e4-43e8-91be-2d82d925f2fa): launched backtest '905ed00b-757d-441e-9aae-675242e2ab0f' with parameters 'slow-period:53,fast-period:5'
2021-07-28T22:55:50.2747383Z TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 5b2353db-21e4-43e8-91be-2d82d925f2fa): launched backtest '304c20d0-9d1b-4774-a152-61f4f1018559' with parameters 'slow-period:54,fast-period:5'
2021-07-28T22:55:50.2760946Z TRACE:: LeanOptimizer.LaunchLeanForParameterSet(OID 5b2353db-21e4-43e8-91be-2d82d925f2fa): launched backtest '17ea0e25-b9ae-444d-ae94-5e0e569f2baa' with parameters 'slow-period:55,fast-period:5'
Petter Hansson
Make a field in your algorithm class (here assuming it's called MyAlgorithm):
public static MyAlgorithm _instance;
Or if you like, ,make it private and dress it properly in a singleton getter method...
Then you can do:
MyAlgorithm._instance.Log("This is a log message");
IMO, a Lean algorithm inside the project assembly is a case where singleton/global is perfectly warranted.
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.
Petter Hansson
It is late and I realized Python is a different language... and I can't delete my post, lol. Python still has globals though.
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.
Derek Melchin
Hi everyone,
This is a known issue we are working to resolve. Sorry for the inconvenience and thank you for your patience.
Best,
Derek Melchin
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.
Kevin Du INVESTOR
Any update on this? I use mac and chrome the autocomplete doesn't work at all. I can't make any progress coding, especially I'm new.
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.
Derek Melchin
Hi Kevin,
This thread is in regards to autocomplete in our web IDE. Refer to this readme for guidance setting up autocomplete in a local environment. Please open a new thread for further assistance if autocomplete still doesn't work after following the readme.
Best,
Derek Melchin
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.
Laurent Crouzet
Kevin Du : it seems that autocomplete is eventually working again for me (Windows, using Chrome to connect to the web IDE)
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.
Kevin Du INVESTOR
It worked in my web enviornment too!
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.
Jared Broad
Yes we fixed this last week :), sorry for the hassle
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!