With a few configuration changes you can get desktop charting in LEAN with a HTML5 interface very similar to the one you see in QuantConnect.com. This gives you better visual feedback on your strategy and allows you to improve faster. This tutorial guides you through configuring a desktop charting environment with LEAN.
Local charting (and all local backtesting) requires you to have your own source of data. We provide a way to download FX and CFD data through our
API. To get started make sure you have your data in your data folder. By default this is the /Data/ directory relative to your LEAN installation.
Two configuration changes are required for desktop charting to work:
- Change the "environment" field to use "backtesting-desktop". This instructs LEAN to use the configuration settings block at the bottom of the config file.
"environment": "backtesting-desktop",
- Insert your API token and user id into configuration file. This is required for chart streaming.
// To get your api access token go to quantconnect.com/account
"job-user-id": "....",
"api-access-token": "...........",
With those changes in place you can simply run the project and your backtesting chart will appear in a few seconds. For live trading; use the"live-desktop" configuration environment.
If you get the run-time exception
"The port configured in config.json is either being used or blocked by a firewall"- This normally means you've left the user interface open (you should close it between each run). It can also be because another program is sharing that port. You can fix this by changing the port LEAN transmits the data with the
"desktop-http-port"
setting.
In the tutorial video below we demonstrate this feature on LEAN:
https://www.youtube.com/watch?v=m6llfznP4d4
Jared Broad
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!