Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Computing the difference between consequent values of a fundamental indicator?

I'm trying to compute the difference between consequent values of a fundamental indicator, normalized_diluted_eps_earnings_reports, using a sample CustomFactor but it always returns 0. The same CustomFactor works great on closing price. What am I doing wrong?

4 responses

Nothing, this is because the accounting data change every quarter (For quartely reporting companies), using a window length of 2 days in this kind of Custom Factor returns 0 because you're using the same number.
You should have a look at this post:
https://www.quantopian.com/posts/how-to-get-prior-morningstar-value-custom-factor

Mathieu,

Thank you. I am aware of the quarterly nature of the fundamental data. Shouldn't I get something other than 0 once a quarter? I was hoping to use it to find the exact days when the fundamental variables of interest are updated. I tried BusinessDaysSincePreviousEvent for this purpose but had some issues with it. The notebook I attached to my initial post captures a fundamental data update, yet again my factor returns 0 on the update day instead of -0.055465 and I can't understand why.

@Andrey I

The way your custom factor computes 'delta', while it seems correct, will never return anything but 0. This stems from the way fundamentals are tracked and updated in the Quantopian database.

Here's an example using data from the attached notebook.

The data is from Facebook (FB) Fundamentals.normalized_diluted_eps_earnings_reports with a pipeline run from 2015-01-29 thru 2015-02-03.

pipeline date 01/29/15  
01/28/15   eps 0.303328 as of 09/30/14  
01/27/15   eps 0.303328 as of 09/30/14

pipeline date 01/30/15  
01/29/15   eps 0.303328 as of 09/30/14  
01/28/15   eps 0.303328 as of 09/30/14

pipeline date 02/02/15  
01/30/15   eps 0.247863 as of 12/31/14  
01/29/15   eps 0.247863 as of 12/31/14

pipeline date 02/03/15  
02/02/15   eps 0.247863 as of 12/31/14  
01/30/15   eps 0.247863 as of 12/31/14  

First, it looks like FB had quarterly earnings reports dated 09/30/14 and 12/31/14. Since the data changes after 01/30/2015 it appears the 12/31/14 earnings were reported after that day (typically after market close).

When the pipeline is run on Friday 01/30/2015 it fetches data for the previous two days ( Wednesday and Thursday 1/29 and 1/28). The latest eps data for those days, as far as the market knows at the beginning of the day 01/30/2015, is .303328 from 09/30/14. Then earnings are reported. Now, the market knows differently. At the beginning of the day 02/02/2015, the latest earnings per share for those days is 0.247863 as of 12/31/14.

On 02/02/2015 all the eps data after 12/31/2014 is updated to reflect this new information. All the eps data changes from 0.303328 to 0.247863. Notice too that the as_of dates all change from 09/30/14 to 12/31/14.

This is why the simple delta factor always returns 0. On 01/30/2015 the delta is 0 (0.303328 -0.303328 ). On 02/02/15 the delta is 0 (0.247863 - 0.247863).

Take a look at the attached notebook. I added a few cells at the bottom for logging. Also take a look at this post for more info on this same issue https://www.quantopian.com/posts/change-in-fundamental-data-in-research.

Hope that helps.

Dan,

Thank you for the great explanation! It makes total sense.