Back to Community
Quantopian in the real world

How can I use algorithms that I have created on Quantopian on the stock market? Do I need to re-write the code for platforms like ninjatrader?

41 responses

Hi Greg,

We're working on building our live trading capabilities. We plan on letting you connect your Interactive Brokers account so that your Quantopian algorithms can be turned on live, and place orders to the market via IB. This is our biggest focus right now, and we hope to have something ready in the near to medium future.

You won't have to rewrite anything - once you are happy with an algorithm, it will be very easy to start trading it live (with paper or real money).

thanks,
Jean (Quantopian)

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hello Jean,

If I understand correctly, it sounds like Quantopian will basically be an alternative API for Interactive Brokers (IB), but with the same cost structure. Or will the costs be significantly lower (seems unlikely, since then all of the IB customers would just use Quantopian)? Or higher, since Quantopian has to make money, right?

I'm just trying to sort out the advantage Quantopian will be offering (other than the nice browser-based backtester, free historical data, community forum, Python, etc.). What's the business plan? I gather that your model is that there is a large, untapped market of individual algorithmic traders, but it would seem that the capital requirements and costs would need to be lowered to attract more participants.

Grant

Hi Grant,

Thanks for the detailed questions. Yes, we want and need to make money.

As it stands now, we have already dramatically reduced the total cost for algo trading. Besides the time to develop a backtesting system, we have also arranged for free historical testing using high quality data. We will do the same for paper trading against a live market feed. These are very substantial cost savings for the individual quant, particularly since they are costs that you would incur before you have the chance to generate profits by trading at all.

When it comes to live trading, the cost structure is totally dependent on the volume traded through Quantopian. The more volume we can aggregate, the better we can negotiate with brokers, and the more we will be able carve out profits for Quantopian, and pass savings along to you as lower commissions.

As for capital requirements, the vision is for Quantopian to help quants connect with backers by providing backtesting results that can be compared to peers, audit-able performance track records for real trading, and massive global distribution. Capital introduction fees today border on the predatory, because new managers have so many hurdles to be marketable to institutional investors. This is another area where I think we can create profit for Quantopian while lowering costs and eliminating barriers for quants.

Of course, all of this is just pie in the sky until we execute trade 0 in the markets. That's why we are maniacally focused on building live trading.

thanks,
fawce

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thanks Fawce,

It will be interesting to see how your business evolves, having been observing and participating from a relatively early stage. Not to be cynical, but one concern I have is that Quantopian will attract and enable a lot of gambler types. I recall that prior to the dot-com/tech bubble burst, there were lots of folks basically participating in a form of legalized online gambling (although at the time, I guess that most of the trading by individuals was manual, not automated and algorithmic). My sense is that your mission is to enable prudent, capable individual traders (a relatively small market), but my hunch is that you'll attract lots of gamblers (a huge market).

Perhaps you could offer some kind of confidential review process of algorithms by professionals (e.g. familiar with the so-called "corner cases" that might not be captured by backtesting)?

Grant

Grant,

I love the idea of the review process. To make it scale, we'd need some way for the community to self-organize in this way. What kind of incentives could we create for the reviewers?

thanks,
fawce

Hello Fawce,

I suggest thinking about an automated review process, which might be considered an extension of backtesting. One thing you could do is somehow reconcile the Quantopian backtester with real-world trading with a specific broker. I gather that your first broker will be Interactive Brokers (IB), so you could work with them to ensure that the Quantopian backtester will, with high fidelity, simulate live trading on their system. For example, one concern I've seen is that of latency between order submission and order fulfillment. IB should be able to provide detailed guidance (e.g. statistics) on how to capture this detail in the backtester.

The review process could also include a questionaire/test for the trader, to give him feedback on his readiness for live trading (I would fail).

Grant

I think the more cynical (but fair) point to make is that Quantopian has been financially supported by Getco (HFT, arms race stuff). While you say we can keep our code private, ultimately you will have access to everything to your servers right? so how will we ever know you arent taking the best of the best algorithims from your web army of coders and disseminating them to whomever you please?

I love what you are doing here, but soon as you get to plug this into the real world things get ramped up to 11 for all involved!

