quantopian / zipline

Zipline, a Pythonic Algorithmic Trading Library
https://www.zipline.io
Apache License 2.0
17.7k stars 4.73k forks source link

Best Way to Integrate Fundamental Data into a Pipeline #2163

Open trical09 opened 6 years ago

trical09 commented 6 years ago

@freddiev4 I am familiar with integrating OHLCV data + divs + splits into zipline. What is the best way / is there an example for integrating / 'ingesting' fundamental data (let's say P/E ratios) for use in a pipeline?

freddiev4 commented 6 years ago

@trical09 there are some bits and pieces lying around in the GitHub issues (https://github.com/quantopian/zipline/issues/911) (https://github.com/quantopian/zipline/issues/2135) and Zipline Google Group but not yet any official docs on creating a custom dataset this way.

calmitchell617 commented 6 years ago

I am also trying to integrate fundamental data into a pipeline. I plan on writing up some beginner friendly documentation once I feel that my solution is ready.

calmitchell617 commented 6 years ago

@ssanderson @peterfabakker @marketneutral

I wrote a tutorial showing how to backtest strategies which use fundamental data within Zipline. The tutorial uses the Sharadar SF1 and SEP datasets. It is a rough first draft, and it would be great to get constructive feedback on the readme, or the actual code itself. Here's the repo: https://github.com/calmitchell617/Springbok

My plan is to refactor the code and readme, record a step by step webcast to walk people through it, then bring it all together with a blog post.

Lastly, I'm interviewing at Quantopian in the next couple weeks, wish me luck.

ashisgoyal commented 5 years ago

Hey @calmitchell617 this is really useful. Thank you. I had question, do you know if we can integrate any broker API with Zipline( not IB). I mean do Zipline allow to integrate generic standard broker API( so that I can fire trade from Zipline to the broker API)

Thanks in anticipation.

HyperionSounds commented 4 years ago

@calmitchell617 have you had the opportunity to consolidate your method for bundling fundamentals / using fundamentals in pipeline? I am already using sharadar as my bundle data source, and I am hoping to incorporate fundamentals into my trading strategies.

aajtodd commented 4 years ago

Any reason the Morningstar fundamentals implementation can't be open sourced? It would be nice to have as an example for other fundamental data sources but also so those that have access to Morningstar data don't have to reinvent the wheel.

HyperionSounds commented 4 years ago

yahoo has free fundamentals, I have not nor do I know of any bundle adaptations from this source yet, but seems like it would be easy enough to integrate:

from yahoofinancials import YahooFinancials

ticker = 'AAPL' yahoo_financials = YahooFinancials(ticker)

apple_earnings_data = yahoo_financials.get_stock_earnings_data() apple_net_income = yahoo_financials.get_net_income()

life-elixir commented 4 years ago

Hi @calmitchell617 I tried this and surprisingly at the end of process bundle it converts all of the tickers into empty 32B files.

aajtodd commented 4 years ago

@freddiev4 Any update on this? Is there a reason what Quantopian uses to load fundamentals can't be open sourced? Thanks.