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



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



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


  • administrators

    @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.