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/

    btalib.rsi doesn't work with default index

    bta-lib
    2
    3
    65
    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.
    • H
      hoopoe last edited by

      why btalib.rsi doesn't work with the default pandas dataframe indexing

      lst = [1864.90, 1867.24, 1863.73, 1841.16, 1772.16]
      df = pd.DataFrame(lst, columns=['Close'])
      rsi = btalib.rsi(df.Close, period=2).df
      print(rsi)
      

      TypeError: 'slice(2, None, None)' is an invalid key

      run-out 1 Reply Last reply Reply Quote 0
      • run-out
        run-out @hoopoe last edited by

        @hoopoe
        Yes, that's true, btalib does not work with a non-date index. You need a datetime index. It's designed to work with timeseries data.

        As to why? You'll need to take that up with @backtrader , but seems obvious enough to me.

        H 1 Reply Last reply Reply Quote 0
        • H
          hoopoe @run-out last edited by

          @run-out thanks for your reply. Actually I'm using bta-lib on a data stream so I'm reindexing the dataframe on each incoming message, so any ideas for a better solution ?

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }