shlomiku / zipline-trader

Zipline Trader, a Pythonic Algorithmic Trading Library with broker integration
https://github.com/shlomikushchi/zipline-trader
Apache License 2.0
317 stars 71 forks source link

Error occured when bundling ALL stocks #207

Open fimmugit opened 2 years ago

fimmugit commented 2 years ago

(ZT36-live) C:\Users\itshuang\anaconda3\envs\ZT36-live\Lib\site-packages\zipline-trader>python zipline\data\bundles\alpaca_api.py zipline\data\bundles\alpaca_api.py:272: UserWarning: Overwriting bundle with name 'alpaca_api' def api_to_bundle(interval=['1m']): zipline\data\bundles\alpaca_api.py:350: UserWarning: Overwriting bundle with name 'alpaca_api' end_session=end_date Merging daily equity files: [------------------------------------] 0% Traceback (most recent call last): File "zipline\data\bundles\alpaca_api.py", line 358, in show_progress=True, File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\bundles\core.py", line 513, in ingest pth.data_path([name, timestr], environ=environ), File "zipline\data\bundles\alpaca_api.py", line 302, in ingest daily_bar_writer.write(daily_data_generator(), assets=assets_to_sids.values(), show_progress=True) File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\psql_daily_bars.py", line 617, in write return self._write_internal(it, assets) File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\psql_daily_bars.py", line 665, in _write_internal for asset_id, table in iterator: File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\psql_daily_bars.py", line 658, in iterator for asset_id, table in iterator: File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\click_termui_impl.py", line 328, in generator for rv in self.iter: File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\psql_daily_bars.py", line 609, in for sid, df in data File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\psql_daily_bars.py", line 716, in _write_to_postgres result = self._format_df_columns_and_index(data, sid) File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\psql_daily_bars.py", line 716, in _write_to_postgres result = self._format_df_columns_and_index(data, sid) File "C:\Users\itshuang\anaconda3\envs\ZT36-live\lib\site-packages\zipline-trader\zipline\data\psql_daily_bars.py", line 806, in _format_dfcolumns and_index data.index = data.index.normalize() AttributeError: 'Index' object has no attribute 'normalize'

fimmugit commented 2 years ago

This is related to issue #190 and I have made some suggestions to solve it. See #190