Our Answer to NYSE Eliminating Stop Orders

From February 26th investors will no longer be able to use Stop or Good Till Cancelled order types on the NYSE, according to a recent press release from Reuters.

Typically Stop Market orders are used to place a market order when the stock exceeds a trigger price. On August 24th, 2015 many investors had their positions stopped out far below the stop prices they had entered. This is a known behavior of stop orders which cannot guarantee a certain execution price.

The difference between the market price, and the fill price is called slippage. In QuantConnect you can model slippage using our TransactionModel class. It would be wise to create a fill model which predicts a greater slippage in volatile market conditions. Most of the time this slippage is assumed to be negative (you execute at a price worse than expected), but occasionally you can even receive positive slippage (a better price than you expected).

To set a custom slippage model in QuantConnect you can use the code below:

 //$2 per trade transaction model, with custom slippage.
Securities["AAPL"].TransactionModel = new MyTransactionModel(2.00m);
public class MyTransactionModel : ConstantFeeTransactionModel { 
    public override decimal GetSlippageApproximation(Security security, Order order) {
        // If volatile, return high value for slippage.

To prevent negative slippage with Stop orders investors should use a Stop Limit order which places a limit order when the market exceeds the trigger price. Stop Limit orders are not guaranteed to be filled but they do ensure you get your expected fill price or better.

To submit a Stop Limit order with QuantConnect you can use the code below:

var newStopLimitOrderTicket = StopLimitOrder("IBM", 10, stopPrice, limitPrice);

At QuantConnect we will continue supporting Stop, Stop Limit and GTC Orders across all our supported brokerages using software techniques. This will ensure your algorithm can continue as expected with no interruptions. We believe you are sophisticated enough to harnesspowerful types and we won’t artificially restrict the tools in your arsenal!

Happy Coding!


Thank you for supporting $1 trading

We’re incredibly grateful to have the loyal support and attention of so many highly intelligent and passionate users. Every day we met incredible new people from all over the world, designing sophisticated strategies and it humbles us. Thank you for making QuantConnect awesome!

We have been blown away by the response in the last few weeks.Since launching the $1 Per Trade offer we’ve seen a 300% increase in all our user engagement signals: traffic, coding and backtesting.

Thank you for your trust and time!You have our promise we will continue working day and night to make QuantConnect better for you.

The Future of Quant Trading

We’re often asked what the differences are between QuantConnect and Quantopian and so we decided to address this question here transparently.

At QuantConnect we have a vision for the future of quant trading. We believe quantitative trading will be the primary investment vehicle of the future. We plan to be the open source, community driven vehicle which makes this future a reality.

Our community is building the most powerful, flexible and encompassing algorithmic platform in the world. Our system is fast, extensible and can support any asset class or market. It can work on a single desktop or as part of a massive cloud cluster. For us, this is incredibly exciting and we imagine a financial future powered by Lean. Hedge-funds, mutual funds, brokerages and individual traders can use our open source Lean platform to power their automated research and trading. Do you want to be part of the future?

The folks at Quantopian have built an interesting hedge-fund, and it looks like a pretty good service. We’re looking to show the facts here without opinion and let you choose for yourself.

Data Support
As a user, what assets can you backtest and trade, in what markets? What data resolutions are natively supported?
US Equities and Forex
Tick, Second, Minute, Hourly, Daily
US Equities, Fundamentals.
Minute, Daily Only
Backtest Processing Speed
How long did it take to run a 10 year backtest; 1 minute, 5 symbol algorithm?
63 Seconds 17 Minutes 8 Seconds
Development Environment
How easily can I create a real strategy?
Full Project IDE
Parallel Backtesting
Typesafe Compiler
We empower you to backtest locally, so you can work in Visual Studio. Our local backtesting Getting Started guide takes about 23 seconds!
Scripts Only
Single Backtest Only
Brokerage Support
Interactive Brokers and Tradier Brokerage
Trade Live On Web+Desktop
Interactive: $1 min, 0.5% max.
Tradier: $1 per trade flat rate. Currently for QuantConnect users only.
Interactive and ETrade
Trade Live Web Only
Interactive: $1 min, 0.5% max.
E-Trade: $8 per trade.

Objectively our data, technology and development environment out perform Quantopian. But what about the business? How do we stack up? These intangibles impact your experience as a user.

Staff / Company Team Size
How many people has it taken to build this community and technology? What is the output/person ratio?
3 People
You communicate directly with founders.
Approx. 31 People
Community Size
What are the officially reported community sizes?
12,000 Quants
Bootstrapped, organic, word of mouth growth
30,000 Quants
How much funding was required to achieve this? How much money have we taken from external investors? How capital efficient is the company?
Built On Only $200k Angel Funding
We’re funded by individual quant angels, who love what we do.
$24M Venture Funding
Business Focus
Infrastructure As A Service, White-Labeling
We host your strategies; you are our client. We chose a business model where our interests are aligned with you, and you can be sure we’ll be here in 10 years. Our primary motivation is aspirational; we are building the world’s best algorithmic trading platform to be the infrastructure of the future.
Recently Quantopian seems to be building a crowd-sourced hedgefund.

We’re proud to be maturing as a company; the open source community is growing, backtests and active coding is higher than its ever been. Its incredibly rewarding to see how people love QuantConnect! Join us to truly revolutionize and democratize quant finance.

The future of investment will be quantitative and we believe QuantConnect is the only company with the vision and technical ability to execute.

Founder @ QuantConnect

$1 Per Trade, It’s a Quant Revolution

We’re proud to announce live trading with Tradier Brokerage is now public!

In a special offer to QuantConnect users, Tradier Brokerage is offering a limited release of 100 accounts with a flat fee of $1 per trade* with the promo code Quant1. Fees this low on a retail-accessible platform are unparalleled.

Robust Modern API

In our experience Tradier Brokerage has a robust, stateful API with rapid millisecond turn around on order fills giving your algorithm powerful execution. The connection is available in our open source algorithmic trading platform, LEAN.

$1 Per Trade Unlocks Powerful Strategies

Have you ever wanted to explore more active execution strategies? Or trade on sub-$2 shares but been worried fees will eat up your gains? Fees this low can unlock strategies and ideas previously not possible.

Low Account Minimums

To open an account is incredibly simple and only requires a $1,000 account minimum! This dramatically lowers the barrier to launching your live algorithmic trading strategy.

Free Live Trading

If you open and fund an account with Tradier Brokerage you’ll be provided with free live trading on QuantConnect! This gives you all the power of a dedicated 512MB VPS, mobile friendly algorithm command center and SMS notification support for only $1 per trade! This offer is open to all existing QuantConnect clients as well.

Open a Tradier Brokerage Account to Launch your Algorithmic Trading!

Use Promo Code “Quant1” To Open An Account Today
Start your Algorithmic Trading!


QuantConnect in combination with Tradier Brokerage $1/trading truly democratizes algorithmic trading. We’re excited about this offer and would love to hear your feedback.


November 2016: The $1 trading offerexpired in November 2015 and the Tradier brokerage integration was removedpending the Tradier implementation of a socket based API for improved stability.

Live Trading with Interactive Brokers

We’re very proud to announce our public release of live trading with Interactive Brokers! Now you can seamlessly design and trade your algorithm within QuantConnect.

Automated live trading is one of the most challenging engineering problems in financial technology. It involves controlling large financial resources, while pushing computational power to its limits!

Starting today, you can deploy your algorithms to your Interactive Brokers accounts, using minute, second or tick resolution data for Equities and FOREX. All powered by our open source algorithmic trading platform, LEAN.

Live Trading GUI

QuantConnect live trading comes packed with some impressive functionality to help your trading!

SMS and Email Notifications

Trigger sending emails, web hooks or SMS messages on key events with a single line of code. It is as simple as:

Custom Live Data Sources

Using QuantConnect you can connect your algorithm to external data sources and stream updates to your algorithm events. Check out our demo using a Bitcoin REST API.

Runtime Statistics

With runtime statistics you can display custom information in the header of your live GUI to track your key indicators and asset values.

SetRuntimeStatistic("EURUSD", price);
Runtime Statistics

Mobile Control Interface

Control your algorithm on the road with our mobile friendly, HTML5 GUI. You can see full running algorithm charts and trades, or just a summary of your algorithm performance.

Live Mobile Controller

Live Options

Upgrade to Start Live Trading Today with QuantConnect

Open Source Updates

Its been an awesome month for the open-source project with contributions from people all around the world. We love working with the community and seeing LEAN used in ways we can barely imagine!

@kaffeebrauer contributed the Stochastic and OnBalance Indicators
@AlexCatarino implemented the ROC, ROCP and WILR Indicators
@QANTau started implementation of an OANDA Brokerage
@bizcad created a Weighted Moving Average Indicator
@mattmast created the Money Flow Index(MFI) Indicator
@bdilber started working on futures support

Additionally thanks to @ammachado, and @dpallone for documentation fixes, and @willniu for working out our consolidator logic 🙂 The LEAN Engine is growing more powerful by the week.

We’re Raising Capital

We’ve been experiencing some incredible growth and have bold plans for the next 12 months! We are opening an investment round and talking to investors to continue our growth plan.

Open Source Future of Algorithmic Trading

We’re proud to announce, thanks to the support of the community, the LEAN Algorithmic Trading Engine is now 100% open source. You have the freedom to connect any data source, execute through any brokerage and design any algorithm 100% locally.

Moment of our Open Sourcing, Jan 12th 2015

It’s an exciting new frontier for algorithmic trading; through open source QuantConnect is breaking open the traditionally secretive world of algorithmic trading to give you the same powerful tools as major hedge-funds.

Lean is “plug and play“. Running your first backtest takes about 23 seconds.

1. Star/Fork and Download the QuantConnect/LEAN Repo* from GitHub
2. Open Lean Project in Visual Studio (let Nuget download all dependencies)
3. Press F5 to Run Project

Presto - you’ve run your first backtest! Here is a step by step guide for building your first algorithm. You can also design custom indicators, import data for international stock markets and connect with any brokerage. We even ship some data with the repo so you can get started instantly.

Clone LEAN Today to Start Your Journey

Clone LEAN Today to Start Your Journey

We’re incredibly grateful to the QuantConnect pioneers for making this possible. With your support we can build the best algorithmic trading platform in the world. Sustainable, independent and community driven.

More Raw Power

To be profitable you need to iterate quickly. Last week we upgraded our backtest processing servers: you can now run a 10 year, event driven backtest in 33 seconds. Your algorithms are running on beautiful i7x3930’s with 6 cores/12 threads/64GB ram. We are the world’s first cloud-desktop hybrid algorithmic trading platform aiming to give you the best of both worlds; ease of local development and horse power of the cloud.

Dynamic Indicator System

Thanks to some long hours by Michael H we launched an elegant, powerful and dynamic new indicator library. It lets you implement designs quickly and avoids reinventing the wheel. Creating an indicator is only a single line of code! Get started with the sample algorithm.

var rsi = RSI("SPY", 14);
var bb = BB(_symbol, 20, 1, MovingAverageType.Simple, Resolution.Daily);
if (rsi > 80) {
    SetHoldings("SPY", 1);
} else if (rsi < 20) {
    SetHoldings("SPY", -1);
Plot("BB", bb.UpperBand, bb.MiddleBand, bb.LowerBand);
Clone the sample algorithm which implements 15+ indicators.

Bollinger Bands Implementation – Clone the sample algorithm which implements 15+ indicators.


Your Ideal Algorithmic Trading Platform

Would you like a copy of the QuantConnect source code; so you can code, backtest and trade locally from your computer?

You could design and debug strategies from your laptop in Visual Studio, using a local data-source, and then when you’re ready simply deploy it to the cloud to backtest on our entire tick-level data library?

You could seamlessly utilize our cloud based optimization to backtest massively in parallel and test your strategy for parameter sensitivity, in minutes

With the platform open-sourced, you could trade locally from your own servers, or send the algorithm to QuantConnect to live trade from our beautiful HTML5 interface when you’re away from your desk…

Dedicated live trading server running your strategies with HTML interface

Dedicated live trading server running your strategies with HTML interface

And by working locally you can guarantee your proprietary data is safe, and maintain complete strategy privacy.

We think this would be a perfect algorithmic trading platform and we want to make it happen!

We’re launching a quant-crowd-funding campaign!

When we reach 100 hobbyist subscriptions we’ve committed to open sourcing the QuantConnect LEAN Algorithmic Trading Engine! We want 100 fans, believers, passionate quants who will form the core pioneers of the QuantConnect platform.

With your help we will lead the future of algorithmic trading.

Pioneers will be forever remembered on our supporters page, in addition to receiving a dedicated live trading server for running your strategies! (1 CPU / 512MB RAM / 20GB HD / 1TB Data Transfer).

We’re just scraping the surface of what is possible with QuantConnect! We’re excited to be adding powerful new features, and making the engine faster and more robust each day. For the first 100 Pioneers you’ll get a lifetime, $10/mo hobbyist subscription. Once you upgrade we’ll apply the discount but it is for a limit of the first 100 users!

In the next few months we plan to offer:

  • Cloud Optimizations
    Massively parallel cloud backtesting, optimize parameters to reduce algorithm sensitivity in minutes across our cloud. Run monte carlo simulations and view strategy sensitivity curves.
  • More Asset Types and Data Import Assistance
    We’re starting futures and options asset support, along with a tool to easily import external data to design robust profitable algorithms!
  • Better Browser Coding
    We’re working on an object tree inspector and true C# auto-complete, combined with project folders so you can easily build complex strategies!
  • Universe Selection and Fundamental Data
    Fundamental data powered by Morning Star so you can select a universe of companies by index, earnings and other key fundamentals!

Upgrade today and help us build the best algorithmic trading platform in the world. Sustainable, independent and community driven.


Rotating Inversely Correlated Assets – NIFTY and USDINR

Over the last 15 years the economy of India has boomed and it has been reflected in the NIFTY index. The NIFTY has grown 7x since 1998 as the country has grown its exports. According to the UN the one of the primary exports of India are high value services which contributes 30% to their GDP.

We developed a hypothesis that as the strength of the NIFTY grew, the strength of the currency would follow as it is a primarily export economy. As the INR strengthens the ratio to USD falls making it an almost ideally inversely correlated asset.

We first tested this hypothesis treating the USDINR FX pair as a hedge against the NIFTY, but found there were periods where they were positively correlated and the hedge did not work.

Pivoting slightly we experimented with rotating the holdings of the portfolio to focus on the peak performing asset. We used a fixed rolling window to determine the peak performance and then swapped our holdings to focus on that asset.

We used the QuantConnect LEAN 2.0 backtesting engine which allowed us to import financial data from any source to run our analysis. The backtests were conducted over a 16 year period and were completed in 5-10 seconds. We saw phenomenal performance due to the strongly trending nature of the NIFTY and USDINR, achieving a Sharpe Ratio achieving 1.3 vs the NIFTY 0.7, and 42x returns vs 7x of the NIFTY.

To test the resilience of the strategy we experimented with the rolling window period to determine if this was critical to the success of the strategy. We used a rotating window from 3 days up to a 30 day window to optimize the variable for the best performance:

The resulting Sharpe Ratio is fairly robust regardless of the precise value of the rotating window period.

We believe there are many potential future improvements to the strategy to be explored; such as using a dynamically determined rolling window to avoid curve fitting. You could also experiment with different portfolios of inversely correlated assets to pick the best basket of assets.

Backtesting with a REST API

This weekend we reviewed the GIT-API and how people really wanted to use QuantConnect. We built the GIT-API enable using the powerful autocomplete features in Visual Studio. However requiring people to use GIT to submit a backtest was a step learning curve, and prone to errors when the website had traffic spikes.

As a result we made a decision to deprecate the GIT portion of QuantConnect, and replace it with a new RESTful API. It allows you to create projects and submit files for backtesting all via simple JSON commands. The REST API will allow unlimited innovation on top of QuantConnect’s backtesting engine. With just a few URL commands you can tap into our scalable cloud and backtest across terabytes of financial data. See our documentation for how to use the new interface.
Continue reading

‘Lean’ Backtesting Engine v2 Released

After 8 months development we’ve released a new backtesting engine powering QuantConnect called Lean. It is a complete rewrite of QuantConnect’s core technology that can take a generic time-series data source and run a backtest.

We wanted QuantConnect to quickly and easily accept any data source and be able to trade on it as it would equities. Almost every user has their own set of demands, languages, data-sets and trading strategies so we needed a backtesting platform that could accommodate them all.

There are several leaps in engineering with Lean, the key aspects are:

  1. Lightening Speed – We complete a simple backtest across 10 years of 1-minute data in 46 seconds. In head to head benchmarks we are literally 10x faster than the competing platforms (46s vs 7m40s)! This allows you to test ideas faster and design better strategies.
  2. Generic Data – Data sources are dynamically loaded at run-time so you can now backtest any market data that has a Time and Value. You define where the data comes from during backtesting, and can even specify a new streaming source for live trading.
  3. Custom Charting – Plot customized dynamic and flexible charts to the web browser directly from your algorithm. See our last post for some examples on how to use charting in your algorithm.

We’ve been able to maintain backwards compatibility but recommend updating your algorithms to use the new API. There key difference is the name of the data event handler:

//Deprecated v1.0 Event Handler:
public override void OnTradeBar(Dictionary<string, TradeBar> data) { ... }
//New LEAN v2.0 Event Handler:
public void OnData(TradeBars data) { ... }

TradeBars implements an IDictionary<string, TradeBar> so it will work with your current algorithms and make you future proof for updates to come.

If you’re designing locally in Visual Studio we’ve created a new QCAlgorithm base-class, so update your local copies from GitHub.

Here’s an example of importing Bitcoin data to backtest your strategy!

« Older posts

© 2017 QuantConnect Blog

Democratizing algorithmic investments Up ↑