Improve errorhandling for json files which are not ticker data
This commit is contained in:
parent
a4906c477e
commit
a972b8768d
@ -69,7 +69,9 @@ def parse_old_backtest_data(ticker) -> DataFrame:
|
|||||||
.rename(columns=columns)
|
.rename(columns=columns)
|
||||||
if 'BV' in frame:
|
if 'BV' in frame:
|
||||||
frame.drop('BV', 1, inplace=True)
|
frame.drop('BV', 1, inplace=True)
|
||||||
|
if not 'date' in frame:
|
||||||
|
logger.warning("Date not in frame - probably not a Ticker file")
|
||||||
|
return None
|
||||||
frame.sort_values('date', inplace=True)
|
frame.sort_values('date', inplace=True)
|
||||||
return frame
|
return frame
|
||||||
|
|
||||||
@ -98,6 +100,7 @@ def convert_file(filename: str, filename_new: str):
|
|||||||
|
|
||||||
frame = parse_old_backtest_data(pairdata)
|
frame = parse_old_backtest_data(pairdata)
|
||||||
# Convert frame to new format
|
# Convert frame to new format
|
||||||
|
if frame is not None:
|
||||||
frame1 = convert_dataframe(frame)
|
frame1 = convert_dataframe(frame)
|
||||||
misc.file_dump_json(filename_new, frame1, is_zip)
|
misc.file_dump_json(filename_new, frame1, is_zip)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user