Hi Tybalt,

Thanks for the candor. We recognize that we are asking our members for their trust, and we've written a bit about it previously: http://blog.quantopian.com/on-trust/ That post includes a status of our security profile, what we've done, and what we still need to do. We are always eager for advice and demands on the privacy and security we are building.

I believe we have to earn your trust by being completely transparent, protecting your algos, and coming clean whenever we hit a problem. As a start, our terms of service clearly stipulate the algos you make here are your private property. As an example, we were attacked in December and had to shut down the site for about 24 hours. We immediately let the community know what was happening, and we detailed the events on our blog: http://blog.quantopian.com/post-mortem-of-121212-attack-on-quantopian/. We learned a lot from the experience, and we continue to advance our security infrastructure.

Part of the thrill for us is gaining your trust in such a high stakes endeavor. We need to be ethical in our stewardship of your intellectual property, rock solid in our technology execution, and totally open in our communication.

Our ambition is to build a giant business around the execution of our members' algorithms. We would instantly lose that opportunity if we stole your IP. While there are sure to be incredible winners running on Quantopian, I see a better long term for Quantopian if we are the platform for numerous winning algos.

Let's go to 11!

Thanks,
fawce

Tybalt,

I want to add one thing Fawce's answer. In the end, you're not trusting a company, you're trusting people. When we put up our About Us page we deliberately did not put in mini-bios and instead linked to our reputation-driven, external profiles. We are all active, trusted members of the technology and finance communities. I'm hoping that curious people like you can find a common link that can vouch for us as people that can be trusted.

