I've been looking for ways to set up my QuantConnect Python environment so that coding is as fast as possible. As a QuantConnect API novice, it is important to me to minimize the amount of time I spend reading API docs, pasting code, and pressing "Backtest" before realizing that I've made an API mistake. Learning about finance and algo fundamentals happens much faster the less time I think about getting the code to work.

One of the biggest problems I've had is that Python is a dynamicaly typed language. This means developers cannot use Intellisense to autocomplete class attributes for names ("variables") that have not yet been bound to an object. This is an intended feature of Python. A very common negative side effect of this design decision occurs when you are working with a function argument and need to access the argument's class attributes (e.g. `changes.RemovedSecurities` where `changes` is a `SecurityChanges` object).

If you have researched why "QuantConnect Python Autocomplete is not working" and are used to always having access to Intellisense from using a staticaly typed language like C#, this may fix your problem. QuantConnect autocomplete may be fully functional, but Python does not have a type associated with the name or function argument being used.

For example, when creating an OnSecuritiesChanged overload using the QuantConnect Web IDE, our required message signature looks like `def OnSecuritiesChanged(self, changes)`, where we know that `changes` will recieve an object of type `SecurityChanges` upon runtime. Say we want to liquidate all the securities that are in  `changes.RemovedSecurities`, but forget the exact field name. DeletedSecurities? SecuritiesRemoved? Flow is disrupted searching for the API Docs of the `SecurityChanges` class, and autocomplete shows nothing:


We can easily get "autocomplete working" by using Python's optional function annotations (link 1)(link 2):


Variables can also be annotated, though I think this use of annotations will be mostly tedious and wasted effort.



I think workflow speed can be further improved by developing locally using Skylight, VS Code, and QuantConnect's Python stubs, as detailed in this post. With this configuration, we can see whether class attributes are fields or methods at a glance, as well as leveraging all the other ways a fully featured editor like VS Code can improve productivity:


I'm surprised that I didn't find any reference to Python annotations in QuantConnect's bootcamp or other Community posts, so I wanted to share. Since this is a Python-specific problem, I understand why it may not have come up in the Bootcamp, whose purpose is to teach only the QC API. If I had any say in the matter I would revise all Bootcamp python code function definitions to use annotation so that Python newbies would have Autocomplete working in a more comprehensive way without having to understand the nuances of a language-specific design decision pitfall, or at the very least making sure that one of the Beginner lessons explains this tip and it's productivity improving reprocussions.