Key Concepts

Developing in the IDE

Coding Your Algorithm

The QuantConnect Algorithm Lab allows you to allows write code in project files and then press the Build button to compile your algorithm. Build errors will be displayed in the console and highlighted with red-lines.

You can add, rename and delete files in your project in the Projects tab. You can create a virtual folder for your project by placing a slash ("/") into the name of your file. The bare minimum to run an algorithm is your initialization and data event methods.

public class BasicTemplateAlgorithm : QCAlgorithm
	public override void Initialize() {
		// Setup algorithm requirements: cash, dates and securities.
                // Initialize is called once at the start of the algorithm.

	public override void OnData(Slice data) {
               // Data requested is then piped into event handlers like this one.
class BasicTemplateAlgorithm(QCAlgorithm):

	def Initialize(self):
		'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
	def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            data: Slice object keyed by symbol containing the stock data

QuantConnect Backtesting and Coding Environment.

Backtesting Your Algorithm

Once you've got an algorithm compiling you can click the Play button to launch a backtest. Free users can launch up to 3 backtests in parallel. Paid users can launch 10-20 backtests in parallel. Results are shown in the Result drop-down menu.

API Help Documentation

The API Tab details the classes and API of the underlying LEAN engine so you can see the methods and class infrastructure. It includes all the indicator helper methods to see all the indicators available. This is automatically generated from the source code of LEAN. If you are able; we recommend becoming familiar with QCAlgorithm base source code.

Data Manager

The Data Manager Tab is a searchable database of the QuantConnect Data Library. Each asset details are accessible including the start date, delist date, source of the data, resolutions available and the exchange the asset is traded.

If you find an issue with the QuantConnect data library you can report this through our Data page. The Data page provides a public reporting and tracking system to fix issues systematically.

Shortcut Keys

The website coding environment comes with some keyboard shortcuts to make coding easier.

Short Cut Description
Ctrl + Space Initiate full auto-complete
Ctrl + / Toggle comments on selected code
Ctrl + Up/Down Increase/decrease font size
Ctrl + S Save document and compile project
Ctrl + D Remove line
Alt + Up/Down Move line up/down
Alt + Shift + Up/Down Copy lines up/down
Alt + 0 (zero) Collapse all code blocks
Alt + Shift + 0 (zero) Expand all code blocks

The full list of short cuts can be found on at the ACE Editor open source project.

Learning Programming

We aim to make it as easy as possible to use QuantConnect but you still need to be able to program. We've provided some links below to get you started:

Language Type Name Producer
C# Video C# Fundamentals for Absolute Beginners Microsoft
C# Video C# Jump Start - Advanced Concepts Microsoft
C# Video Top 20 C# Questions Microsoft
F# Interactive Getting Started with F# Microsoft
F# Interactive Advanced Programming with F# Microsoft
F# Video F# Talks, Videos and Podcasts F# Foundation
Python Text/Video Introduction to Python Google
Python Interactive Code Academy - Python Code Academy

Local Development

If you prefer coding in your own development environment you can download the LEAN Open Source project and work locally. We recommend using Visual Studio as your programming environment because of the plugin that we offer for development. Visual Studio Community Edition has the full power of Visual Studio and enables programming in C#, F# and Python. 

If you're running on Mac or Linux you can also use MonoDevelop or Xamarin Studio and copy-paste your algorithms into Check out the LEAN-Getting Started Tutorial for more information. The LEAN installation takes about 5 minutes.

You can also see our Tutorials and Videos. You can also get in touch with us via Chat.

Did you find this page Helpful ?