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/

    Implementing a stock screener/scanner

    General Discussion
    3
    6
    2442
    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.
    • X
      xord37 last edited by

      Hey,

      I'm trying to implement a stock screener which scans 100 stocks and signals if the stock is in an oversold zone (using RSI). But it feels a little bit heavy to do it with backtrader.

      So I'm wondering what's the best way to implement it?
      Is backtrader a good library for this use case?

      B 1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        Backtrader is the best library to do anything. :)

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        1 Reply Last reply Reply Quote 2
        • B
          backtrader administrators @xord37 last edited by

          @xord37 said in Implementing a stock screener/scanner:

          But it feels a little bit heavy to do it with backtrader.

          Python is heavy, but there is something easy you may consider:

          • If you are loading the entire history of the data feeds, you may switch to just loading the latest bars (as many as needed by the RSI, which will depend on the period you are using)

          To take into account weekends and bank holidays you may add some extra bars to the backwards calculation.

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

            If you check this post, you will see the code for a screener which loads only some bars (based on the expected period for a Simple Moving Average) to sort them out.

            • Blog - Stock Screening

            The source for the data feeds will of course play a role in how fast things execute

            • If you pull the data from a database, it will be fast, because the database will know where the starting date is and give you the data from that point onwards

            • If you use files, the code has to read the file from the beginning until it reaches the expected start date.

            X 1 Reply Last reply Reply Quote 1
            • X
              xord37 @backtrader last edited by

              @backtrader
              Thanks! This is just what I was searching for.

              One question, why use an Analyzer class instead of the Strategy class?
              Maybe there's something fundamental that I don't understand here..

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

                There is nothing special. Do it as you prefer.

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