(Side note: I recently finished Bruce Schneier's book Liars and Outliers and it has some fascinating insight on the challenges of trust for individuals, corporations, associations, and society as a whole. Great read.)

Dan

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Appreciate the replies. I am UK based so just watching and playing for now, but assuming UK data/ connectivity comes on line then I will play more!

One thing I am sure you have thought of, is the easier you make the perception of this, the wider the net of people that come in to play, the wider the net of people that might dabble with connectivity to the real world. As soon as they start losing money, the greed/fear/anger of their markets experience will overflow into the, so far, incubator community. It may not be pretty.

given somebody like IB offers data to play with, perhaps demo accounts with connectivity would be possible. Though I have no idea of any perceived drain on their esources, it is something they do offer at present with an admin style account I think? So if you dedicated resources on your side to emulating slippage/fills/costs etc then perhaps people could run algos realtime on IB's limited data feed and run in a sandbox before going live?

Hello folks,

Some feedback:

  1. Last I heard, Quantopian had not yet encrypted members' algorithms (see help page) and implemented the full security measures envisioned (see blog comments by Jonathan Kamens). What is the status? What will you have in place prior to going to live trading?
  2. Simple password access by users seems kinda weak. I'm no expert, but it seems like you need some sort of two-factor authentication.
  3. The rationale to allow Quantopian support to access members' algorithms needs to be fleshed out (blog comments by Jonathan Kamens) . If I am understanding Jonathan correctly, the main reason is to allow Quantopian to review algorithms is to ensure that there is no malicious code. This doesn't really make sense. Somebody could plunk in code and immediately execute it. And Quantopian should be engineered to be immune to hacking anyway.
  4. If your system can result in members' algorithms ending up in non-volatile memory at any point, my sense is that you have a security flaw that needs fixing.
  5. It might be a good idea to have the system independently reviewed for security and then publish the findings.

Grant

correct me if I was mistaken, it seems the order method now does not support stop orders, trailing stop orders, limit orders.
It would be great such order types are built in. The code would be much easier to read and I believe it would be easier to migrate the algo from backtest to live trading in IB. As far as I know these type of orders are supported in IB naively.

So far, we only have market orders. We're adding a few more in the next few weeks:

  • limit
  • stop
  • stop limit

I'm curious what you'd like to see next - as in, what's the next order type to add to the support list.

P.S Grant I know Jik's going to get to your questions later.

Jay,

The different order types that Dan listed are actually implemented in zipline already, thanks to the wonderful contributions of zipline contributor Tony Worm. You can review his implementation on github if you are interested: https://github.com/quantopian/zipline/blob/master/zipline/finance/slippage.py

Also in the queue for zipline are higher level order management functions from (also wonderful) zipline contributor Jeremiah Lowin. Jeremiah's proposed changes are being reviewed for merge, and you can see the proposed changes in this github pull request: https://github.com/quantopian/zipline/pull/104

My current stream of work includes exposing these new functions in Quantopian. I'd love to hear your thoughts and requests.

thanks,
fawce

John,

You obviously have a relationship established already with IB. I have two questions. (i) is it possible that other brokers be added later? (ii) IB, from my brief investigations, want $10,000 to open an account. Is this your understanding?

Regards,

Peter

Hi Peter,

We are starting by integrating with IB's API. We will support other brokers over time - anyone you'd like to see us prioritize?
The account minimum at IB is $10k, however, to trade actively the SEC requires you to have $25k.

thanks,
fawce

Hello John,

I don't have a priority. Dukascopy interest me but they are Forex only. I'm sure a salesman told me I could open an account with £100 or $100 (I can't recall) which is of interest as they only do 30-day demo accounts. But then they are Java-centric....

Regards,

Peter

Forex has lower account limits because they aren't regulated by the SEC. Makes for a much looser market - and a greater need to be careful!

Dan

$25k? Eesh. I just googled Reg T, and it said the leverage was capped at 2:1. Is that true?

That figure sounds about right to me -- only large institutions can have larger leverage than 4:1, I think?

Forex is accessible to everyone, basically. Because great algorithmic researchers are not always in the same set of people who have huge piles of cash lying about. Leverage is a far better tool in forex, as compared to stocks, since you can basically control your exposure to volatility with a lower leverage. And going up to 400:1 leverage is quite possible too....

As far as I know, IB's minimum deposit is 10k. For day-trading, which is probably what someone here needs, it is 25K.
Reg T margin, i.e. regular margin is 2:1. If you keep 110,000+ in your account, you may upgrade to Portfolio Margin which gives you an effective 4 or 5:1 leverage depending on your portfolio risk. Other ways to leverage is to use 2x and 3x ETFs, volatile ETFs like VXX or XIV or small priced stock.

As for orders, OPG and MOC orders could be useful, although I am not sure they can be "backtested".

Hello John,

About IB live trading, do you already know how it will work ?
Should I insert my account UID/PSW on your website and then your framework will send orders to my account automatically ?
or I will receive signals on my computer and forward them to my IB account ?

thank you
Alberto

Hi Fawce,

Is there a timeline for when these new features of Quantopian will be rolled out?

More specifically:
1. When we can use Forex, futures..etc?
2. When we will be able to live paper trade?
3. When we will be able to live trade?

Understandably, there are many factors that could affect this but do you and your team have a rough estimate for when these will be available?

Lastly, you mentioned before that one of the goals of Quantopian is to connect quant developers who may not have the funds with investors who do. Will there be a way for Quantopian members to post algorithms without providing the source code, only the backtesting/paper trading results?

Thanks,

Jorge

@Alberto,

We will provide a hosted environment with a dedicated VM running the IB gateway. You'll be required to login to IB daily as you normally do, but via our web form which will forward your UID/PSW and challenge to the IB gateway. The gateway machine will then connect to your algorithms running in Quantopian and start receiving orders, and relaying trades. We built it this way so that we had a complete environment to offer you, and we could maximize the stability, security, and performance of the live trading environment. I'd love your feedback and advice!

thanks,
fawce

@Jorge,

We recently won a spot at Finovate SF on May 15th, where we will demonstrate live trading for equities. We've put ourselves on a Maker's Schedule and we are laser-focused on live trading equities until it ships. We don't have public dates for forex and futures yet, but I expect we will start working on it this summer. As I have said elsewhere, member interest is very clear, and it is a matter of how soon, not if.

I have received inbound interest from several parties who want to fund Quantopians. Clearly, accepting funding is only possible if you can also trade your algorithms. Hence our maniacal focus on live trading!

If we were to work on capital introductions and seeding, I would see Quantopian's role as providing agency for our quants to raise capital. I believe the right long-term investment is to focus on what our community of quants want. There are a lot of companies and people talking about matchmaking between quants and capital, both past and present. What I would love to know from you is:
- today, everything you create is private, but investors will demand disclosure. what would you be comfortable disclosing to prospective investors? to the public?
- what terms would you expect for capital funding your strategies?
- would you accept fees from Quantopian for the introduction? would a percentage of assets raised be fair?
- does this place Quantopian in a conflict? we need to be neutral to trading strategies developed by our community, does connecting quantopians with investors present a conflict in your view?

thanks again for the questions,
fawce

@fawce

Thanks for the quick response. As someone relatively new to quant trading, with little capital, I can give you that perspective.

I think forcing the complete disclosure of algos to the public isn't possible and think it would deter many people from even trying to raise capital publicly. However, I agree that there needs to be some sort of disclose. I think a more rigorous summary, without the source code, of results from backtesting (and eventually paper trading) than what is currently shared when you share an algo with the community would be a good start. In addition, adding some sort of quality control test provided by Quantopian to ensure investors that the results are legitimate and not due to algos running wild (like the Sample one if you let it purchase AAPL like crazy). From there, investors could contact the developer directly through Quantopian where the investor would agree to some kind of NDA to protect the developer. After that I think it is reasonable for the developer to share their source code with their investor. However, given the nature of trading algos, as a lone developer you'd never really know if someone took your source code and is running it on their own, outside of Quantopian. Maybe some sort of screening process of the potential investors should happen before allowing them to contact a developer?

As for fees, I don't really see an issue with Quantopian taking a cut of assets raised, less of something is better than all of nothing. Other people may object since Quantopian will still be making money by executing trades but I don't think it is unreasonable. I think the percentage should be scaled to the investment, which also leads into the question below.

In terms of connecting developers with capital, do you think the focus would be more on single investors with larger amounts of capital, or many smaller investors as a kind of crowd sourced funding for algos? I think both could be potentially very successful but would require very different implementations.

As far as a conflict goes, I don't really see one. The community will continue to serve its purpose of educating and allowing people to share. If/when investors are allowed in I don't really see this deterring people from continuing this, as I can't imagine everyone on Quantopian now is sharing their best strategies.

Jorge

my initial thoughts still stumble at the points raised over a week ago:

" Last I heard, Quantopian had not yet encrypted members' algorithms (see help page) and implemented the full security measures envisioned (see blog comments by Jonathan Kamens). What is the status? What will you have in place prior to going to live trading?
Simple password access by users seems kinda weak. I'm no expert, but it seems like you need some sort of two-factor authentication.
The rationale to allow Quantopian support to access members' algorithms needs to be fleshed out (blog comments by Jonathan Kamens) . If I am understanding Jonathan correctly, the main reason is to allow Quantopian to review algorithms is to ensure that there is no malicious code. This doesn't really make sense. Somebody could plunk in code and immediately execute it. And Quantopian should be engineered to be immune to hacking anyway.
If your system can result in members' algorithms ending up in non-volatile memory at any point, my sense is that you have a security flaw that needs fixing.
It might be a good idea to have the system independently reviewed for security and then publish the findings."

The closer you get to live trades, the tighter and more secure you need to prove yourselves to be imo.

may I suggest you look at http://rapacapintro.com/ for ideas on how to match traders with capital

Long thread - so this may have already been asked - but do you already have any brokers in mind? (and who are they)

P.S. I never got that quantopian t-shirt ='(

ah wait lol "IB"... I thought it stood for "introducing broker" when I was skimming, until I realised you meant "interactive brokers" the company :P

EDIT: Reading more of the thread, I also notice the mention of IB having a min of $10000... I was hoping to run experiments with $1000... What are the options for people hoping to start with less money?

EDIT 2: Will we be able to run algorithms on live data, using fake money?

Adam, I'm the guilty party on the t-shirt. I have a list of people I haven't shipped yet. Sorry for the delay. I will do it pronto.

Dan

No worries ;)

P.S. I would also be interested to know where IB's servers are located and how close will both they be to each exchange, and how close will quantopians servers be to the IB servers?

Will the speeds be suitable for HFT type strategies?

Adam,

Other instrument types, such as forex, have lower capital requirements. Another option is a retail broker like eTrade. eTrade has a nice API that is RESTful, making it nice for server to server integration. The major drawback is the commission rates are far higher for the retail brokers.

Yes, live data and fake money will be supported (soon).

Quantopian does not do HFT. Our live data will also be minute bar data. Our goal is to encourage research into longer hold periods and non-market data analysis.

thanks,
fawce

@John
>We will provide a hosted environment with a dedicated VM running the IB gateway.

Will I have full (root) private access to this hosted environment ?

thank you
alberto

P.S. I can personally vouch for the Quantopian t-shirts! I wear mine everywhere and they are great quality :)

