Lean Algorithmic Trading Engine by QuantConnect (C#, Python, F#, VB, Java)
C# Python Batchfile Shell Visual Basic F#
Latest commit 3e3cf7d Jan 18, 2017 @jaredbroad jaredbroad committed on GitHub Merge pull request #707 from quant1729/master-options-npv-nan-fix
Fix makes sure that NaNs, Infs from QLNet don't disrupt our calculati…
Permalink
Failed to load latest commit information.
Algorithm.CSharp Fixed bug: inconsistent state of SecurityManager and option chains du… Jan 9, 2017
Algorithm.FSharp Make xml comment file names consistent across projects Dec 30, 2016
Algorithm.Java Tidy unneccessary TravisCI build configuration Apr 19, 2016
Algorithm.Python Update Accord.NET library to version 3.3.0 Dec 15, 2016
Algorithm.VisualBasic Tidy unneccessary TravisCI build configuration Apr 19, 2016
Algorithm Do not submit orders during warmup Jan 17, 2017
AlgorithmFactory User-frieldly warning about algorithm name Jul 12, 2016
Api Merge pull request #665 from andrewhart098/local-logs2 Jan 5, 2017
Brokerages Merge pull request #705 from quant1729/master-ib-ambiguous-symbol-fix Jan 18, 2017
Common Merge pull request #707 from quant1729/master-options-npv-nan-fix Jan 18, 2017
Compression Removed UnzipCached() method and its usages. Updated Zip() method. Jan 11, 2017
Configuration Tidy unneccessary TravisCI build configuration Apr 19, 2016
Data Merge pull request #656 from QuantConnect/market-hours-early-close Jan 17, 2017
Documentation Fixing change log Jan 12, 2015
Engine Increase loaderTimeLimit of Loader in BacktestingSetupHandler Jan 16, 2017
Indicators Make xml comment file names consistent across projects Dec 30, 2016
Launcher Fixing issues from futures-options merge (#692) Jan 15, 2017
Logging Make xml comment file names consistent across projects Dec 30, 2016
Messaging Make xml comment file names consistent across projects Dec 30, 2016
Queues Merge branch 'seed-security-from-history' of https://github.com/andre… Dec 2, 2016
Tests Merge pull request #707 from quant1729/master-options-npv-nan-fix Jan 18, 2017
ToolBox Removed explicit call to GC (sometimes hangs in mono) Jan 18, 2017
UserInterface Update Accord.NET library to version 3.3.0 Dec 15, 2016
.dockerignore Updated dockerfiles to include headless linux support for IB Nov 13, 2016
.gitattributes Update .gitattributes for sh to use lf eol Apr 15, 2015
.gitignore Parameterless contructors for some CandleStickPatterns (#569) Sep 29, 2016
.travis.yml Remove junk updates to travis and revert to release builds Apr 19, 2016
CONTRIBUTING.md Use soft tabs of four spaces Aug 19, 2015
Dockerfile Rename docker file to use docker hub cloud host for foundation Nov 16, 2016
DockerfileLeanFoundation Adds Python .NET to docker image Jan 6, 2017
LICENSE Update LICENSE Jul 10, 2015
QuantConnect.Lean.sln Removing VB/F# from Release build Jun 3, 2016
QuantConnect.Lean.sln.DotSettings Set c# language version to 5.0 Jan 29, 2016
change-log.md Modifications to change log Sep 22, 2015
lean.ico Rework GetResultHandler to use type loader; first desktop UX implemen… Jun 7, 2015
readme.md Update readme.md Jul 7, 2016

readme.md

alt tag

Lean C# Algorithmic Trading Engine

Join the chat at https://quantconnect-slack.herokuapp.com           Coverage Status

Lean Home - lean.quantconnect.com | Documentation | Download Zip


Introduction

Lean Engine is an open-source fully managed C# algorithmic trading engine built for desktop and cloud usage. It was designed in Mono and operates in Windows, Linux and Mac platforms. The community has contributed additional connectors to F#, Visual Basic and Java.

Lean drives the web based backtesting platform QuantConnect.

System Overview

Lean outsourced key infrastructure management to plugins. The most important plugins are:

  • Result Processing

    Handle all messages from the algorithmic trading engine. Decide what should be sent, and where the messages should go. The result processing system can send messages to a local GUI, or the web interface.

  • Datafeed Sourcing

    Connect and download data required for the algorithmic trading engine. For backtesting this sources files from the disk, for live trading it connects to a stream and generates the data objects.

  • Transaction Processing

    Process new order requests; either using the fill models provided by the algorithm, or with an actual brokerage. Send the processed orders back to the algorithm's portfolio to be filled.

  • Realtime Event Management

    Generate real time events - such as end of day events. Trigger callbacks to real time event handlers. For backtesting this is mocked-up an works on simulated time.

  • Algorithm State Setup

    Configure the algorithm cash, portfolio and data requested. Initialize all state parameters required.

For more information on the system design and contributing please see the Lean Website Documentation.

Spinup Instructions

OS X

Install Mono for Mac

Install MonoDevelop or Xamarin Studio for your IDE. If you use MonoDevelop also install its FSharp Plugin.

Clone the repo:

git clone git@github.com:QuantConnect/Lean.git
cd Lean

OSX does not fully support Visual Basic or F#. You will need to remove these projects from the solution for them to build properly. Alternatively for Visual Basic modify the target framework as shown here. Alternatively modify the target framework:

sed -i -e 's/4.5/4.0/' Algorithm.VisualBasic/QuantConnect.Algorithm.VisualBasic.vbproj

Open the project in Xamarin Studio, then in the menu bar, click Project > Update NuGet Packages. You should also run nuget install MathNet.Filtering -pre to install the MathNet library.

In OS X mdtool is not added to the PATH environment. Either set up the PATH manually or reference the binary directly.

If you are running Xamarin Studio:

/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool build

If you are running MonoDevelop:

/Applications/MonoDevelop.app/Contents/MacOS/mdtool build

Run the compiled exe file. For the time being you need to run the exe in the same path as your current working directory:

cd Lean/Launcher/bin/Debug
mono ./QuantConnect.Lean.Launcher.exe

Linux (Debian, Ubuntu)

Setup Mono GPG signing key (instructions here).

Install dependencies, MonoDevelop, Git and NuGet:

sudo apt-get install mono-complete mono-vbnc fsharp monodevelop monodevelop-nunit  git ca-certificates-mono
mozroots --import --sync
apt-get upgrade mono-complete

Clone the repo:

git clone https://github.com/QuantConnect/Lean.git
cd Lean

Like OSX, Linux does not fully support Visual Basic. You will need to remove this project from the solution for them to build properly. Alternatively modify the target framework:

sed -i 's/4.5/4.0/' Algorithm.VisualBasic/QuantConnect.Algorithm.VisualBasic.vbproj

Restore NuGet packages then compile:

wget https://nuget.org/nuget.exe
mono nuget.exe restore QuantConnect.Lean.sln
xbuild

If you get: "Error initializing task Fsc: Not registered task Fsc." -> apt-get upgrade mono-complete If you get: "XX not found" -> Make sure Nuget ran successfully, and re-run if neccessary.

Run the compiled exe file. For the time being you need to run the exe in the same path as your current working directory:

cd Lean/Launcher/bin/Debug
./QuantConnect.Lean.Launcher.exe

Windows

  • Install Visual Studio
  • Open QuantConnect.Lean.sln in Visual Studio
  • Press ctrl-f5 to run without debugging. By default Visual Studio includes NuGet, if your version cannot find DLL references, install Nuget and build again.

Issues and Feature Requests

Please submit bugs and feature requests as an issue to the Lean Repository. Before submitting an issue please read others to ensure it is not a duplicate.

Mailing List

The mailing list for the project can be found on Google Groups

Contributors and Pull Requests

Contributions are warmly very welcomed but we ask you read the existing code to see how it is formatted, commented and ensure contributions match the existing style. All code submissions must include accompanying tests. Please see the contributor guide lines.

Build Status

Acknowledgements

The open sourcing of QuantConnect would not have been possible without the support of the Pioneers. The Pioneers formed the core 100 early adopters of QuantConnect who subscribed and allowed us to launch the project into open source.

Ryan H, Pravin B, Jimmie B, Nick C, Sam C, Mattias S, Michael H, Mark M, Madhan, Paul R, Nik M, Scott Y, BinaryExecutor.com, Tadas T, Matt B, Binumon P, Zyron, Mike O, TC, Luigi, Lester Z, Andreas H, Eugene K, Hugo P, Robert N, Christofer O, Ramesh L, Nicholas S, Jonathan E, Marc R, Raghav N, Marcus, Hakan D, Sergey M, Peter McE, Jim M, INTJCapital.com, Richard E, Dominik, John L, H. Orlandella, Stephen L, Risto K, E.Subasi, Peter W, Hui Z, Ross F, Archibald112, MooMooForex.com, Jae S, Eric S, Marco D, Jerome B, James B. Crocker, David Lypka, Edward T, Charlie Guse, Thomas D, Jordan I, Mark S, Bengt K, Marc D, Al C, Jan W, Ero C, Eranmn, Mitchell S, Helmuth V, Michael M, Jeremy P, PVS78, Ross D, Sergey K, John Grover, Fahiz Y, George L.Z., Craig E, Sean S, Brad G, Dennis H, Camila C, Egor U, David T, Cameron W, Napoleon Hernandez, Keeshen A, Daniel E, Daniel H, M.Patterson, Asen K, Virgil J, Balazs Trader, Stan L, Con L, Will D, Scott K, Barry K, Pawel D, S Ray, Richard C, Peter L, Thomas L., Wang H, Oliver Lee, Christian L.