I wanted to add an additional column to datafeed, the column provide corresponding
future contract code of one line, the data just like this:
I subclass bt.feeds.PandasData:
class PandasData_return(bt.feeds.PandasData):
lines = (''code',)
params = (('code', -1),)
datafields = bt.feeds.PandasData.datafields + (['code'])
but when I run strategy, I got an error below:
--> 222 self.array[self.idx + ago] = value
223 for binding in self.bindings:
224 binding[ago] = value
TypeError: must be real number, not str
Anyone has good idea? thanks.