Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Is diluted_average_shares an average over the last quarter or the last year?

I'm trying to decide if I need to manually average this value over the last year or if it's already an annualized average.

5 responses

The values for 'diluted_average_shares' are the weighted average for the previous quarter (from what I have experienced). These are the values used by the company to compute the quarterly 'per share' data on the associated 8-K Edgar filing.

Attached is a notebook which illustrated this. The notebook gets the 'diluted_average_shares' for AAPL and IBM as of 2/27/2016. By adding fields for both "form" and 'filed date' one can find the Edgar report where the data comes from. Looking at these two Edgar reports, one can see the numbers match the 'three months ended' values and NOT the 'twelve months ended' values.

Here are links to the Edgar reports for comparison:
https://www.sec.gov/Archives/edgar/data/51143/000110465916090410/a16-1789_18k.htm
http://files.shareholder.com/downloads/AAPL/3442397081x0xS1193125-16-438421/320193/filing.pdf

Not sure if the data strictly adheres to this for all securities but it matches what I've seen whenever I've checked.

Thanks!

So, based on that answer, this is how I get my EPS for the last 12 months:

class TTMDilutedEPS(CustomFactor):  
    inputs = [morningstar.income_statement.net_income_common_stockholders,  
              morningstar.earnings_report.diluted_average_shares]  
    window_length = 252

    def compute(self, today, assets, out, ni, das):  
        out[:] = (  
            (ni[-1] + ni[-63] + ni[-126] + ni[-189]) /  
            ((das[-1] + das[-63] + das[-126] + das[-189]) / 4.0))  

Is there a better way?

The biggest problem with using the shares data provided by Morningstar is that it's not split adjusted. This is one reason why it's not available for live trading yet. If there were a 2:1 split in the past year, for example, then your custom factor would be off.

It's not exactly diluted earnings per share but the basic earnings per share could probably-reasonably-maybe be found like this:

class TTM_EPS(CustomFactor):  
    inputs = [morningstar.earnings_report.basic_eps]  
    window_length = 252

    def compute(self, today, assets, out, eps):  
        out[:] = eps[-1] + eps[-63] + eps[-126] + eps[-189]

This won't pick up any earnings revisions and it may miss an earnings report if the company filed late but it should be close.

It's frustrating how how it is to do something like this on quantopian. Something as simple as: what is the median operating margin over the last 8 quarters is really hard to implement as a factor. And yet, I can easy get this information from something like gurufocus or google finance.

I agree Rudiger, I wish the docs/tutorials were more explicit about the time periods the data is held for. I can't even seem to find a decent way to debug into it to look at the data myself aside from print statements. Unfortunately, this issue has only worsened since Pipeline came into play.

Another nice feature to have would be for some kind of repository for common functions like this that are community contributed/maintained- there is no real reason everyone should have to figure out how to properly reimplement TTM_EPS, especially when its kind of obscure. I am trying to take another stab at Q after taking a first look 3 years ago, and the api's and docs actually feel more obscure now.

I will quit my whining now :).