Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zipline function to get stock price history #2294

Open
bsobhani opened this issue Sep 17, 2018 · 3 comments
Open

Zipline function to get stock price history #2294

bsobhani opened this issue Sep 17, 2018 · 3 comments
Labels

Comments

@bsobhani
Copy link

The function get_benchmark_returns in zipline.data.benchmarks returns an array containing the daily percent changes for the stock you input. Is there a similar function which returns just the stock price history? I could do this with pandas DataReader but I am worried the timestamps might not match up when backtesting.

@freddiev4
Copy link
Contributor

freddiev4 commented Sep 18, 2018

@bsobhani I think what you want is data.history(); let me know if that's not what you're looking for 😃

@bsobhani
Copy link
Author

bsobhani commented Oct 2, 2018

@freddiev4 Correct me if I am wrong but my understanding is that data.history() can only be called from within the handle_data function in a zipline simulation. Is it possible to call something like data.history, but outside of a zipline simulation? I would like to develop an algorithm independent of zipline, while also having the option to backtest the algorithm using zipline. Therefore, I would like to be able to use the same dataset for the algorithm as I use for the zipline simulation. One option would be to first run a dummy zipline simulation where the price of the desired stock price is recorded as a column, and feed that data to the algorithm, but I was wondering if there is a simpler way.

@AndreasClenow
Copy link

@bsobhani Perhaps this can help you out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants