Documentation

Learn to use QuantConnect and Explore Our Features

Try QuantConnect Now

QuantConnect's LEAN engine manages your portfolio and data feeds letting you focus on your algorithm strategy and execution. Data is piped into your strategy via event handlers, upon which you can place trades. We provide basic portfolio management and fill modelling underneath the hood automatically. This is provided by the QCAlgorithm base class.

Design and Test Your Strategy

Deploy it to Your Live Brokerage

Code in Multiple Languages

Harness Our Cluster of Servers

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 slice) 
    {
        // Data requested is then piped into event handlers like this one.
    }
}
class BasicTemplateAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        '''Initialise the data and resolution required, as well as the
        cash and start-end dates for your algorithm. All algorithms must initialized.'''
        pass

    def OnData(self, slice: Slice) -> None:
        '''OnData event is the primary entry point for your algorithm. Each new data
        point will be pumped in here. data is a Slice object keyed by symbol containing
        the stock data'''
        pass

Supported Brokerages

interactive-brokers oanda coinbase bitfines tradier trading-tech bloomberg binance kraken Terminal Link Wolverine TD Ameritrade Samco Zerodha

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: