Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Calculating Custom Factor ebitda

The EBITDA(TTM) value in the fundamental database seems to be quarterly.
AAPL EBITDA = 17.167B(17,167,000,000)
in quantopian/morningstar

While EBITDA for AAPL according to
yahoo finance = 77.88 B
gurufocus = 79.642 B

I am not able to confirm the calculated value with any published TTM EBITDA value
I thought I would calculate it using Custom Factor() below
Calculated TTM EBITDA=63.286B

What am I doing wrong?
How do you calculate Trailing TTM EBITDA value accurately?
out[:] = ebitda[-1]+ebitda[-94]+ebitda[-187]+ebitda[-280]
I am accounting for each quarter as being 93 days(assuming worstcase month length of 31)
I suspect this could still be wrong if the earnings publication dates are different each quarter, but should be ball park accurate?

Also if I am to calculate Shiller PE I might need trailing 10 year earnings, does it mean I will need window_length=10*365 ?

# Create custom factor to calculate a market cap based on yesterday's close  
# We'll use this to get the top 2000 stocks by market cap  
class EBITDA(CustomFactor):  
    # Pre-declare inputs and window_length  
    inputs = [income_statement.ebitda]  
    window_length = 365  
    # Compute market cap value  
    def compute(self, today, assets, out, ebitda):  
        out[:] = ebitda[-1]+ebitda[-94]+ebitda[-187]+ebitda[-280]

Any suggestions?
Sarvi

3 responses

quantopian and gurufoccus has the same data source... morningstar... they should techniclly... have the same results...

The following seems to work. Looks like I was looking at the window_length and indexes wrong.
I was using 365 days while annual trading days are only 252 days.
So a quarter is approximately 63 days

class EBITDA(CustomFactor):  
    # Pre-declare inputs and window_length  
    inputs = [income_statement.ebitda]  
    window_length = 200  
    # Compute market cap value  
    def compute(self, today, assets, out, ebitda):  
        out[:] = ebitda[-1]+ebitda[-64]+ebitda[-127]+ebitda[-190]  
#        out[:] = ebitda[-60]

I always go to sec.gov for verification. It was the only place with financials my business professors would accept for assignments, etc. Here's the link to AAPL's 10-Q with the previous three quarters: https://www.sec.gov/Archives/edgar/data/320193/000119312515259935/d927922d10q.htm#tx927922_2