Dynamically extending the dataframe
I am currently extending the data feeds using PandasData feeds and have multiple data feeds going into cerebro.
class PandasData(bt.feeds.PandasData): lines = ('abc','xyz') params = ( ('abc', 'abc'), ('xyz','xyz'), )
for df in datas: data=PandasData(dataname=df) cerebro.adddata(data, name='example')
and using these lines in init function as:
for i, d in enumerate(self.datas): self.inds[d] = dict() self.inds[d]['abc'] = d.abc self.inds[d]['xyz'] = d.xyz
Now, what if I don't know the name of extra columns 'abc' and 'xyz' that the pandas dataframe would have and would like to extend the dataframe for those data feeds dynamically.
I saw this topic, what I don't understand here is that they already know these 'optix_close', 'optix_pess', 'optix_opt' column names. How is this programatically extending datafeed?
Thanks in advance
run-out last edited by
@btr I just asked where your misunderstanding was in the other topic. Thanks for clarifying.
In the other topic the OP knew the optix lines. In your case, you would simlply add in the column names of your dataframe.