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/

    Earnings date Data

    Indicators/Strategies/Analyzers
    3
    3
    738
    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.
    • R
      Rstrong last edited by

      I am trying to filter my trades around earnings dates but am having some trouble conceptualizing what the actual way to do so would be.

      My idea is to only do trades the day a company is reporting and the day after the fact. My issue is im not sure where or how I would import those dates for each ticker I am working on. Would this be a separate datafeed I have to add or just a module to import that scrapes the data from internet sites?

      Assuming I figure out how to get a list of the earnings dates for the stock currently going through next, would it be as simple as saying:

       if self.date(0) is in earnings[]:
          (some logic)
      

      Any help would really be appreciated. I saw this post related to this but since im rather new to backtrader it was a bit confusing to me link text

      Also if anyone knows of a site where I can pull accurate earnings dates from, a link to that would also be appreciated.

      B 1 Reply Last reply Reply Quote 0
      • T
        Traderone3 last edited by

        Find a website that has all the dates for earnings that you want. After that, use BeautifulSoup to select the dates you want and put them into your code.

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

          @rstrong said in Earnings date Data:

           if self.date(0) is in earnings[]:
              (some logic)
          

          If you can load the earnings' dates into that array, that would work.

          Creating a data feed would be optimal in a case in which you don't know in advance when you will have access to the earnings' date. The data feed would for example await such date listening on a socket and would deliver something (for example the actual earning) on that date, giving you a cue.

          But for backtesting it seems far better to load things into an array and make the logic test.

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