简体   繁体   中英

How do I load an index (Dow, Nasdaq) with Zipline?

加载单个股票是没有问题的,但是我一直在加载股票索引方面苦苦挣扎,所以我认为应该分享。

If you want to load an index with zipline just add it to the stock parameter like this:

    data = load_from_yahoo(stocks=['AAPL', '^gspc', '^ixic'], indexes={}, start=datetime(2014, 1, 1), end=datetime(2015,4,2))

This will load both Apple's stock prices, NASDAQ Composite and s&p500.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM