Hi Everyone,
We recently rolled out Python Autocomplete for local Skylight development in VS Code and PyCharm. However, we’d still want our C# users to also experience Autocomplete, so today, we will go over how to have Autocomplete with C# Skylight algorithms.
First, if we haven’t done so already, we need to install Lean to our machine. For users that don’t, this can be as easy as git clone https://github.com/QuantConnect/Lean.git in the terminal, and this is sufficient for users who only wish to gain the Autocomplete features.
Now, we will go over the instructions for specific IDEs/Editors.
Visual Studio:
Open the Lean repository in Visual Studio
Right-click the Algorithm.CSharp folder, then choose “Add”->”Add Existing Item”, then navigate to where the synced Skylight folder is (it usually looks like “C:\Users\user\QuantConnect\QC Name”) and choose the folder of the algorithm you’d like to edit
Choose the .cs files and click the triangle near the “Add” button, then select the “Add as Link” option. What this does is essentially allow us to have access to the Lean classes and methods while editing a file from a different folder
When finished coding, save the file and right-click the Skylight tool bar icon and choose “Sync”, and after a few seconds, the changes will be reflected in the cloud
VS Code:
Open the Lean project using VSCode
Install a Symbolic Linking extension (for reference, I use autolink by Archal)
Follow the steps for the Symbolic Linking extension, and then go to File->Open File, then select the .cs files in the Skylight algorithm folder (it usually looks like “C:\Users\user\QuantConnect\QC Name”) that you’d like to edit. Note: if you are using autolink like I did, then simply opening the .cs files automatically creates the Symbolic Link for you
When finished coding, save the file and right-click the Skylight tool bar icon and choose “Sync”, and after a few seconds, the changes will be reflected in the cloud
Rider:
Open the Lean project inside Rider
Right click the “Algorithm.CSharp” folder, hover “Add”, then select the “Add Existing Item” option, which will prompt you to choose a file
Head over to where the synced Skylight folder is (it usually looks like “C:\Users\user\QuantConnect\QC Name”) and choose the folder of the project you’d like to edit
Choose the .cs files you’d like to edit, then select the “Add Links” option when prompted
Then hit ok for every file chosen
Best,
Shile Wen
Evan LaRiviere
As a C# user this is great
Jared Broad
A note for python users -- the new recommended way for python stubs:
pip install quantconnect-stubs
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.
Gerardo Salazar
Following up on Jared's comment, for autocomplete to work, you'll need to add the QuantConnect import statements to the top of your algorithm. I've prepared a list of imports that you can copy and paste to the top of your algorithm.
These imports will ensure that you have the exact same development experience locally as you would in the cloud, as well as properly enabling autocomplete. Happy coding!
from QuantConnect import * from QuantConnect.Parameters import * from QuantConnect.Benchmarks import * from QuantConnect.Brokerages import * from QuantConnect.Util import * from QuantConnect.Interfaces import * from QuantConnect.Algorithm import * from QuantConnect.Algorithm.Framework import * from QuantConnect.Algorithm.Framework.Selection import * from QuantConnect.Algorithm.Framework.Alphas import * from QuantConnect.Algorithm.Framework.Portfolio import * from QuantConnect.Algorithm.Framework.Execution import * from QuantConnect.Algorithm.Framework.Risk import * from QuantConnect.Indicators import * from QuantConnect.Data import * from QuantConnect.Data.Consolidators import * from QuantConnect.Data.Custom import * from QuantConnect.Data.Fundamental import * from QuantConnect.Data.Market import * from QuantConnect.Data.UniverseSelection import * from QuantConnect.Notifications import * from QuantConnect.Orders import * from QuantConnect.Orders.Fees import * from QuantConnect.Orders.Fills import * from QuantConnect.Orders.Slippage import * from QuantConnect.Scheduling import * from QuantConnect.Securities import * from QuantConnect.Securities.Equity import * from QuantConnect.Securities.Forex import * from QuantConnect.Securities.Interfaces import * from datetime import date, datetime, timedelta from QuantConnect.Python import * from QuantConnect.Storage import * QCAlgorithmFramework = QCAlgorithm QCAlgorithmFrameworkBridge = QCAlgorithm
Shile Wen
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!