Backtrader Community

    • 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/

    Got nan value when resampling my own lines in data

    General Discussion
    2
    8
    553
    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.
    • A
      Alicc last edited by

      Hi all,

      I met some problem when resampling my own datafeeds. Besides the default lines OHLC , vol and oi, I added some other lines into data such as PE and Volatility. when I resample it, it's ok for the OHLC, vol,and oi, but my own lines are all nan value. Is there any other params I need to set in the cerebro.resampledata(data, kwargs**)?

      A 1 Reply Last reply Reply Quote 0
      • A
        Alicc @Alicc last edited by

        @alicc BTW, what I need is just keep the last value of my own lines, Thanks

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

          The resampler doesn't know anything about your extra lines and that's why the values aren't carried forward.

          A 2 Replies Last reply Reply Quote 0
          • A
            Alicc @backtrader last edited by

            @backtrader is there any to do with it, e.g to keep the last value of the timeframe?

            1 Reply Last reply Reply Quote 0
            • A
              Alicc @backtrader last edited by Alicc

              @backtrader I fo the update func in_Bar class and I'm planing to rewrite the update func. But how can I get all lines of a GenericCSVData object, thanks!!!0_1562035109153_QQ截图20190702103755.png

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

                Why don't you consider putting the extra values in an indicator and work straightforward with them?

                A 2 Replies Last reply Reply Quote 0
                • A
                  Alicc @backtrader last edited by

                  @backtrader Because I have computed many statistics, I thought it cannot be uploaded to indicators; BTW can I just upload the statistic already calculated to indicators?

                  1 Reply Last reply Reply Quote 0
                  • A
                    Alicc @backtrader last edited by Alicc

                    @backtrader I think it's more convenient for me to put the lines into data, because what I am testing is option. I have several option hot contracts of current month and next month with different strikes from 2015-2019 in 1 minute freq. It's time consuming to compute greeks and iv every minute when testing, especially when I need to test different strategy parameters. And there are other statistics like strike price and put/call type. So I first compute all the statistics. Anyway, Can I directly put the statistics already computed into indicators. If not , how could I resample these statistic, just keep the last one . the followings are my lines, thanks 0_1562060663489_QQ截图20190702174403.png

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