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/

    extending bt.feeds.PandasData

    Indicators/Strategies/Analyzers
    2
    4
    145
    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.
    • B
      bobaleaux last edited by

      I surrender!
      I am reading the data from pd.read_sql and all is well and i can run a "generic" strategy
      BUT
      no matter how many different ways i've tried, I can't figure out how to include the "int1", "int2", etc. columns so that i can call them like ohlc values into the strategy.

      what and where do i put it?
      please?

      1 Reply Last reply Reply Quote 0
      • toinou222
        toinou222 last edited by

        Hello,

        Here is how I do that :

        1 Reply Last reply Reply Quote 0
        • toinou222
          toinou222 last edited by

          class custom_data_loader(btfeeds.PandasData):
              lines = ("signal","prediction",)
              params = (("signal", -1),("prediction", -1))
              datafields = btfeeds.PandasData.datafields + (["prediction", "signal",])
          

          Basically, I use regular PandasData.datafields and add the columns I want

          Hope it helps

          B 1 Reply Last reply Reply Quote 1
          • B
            bobaleaux @toinou222 last edited by

            @toinou222 said in extending bt.feeds.PandasData:

            class custom_data_loader(btfeeds.PandasData):
            lines = ("signal","prediction",)
            params = (("signal", -1),("prediction", -1))
            datafields = btfeeds.PandasData.datafields + (["prediction", "signal",])

            thanks, i'll try that out

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