zipline icon indicating copy to clipboard operation
zipline copied to clipboard

What's the equivalent to Quantopian symbol lookup in zipline?

Open quocble opened this issue 9 years ago • 3 comments

quocble avatar Apr 18 '17 02:04 quocble

Hi @quocble, you can use the lookup_symbol method in the AssetFinder class.

In [42]: from zipline.assets import AssetFinder

In [43]: import pandas as pd

In [44]: finder = AssetFinder(asset_db_path)

In [45]: finder.lookup_symbol('AAPL', as_of_date=pd.Timestamp('2016-01-01', tz='utc'))
Out[45]: Equity(0, symbol='AAPL', asset_name='', exchange='YAHOO', start_date=Timestamp('1990-01-02 00:00:00+0000', tz='UTC'), end_date=Timestamp('2017-03-22 00:00:00+0000', tz='UTC'), first_traded=None, auto_close_date=Timestamp('2017-03-23 00:00:00+0000', tz='UTC'), exchange_full='YAHOO')

freddiev4 avatar Apr 24 '17 03:04 freddiev4

If by symbol lookup you mean in the context of a backtest, then you would need to do from zipline.api import symbol and then use symbol('AAPL'), or whatever equity you want to trade

freddiev4 avatar Apr 24 '17 20:04 freddiev4

Hi @quocble I'm going to go ahead and close this issue. If I still haven't quite answered your question, feel free to re-open this.

freddiev4 avatar Aug 08 '17 15:08 freddiev4