Hello Everyone! Given events lately I wanted to directly address fears of vendor lock-in from choosing to use QuantConnect/LEAN as your trading platform by giving you a step-by-step guide for how you could run LEAN on your own server. 

- Why would we do this? We believe you are using QuantConnect to save you time and effort setting up the environment on your own. With QuantConnect you can get better features, data and UX than possible alone. This motivates us to provide an outstanding service so that even if you can run it yourself; you'll likely choose to use us. 

 - Why did we make LEAN powerfully open? We designed LEAN to be runnable locally; and spent weeks working on datafeed connections only relevant to the open-source project. Why would we do this? Like Linux we see LEAN as the foundation for the future of algorithmic trading. There are millions of features to build and there's only so much we can do ourselves so by making open-source a core part of our project we encourage contributions to help make it a truly community driven company. Want to see the project thrive? Help contribute

So to get started! Its pretty simple:

1) Core Technology - LEAN:

  • You will need LEAN - our cross platform open-source project kernel of QuantConnect. It builds and runs locally with almost no effort. We ship small data samples with your project so you can see it working instantly. Windows, Linux or Max are supported. By default it is a CLI program and we provide a rudimentary GUI but community members have built beautiful GUI's for Windows.

2) Infrastructure:

  • For live trading you'll need a virtual machine of at least 512MB RAM. You can pick one reasonably stable micro-machines from AWS ($7/mo) or Google Cloud Compute ($5/mo). I wouldn't recommend super discount providers as the reliability of internet connection is important in live trading. For backtesting you can backtest locally in Visual Studio.
  • OS Setup: We provide a docker file so you can setup the OS instantly by following along with the docker setup - or running just running LEAN in the docker container we provide.

3) Data:

  • Backtesting:

    We use Zip-CSV format for the data as it is an open format easily reverse engineered.

    Equity / Futures / Options: This is the only tricky part. Due to exchange licenses we can't give this to you but we can make it as easy as possible to get started. We work with data vendors who offer very reasonable rates and we have created and open-sourced data converters to convert their data into LEAN format. These converters all live in the ToolBox project of LEAN. We also provide ways to download US Equity data from Google's API but this is limited to the last 2 weeks.

    Forex / CFD: We have negotiated on your behalf and FXCM / OANDA have agreed to make their data available for free download. We provide this for free through the Data Library.

    Coarse Universe: For backtesting coarse universe is available via the Coarse Universe converter in the toolbox. This is reasonably easy to use but still requires you to gather the entire universe of equity daily prices. Fine Universe (fundamentals) is harder as its provided by Morning Star. We chose Morning Star as they had the best coverage but its not a cheap provider. We haven't open-sourced this as we think given price of data its an institutional offering not available for an individual (hedge funds - contact us). Given Morning Star costs its probably a good idea to create a Quandl fundamental converter in the long run (WIP).
     
    For more information on downloading data check out: GoogleYahoo, FXCM, Dukascopy Data Downloaders.
    You can also see the QuantQuote, NSE, AlgoSeek Options and Futures Data Converters and the FactorFile Generator.
     
  • Live Trading: 

    Streaming Data: We've provided many mechanisms for live data streaming in the open-source project. These classes are called the "IDataQueueHandler" implementations. They broadly come from three sources:
       1) Brokerage implementations - stream live prices directly from your brokerage with your data subscriptions. We've implemented IB, OANDA and FXCM brokerage IDataQueueHandler's so you can stream directly from them with almost no effort. Each brokerage will be limited in the data it can stream (i.e. FXCM can't send you options pricing). 
       2) Data vendors - we've implemented and open-sourced an IQFeed data feed. as IQFeed supports all our security types. Other data vendors weren't reliable enough.
       3) IEX Exchange - an implementation to the free IEX exchange datafeed for US Equity prices.

    History Requests: History requests are tricky as its actually pretty complex engineering to store streaming prices and serve them up quickly. We have provided open-source implementations to the brokerages we support. Data vendors can't support this at the moment.

    Universe Data: Live trading with universe data is also a challenging task to open-source as we're using lots of proprietary data to generate the full listing of symbols and prices for the universe. The format is not proprietary though and you can provide your own universe in live trading by serving a collection of CoarseFundamental objects inside of a BaseDataCollection delivered by the same IDataQueueHandler used above. It is processed here. We'll ponder on this one to see how to open-source it for personal use with publicly available data sources.

We're grateful for all of the community and will continue working to give you the best algorithmic trading platform in the world so you chose to spend your time and energy with us! 

 

PS: If you're like to contribute - there is lots to do =)

  • #1 Helping community members and sharing algorithms. Helping the community thrive is a huge help to the core team.
  • #2 Grab a bug or feature from the issues list and submit a PR. Finding and submitting descriptive bugs is a big help too.
  • #3 Contributing to our new open-sourced tutorials which are deployed here.
  • #4 Submitting new example algorithms for C#, F# and Python.
  • #5 Lastly if you're too busy you can subscribe to support the project financially.

Author