For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
How to add new column that is string type to datafeed?
-
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] = valueTypeError: must be real number, not str
Anyone has good idea? thanks.