For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
what happen if 400csv files optstrat in one code?
-
(My english is poor. Sorry.)
My code below:
for datapath in file_list: .... strats = cerebro.optstrategy(FatherStrategy, output_log_path = None, \ buytime_log_path = LOG_PATH + 'buytime{}.log'.format(prefix), \ min5_multiplier=[3.5], min299_multiplier=4.5, ....) dataframe = pd.read_csv(datapath, parse_dates=True, index_col=0, ...) dataframe["Datetime"] = pd.to_datetime(dataframe["Datetime"]) data = bt.feeds.PandasData(dataname=dataframe, timeframe=bt.TimeFrame.Ticks) cerebro.adddata(data) cerebro.run()
When I excute my code, after 300csv files, error occured.
Error code below:
pandas... C memory error.
What would be problem here?
I think something related to optstrategy but I don't get it.Appreciate your help.
-
it looks like pandas error raised while reading csv files, not
bt
issue. Google it.Next time postvtge whole error message, which typically shows what line of the script causes the error.
-
I just noticed you are using tick data. Tick data can be huge and you might just be running out of memory. Try running in smaller batches, shorter dates (filter in pandas before loading to backtrader), or resample to a higher timeframe.