zipline
zipline copied to clipboard
What's the equivalent to Quantopian symbol lookup in zipline?
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')
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
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.