Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Extend CSV feeder with string column

    General Discussion
    2
    2
    470
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mttax last edited by

      Hello,

      I'm using csv data with string column, such as:

      datetime | symbol | open | high | ....
      

      The symbol column is of str type, which cannot be converted to float.

      Core code in backtrader shows that it tries to convert all columns to float value.

      So is there an easy way to use string column in backtrader, or any advice on doing so?

      Thanks.

      B 1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators @mttax last edited by

        @mttax said in Extend CSV feeder with string column:

        So is there an easy way to use string column in backtrader, or any advice on doing so?

        No. This is not pandas. your best option is to load the data using pandas into a Dataframe and then using the current data index, fetch the string from the dataframe.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors