Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. crackerlee
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    crackerlee

    @crackerlee

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    crackerlee Unfollow Follow

    Latest posts made by crackerlee

    • 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:
      b0052522-4bf9-4626-897a-39f593556554-image.png

      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.

      posted in General Code/Help
      C
      crackerlee