stefan-jansen / zipline-reloaded

Zipline, a Pythonic Algorithmic Trading Library
https://zipline.ml4trading.io
Apache License 2.0
1.13k stars 210 forks source link

csvdir ingest failure when show_progress = True #167

Closed Sia-Namir closed 1 year ago

Sia-Namir commented 1 year ago

When show_progress = True we will have following error: ########### sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: equity_symbol_mappings.symbol [SQL: INSERT INTO equity_symbol_mappings (id, symbol, start_date, share_class_symbol, company_symbol, end_date, sid) VALUES (?, ?, ?, ?, ?, ?, ?)] [parameters: (0, None, 0, '', '', 0, 0)] ############

because after this lines(198-202) of csvdir.py: ############ fnames = { f.name.split(".")[0]: f.name for f in files if f.is_file() and f.name.split(".")[0] in it } ############

"it" will not be available and the rest of the code will not be executed(204-....): ############ for sid, symbol in enumerate(it): logger.debug(f"{symbol}: sid {sid}") fname = fnames.get(symbol, None) ############

ramashisx commented 1 year ago

When show_progress = True we will have following error: ########### sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: equity_symbol_mappings.symbol [SQL: INSERT INTO equity_symbol_mappings (id, symbol, start_date, share_class_symbol, company_symbol, end_date, sid) VALUES (?, ?, ?, ?, ?, ?, ?)] [parameters: (0, None, 0, '', '', 0, 0)] ############

because after this lines(198-202) of csvdir.py: ############ fnames = { f.name.split(".")[0]: f.name for f in files if f.is_file() and f.name.split(".")[0] in it } ############

"it" will not be available and the rest of the code will not be executed(204-....): ############ for sid, symbol in enumerate(it): logger.debug(f"{symbol}: sid {sid}") fname = fnames.get(symbol, None) ############

Build using my latest PR it will work

stefan-jansen commented 1 year ago

Closed by #168