Hello Alberto,

No, the plan isn't for our members to have access . I think the best way to think of the planned architecture is that it will be very like the current system we have for algorithms and backtesting. The only difference is that when your algorithm emits an order, instead of that order being "filled" by Zipline the backtester), the order will instead be sent to the IB gateway. IB will process the order and pass the response (presumably a fill) back to the IB gateway, and the IB gateway will pass the result back to the algorithm.

The point of the dedicated VM for the gateway is so that we can segregate each members' IB account. The dedicated VM isn't for general login or backtesting, really just the gateway.

Dan

Just a thought, besides crowd sourcing capital or attempting to create a platform to attract outside investors... any chance that there could be an option to trade as an "investing club" (http://www.sec.gov/answers/clubs.htm). I think this could also be an easy and legal structure for obtaining investors who are actively involved. I'm not very well versed on securities law, but the idea here is to find a way to pool money together to meet the $25k minimum. As a college student, $25k is a lot to ask, but finding 5 fellow students and doing 5k each is much more manageable..

Alex,

Interesting...also, will Interactive Brokers set up an account in the name of an investing club?

A relevant article: http://www.cbsnews.com/8301-505123_162-51489832/bad-investors-single-men-and-investing-clubs/. "The turnover of single men was 67 percent greater than that of single women..." My sense is that one target market for Quantopian is employed professional single young men with sports cars and expensive watches (i.e. money to burn) and not pencil-neck geeks, but I could be wrong. One potential outcome of making finance more open is that Quantopian will convince more people to avoid active trading, rather than to engage in it (assuming that they do thorough back-testing and risk and cost analyses prior to trading with real money).

Another thought is that Quantopian could assist in getting unique trading algorithms patented.

Grant

Greetings, new here, with a question. [Jumping from Apr to Dec 2013]
Dreaming, suppose I help develop the most awesome trading algo ever.
Just wondering what reasons there might be that I might want to keep it under my hat.
If others were to use the code too (and maybe improve on it further), and make a lot of money along with me, can that conceivably have a positive (or negative) effect on the market in general, or on my trades? (Imagine a lot of people using the exact same code hypothetically, although in the real world there would most likely be little tweaks differentiating them to some degree, human nature).
There was some talk of privacy above, if I were to share my algorithm with Quantopian as well, maybe they might like to use for themselves and reap a lot of income too and then maybe that could benefit all of us with lower (eventual, when that happens here) live trading fees for example?
Any thoughts? Thanks.

/hawkins

Great questions in this thread. To add to connecting investors with quants, one way might be to use the community and profiles. If there was a way to make full backtest results (minus the source code) selectively available to look at through the member profiles, investors could snoop around and follow members that they think have potential. It would have to be selective so that only results from current working versions are available. Eventually there could be a separate investor's login tailored to looking for quants to invest in.

Question1.
In live trading, will all algos be connected to the same IB account? Will, there be a minimum amount of $ that each algo has to be trading or is the minimum amount at the account level and can be split up between as many algos as we see fit. It would be nice to be able to live-test with small sums of $ for a while before going full throttle.

Question2.
Does Quantopian have plans to make some standardized simple orders? For example, If I wanted to buy 10 shares of Apple, it doesn't make sense to run an algo that just buys on the first day and does nothing ever again. Generators could be useful for these types of one time orders.

Gary and David, I strongly encourage you to create new topics instead of posting in old ones. It's hard to follow when an old thread suddenly starts going all over the place. I answered your questions in a separate post.