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/

    Updating Data in 'Next' and passing dataframe out of 'next'

    General Code/Help
    2
    2
    460
    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.
    • C
      cwse last edited by

      Hi,

      How can I update backtester data during "Next"?
      For example - if a price hasn't changed in over a month, I want to 'mark' this stock from that point on a "blacklist" column... so I can filter it our of the back test and stock buying/holding it. There are also other criteria I would like to use to "blacklist" a stock.

      Also - once the strategy is complete, I would like to save a pandas dataframe of this data. How can I pass a dataframe out of "Next" so I can save to_csv?

      Thanks,
      CWSE

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

        @cwse said in Updating Data in 'Next' and passing dataframe out of 'next':

        How can I update backtester data during "Next"?

        If you mean how you can remove a data feed from the list of data feeds: you cannot.

        @cwse said in Updating Data in 'Next' and passing dataframe out of 'next':

        For example - if a price hasn't changed in over a month, I want to 'mark' this stock from that point on a "blacklist" column... so I can filter it our of the back test and stock buying/holding it. There are also other criteria I would like to use to "blacklist" a stock.

        Keep the index and ignore the corresponding data.

        @cwse said in Updating Data in 'Next' and passing dataframe out of 'next':

        Also - once the strategy is complete, I would like to save a pandas dataframe of this data. How can I pass a dataframe out of "Next" so I can save to_csv?

        Access the data after the backtesting and get as much data as needed with get. Docs - Platform Concepts

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