I am using Windows 10, Miniforge, conda-forge channel, conda environment to install Zipline-reloaded.
How can I ingest 1-minute E-mini S&P custom data?
I got the following errors:
(env_zipline) D:\Users\Terence\ES_Trading\custom_bundles\minute>zipline ingest -b custom-csvdir-bundle
Traceback (most recent call last):
File "D:\Users\Terence\miniforge3\envs\env_zipline\Scripts\zipline-script.py", line 10, in <module>
sys.exit(main())
File "D:\Users\Terence\miniforge3\envs\env_zipline\lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "D:\Users\Terence\miniforge3\envs\env_zipline\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "D:\Users\Terence\miniforge3\envs\env_zipline\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "D:\Users\Terence\miniforge3\envs\env_zipline\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "D:\Users\Terence\miniforge3\envs\env_zipline\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "D:\Users\Terence\miniforge3\envs\env_zipline\lib\site-packages\zipline\__main__.py", line 397, in ingest
bundles_module.ingest(
File "D:\Users\Terence\miniforge3\envs\env_zipline\lib\site-packages\zipline\data\bundles\core.py", line 380, in ingest
if start_session is None or start_session < calendar.first_session:
File "timestamps.pyx", line 388, in pandas._libs.tslibs.timestamps._Timestamp.__richcmp__
TypeError: Cannot compare tz-naive and tz-aware timestamps
My extension.py is saved in C:/Users/Terence/.zipline :
from zipline.data.bundles import register
from zipline.data.bundles.csvdir import csvdir_equities
start_session = pd.Timestamp('2021-08-03',).tz_localize('US/Eastern')
end_session = pd.Timestamp('2023-08-04',).tz_localize('US/Eastern')
register(
'custom-csvdir-bundle',
csvdir_equities(
['minute'],
"D://Users//Terence//ES_Trading//custom_bundles//minute//e_mini_sp_data.csv",
),
calendar_name='CMES',
start_session=start_session,
end_session=end_session
)
My data:
PS D:\Users\Terence\ES_Trading\custom_bundles\minute> Get-Content e_mini_sp_data.csv -TotalCount 10
ticker,date,time,open,high,low,close
@ES,2021-08-03,22:01:00,4513.75,4515.75,4513.75,4515.0
@ES,2021-08-03,22:02:00,4515.25,4515.5,4514.75,4515.0
@ES,2021-08-03,22:03:00,4515.0,4515.75,4515.0,4515.75
@ES,2021-08-03,22:04:00,4515.75,4516.0,4515.5,4515.75
@ES,2021-08-03,22:05:00,4516.0,4516.25,4515.75,4515.75
@ES,2021-08-03,22:06:00,4515.75,4516.0,4515.5,4516.0
@ES,2021-08-03,22:07:00,4515.75,4516.0,4515.25,4515.5
Regards,
Terence