Back to Community
zipline with non-US equities

I'm trying to backtest a strategy which is trading non-US stocks that I've downloaded daily price data for. Is there any example of how to do this with Zipline, as I can't find any example in the examples folder, or documentation for it.


10 responses

another easy solution is to find out the non-US stocks symbol name in also have non-US stocks quotes.

Does zipline.. cover non US stocks?? what are the exchange listed?? for non US

Yahoo price data might not be good enough, certainly not for institutional level. I've found a number of serious errors in the past, including completely wrong dividends/adjusted prices for e.g. British American Tobacco (BATS.L), a major global international Tobacco firm listed in London. I am interested in this too: how can one use external price sources and stock tickers with zipline? There comes a point where it might be simpler just to write one's own backtester, and indeed, Zipline is slow, but there are advantages to using zipline as effectively an outsourced backtesting package: it will only get better with time, is tested by users, and enables you to quickly implement and combine sophisticated quant algos quite easily. It seems optically an attractive proposition for a startup family office who are hybrid quant (quant screening + overlay to fundamental equity research strategy), who want to grow without spending 100ks on hiring quant teams, database administators, months of dev time etc. to reinvent the wheel, but wish to remain 100% in control of every aspect of their research process. Factset etc. are OK but suffer from a variety of ball-aching limitations (not least, intentionallyno proper documentation , and support staff are crap for advanced stuff) and essentially again you have to build everything bottom up. Quantopian is top down, you can focus on the actual research and algorithms which is pretty powerful, and how things ought to be done.

Hi guys, see here for a way to do this:

I'm busy working on this myself, so post here if you're hitting an obstacle. Can't guarantee that I can help, but will do my best.

Hi Richard,

this was some time ago: did you succeed? I build a monthly back-tester in the end, but am now looking at generating some daily back-tests on my new project and wondered about using the daily OHLCV European price data that I have access to together with other data time-series that I have.

Hi Carl,

Richard's experience might be different. I found the bundle method to be quite limiting, especially when getting into more complex scenarios involving passing adjustments (splits, bonuses, dividends) or custom calendars.

Thanks Charles.

I've already adjusted my daily prices for corporate actions and dividends, so that might not be such an issue for me? And I have my external portfolios pre-generated. I literally just want to set zipline up with my daily price source and backtest those long/short portfolios to get the risk stats and performance based on transacting at close prices.

Hi Carl,

There was some discussion here about whether using split-adjusted prices can cause a look ahead bias. Its kind of hanging. I use Zipline (not Qunatopian) and non-U.S data. To be on the safe side, I generate an 'adjustments_reader' object, which contains all the corporate actions, and then pass this into the algorithm. Using the bundle method referenced in an earlier post, I had a difficult time passing in adjustments and calendars. I'm not saying its not possible, I just found that method too opaque, and I was getting some strange results. At the time, it seemed like the only way of getting my adjustments into the algorithm was to manually build a DataPortal object and pass it my adjustments. Again, I'm not saying this is the only way, but its what I found that works for me, and is transparent, and verifiable.

That is a nice discussion, thanks for that! No look-ahead bias problems, but the trading cost issues are of interest ... I would not have thought of that until I had screwy results!

How easy is it to get zipline up and running? is there decent documentation, e.g. on the DataPortal object? I am under time-pressure and don't want to go down a rabbit hole ...

That's a difficult depends on how good you are at stepping through code. The documentation for Zipline is basic. There is some
documentation on the DataPortal object, but to understand how to create all the components that go into creating the object might take a while. It took me several weeks and lots of breakpoints to get an understanding of the flow through the entire algorithm, to the point where I could start inputting my own assets, adjustments and calendars. Note that all of this is handled by Quantopian for U.S equities...for non-U.S. equities you have to dive into the code.