Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Zipline - algorithmic trading in open source Python (github.com/quantopian)
157 points by fawce on Feb 1, 2013 | hide | past | favorite | 30 comments



I work at an algorithmic trading shop and have spent a fair amount of time studying equity market structure. It's great to see an open source trading platform, but I think it's important to stress the following: Equity markets are highly competitive. If you choose to use this platform for trading, you will lose money on average. As a retail trader, you face numerous disadvantages that many market participants do not face. By increasing your trading frequency, you will increase your costs and decrease the likelihood that you will make money. Good luck!


Make sure to check out the wonderful web application the Quantopian team has built using this library at http://www.quantopian.com


Welp, there goes every plan I had this weekend. Thanks.


The topic of this post seems a little off. The description of zipline on its github page is "financial backtester for trading algorithms written in Python" which is a bit different.


I'm one of the co-maintainers of the project.

You're right that there is a chasm between backtesting and actual trading.

The title may be a little future thinking, we are working on adapting the event/stream-based backtesting engine to drive live trading.

Updating the description to help declare intended goals of being a wider algorithmic trading suite.


The "Hello World" sample algorithm on Quantopian gets a 4000% return if it operates on AAPL for a year. It makes trades each minute using a "3 day volume-weighted-average-price." I find it hard to believe this algorithm would perform so well in the real world.

How much of an impact would factors like latency in a real world environment have on this algorithm?

https://www.quantopian.com/posts/the-hello-world-algorithm-m...


If you are trading in small lots, not very much. For the example of AAPL which has a daily volume of 20mil shares, at the current price of $450, a $450 million buy or sell order on AAPL will only be 1% of the daily trading volume.

Problem is that the bigger the ticker, the more crowded and optimized your competitors already are. The spread on AAPL options/stock is razor-thin, so using IB to do any kind of arbing/volatility/market-making trades is probably not going to be idea.

The trade-off with smaller ticker is you might have less competitors and even if it's a good opportunity, hedge funds aren't interested because potential profit is less than $1mil but for a retail guy, it's a lot. But the catch is the market is thinner, so in a volatile event, you might not be able to trade out of a very bad situation quickly. So your risk is higher.

Basically anything involving HFT where you are trading for liquidity rebates or sub-penny profits doing market-making or arbitrage, latency is critical; but 1sec tick data is an eternity already, for those operations, you need co-location to the exchanges for quotes and execution, not to mention 1mil+ trading capital for sub-penny profits/share to make sense.

1 second tick data would be more useful in swing trading situations where your profit target is 5-10% in a span of a few days to a week - it matters less if your order gets executed $0.01 less or more. So latency shouldn't be an issue.


> second tick data would be more useful in swing trading situations where your profit target is 5-10% in a span of a few days to a week - it matters less if your order gets executed $0.01 less or more. So latency shouldn't be an issue.

How stiff is the competition in that kind of trading?


The unrealistic aspect of that backtest is the total leverage - the algorithm ends up borrowing something like $700k on an initial balance of $10k.

Why not prevent this borrowing in the backtest? Quantopian's philosophy is to report the results, rather than block you from trying outrageous scenarios.

Backtests are not predictive; they are a tool to investigate the behavior of your algorithm.


Quantopian presented at the New York Software Engineers meetup last week. As somebody who has built proprietary backtesting software before, I applaud their open-source approach to this problem. They have some recorded presentations on their blog for anybody who is interested http://blog.quantopian.com/


This looks pretty good. You already have competitors out there like Collective2. It'd be nice if you guys can get options data with IV; it's probably harder to get data licenses for historical options data but it'll differentiate you guys from the rest of the competition.


The data is more expensive, but the other challenge is the complexity and volume of the data. Our thought is to build an end-to-end system on equity and then add other instrument types.


Shameless plug, but Bloomberg's Data License product has, for example, all exchange traded options with full greeks, IV, etc available with many years of historical data among plenty of other asset classes. Typical sales are done to Terminal customers, but the team is always open to talking to businesses with a different model.


Very cool to hear from you, and to learn that Bloomberg is open minded about new models. I'd love to learn more - my email is on my profile if you want to drop me a line.


It's super cool to see these guys open source the code that runs their project.


If you decided to use an algorithm for real-world investing, what brokers would you recommend that have good APIs?



Thanks for the tip. Looks like they have a 10k minimum balance.


Given most brokers transaction fee model, I don't think you'd want to algo trade with much less than that.

Though iirc Collective2 lets you test strategies for free:

http://collective2.com/


Because of the volatility of returns there is a minimum amount of money needed, sums below that minimum are just going to get wiped out before they have a chance to get a buffer added. 10K lower limits are there for good reasons.


If anyone can find an api with intraday quotes and support for backtesting which doesn't require a 10K mininum please let us know!

(I know that's probably 0 brokers)


IB has an API that supports tick-by-tick historical data and real-time quotes. You might be able to sign up for a demo account and pull from their historical database. You'll have to roll your own backtester though when you build your own historical DB.

But to save you the time, applying regular ML to historical tick-data will only make you into a smarter market-maker. In usual trending or sideways equities, you'll make small amounts of money followed by a catastrophic loss due to catalyst events, earnings etc that wipes out months of money.

Perhaps the most important part of algo-design is not the ML, but tweaking draw-down and risk management.


You'll have to roll your own backtester though when you build your own historical DB.

Or you could just PR a new data source class for Zipline that pulls data from IB. Ah, the wonders of open source!


when did IB get tick data? the last I checked they just had one second bars, which are totally different.


I believe IB only requires 10k initial deposit and then you can maintain your account on 2k (+ some buffer).


I think interactive brokers is one of the common choices for people who don't have the resources/money to get direct exchange connections or similar.


IB gets you more access for less money than any other outfit I'm aware of. They narrowly missed getting Corzine'd last year. I'm glad they had the sense to walk away. http://www.futuresmag.com/2011/11/04/interactive-brokers-chi...


A little off-topic, but I'd love to hear the experiences of someone who has actually done algorithmic trading using their personal finances. I assume that there are enough hurdles in comparison to the major market participants that you'd have lots of trouble making money on average.


What is the real advantage of this over Expert Advisor on Metatrader ?


Awesome.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: