Back to Community
Problem with the earnings calendar (EventVestor)

Hi,

It seems that the premium version of the earning calendar provided by EventVestor starts from 2009-07-10 whereas the free version starts way before from 2007-01-01. It would be very good to have the 2007-2009 period in the premium version. Can it be due to a bug in this dataset? Could you fix it on your side?

By the earning calendar, I am referring to the pipleline factors (BusinessDaysUntilNextEarnings, BusinessDaysSincePreviousEarnings) in:
https://www.quantopian.com/data/eventvestor/earnings_calendar

Thanks,
-- Arash

15 responses

Hi Arash,

I can't seem to replicate the issue you're experiencing.

Does the issue occur when you're attempting to run something like this:

from quantopian.pipeline.data.eventvestor import EarningsCalendar  
from quantopian.pipeline.factors.eventvestor import (  
    BusinessDaysUntilNextEarnings,  
    BusinessDaysSincePreviousEarnings  
)

def initialize(context):  
    pass  

For that same time period?

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hi Seong,

Thanks for responding to my question and sorry that I am replying slowly. I didn't get any error with your script. But, I changed it slightly and attached the BusinessDaysSincePreviousEarnings factor to a pipeline.

from quantopian.pipeline import Pipeline  
from quantopian.algorithm import attach_pipeline, pipeline_output  
from quantopian.pipeline.data.eventvestor import EarningsCalendar  
from quantopian.pipeline.factors.eventvestor import (  
    BusinessDaysUntilNextEarnings,  
    BusinessDaysSincePreviousEarnings  
)

def initialize(context):  
    schedule_function(get_stocks, date_rules.every_day(),  
                      time_rules.market_open(hours=1.0))  
    # Create and attach an empty Pipeline.  
    pipe = Pipeline()  
    pipe = attach_pipeline(pipe, name='pipeline')  
    # Construct Factors.  
    previous_earning = BusinessDaysSincePreviousEarnings()  
    recent_earning_report = (previous_earning < 4)  
    # Remove rows for which the Filter returns False.  
    pipe.set_screen(recent_earning_report)

def get_stocks(context, data):  
    results = pipeline_output('pipeline')  

Now, if I run this code for 01/01/2008 to 01/01/2015, I get the following error:

NoDataAvailable: Backtest began on 2008-01-01 and ended on 2015-01-01, but some of the requested datasets do not have data for this time. The datasets are: eventvestor.earnings_calendar: start=2009-07-10, end=2016-07-22. Your backtest must begin on or after: 2009-07-10 and end on or before: 2016-07-22.

Please let me know if you can reproduce my error or not.

I really appreciate your help,
-- Arash

I am having the same issue and was referred to this thread, but there is no solution on this thread either. I really wish someone on the team would take a look at this sooner rather than later. Here is my thread if it helps.

Earnings Calendar Bug

Hello Quantopian,

Was there any progress with this problem? It's been more than a month since this issue was reported.

Thanks,
-- Arash

Hi Arash,

We've been looking into the issue and have implemented a possible solution. Do you mind giving it a shot and posting back to this thread if you experience the same problem?

Hi Seong,

It is fixed now. I can now include the time periods that were missing previously when I switched to the premium version.

Thanks a lot,
-- Arash

Hi Seong,

I'd like to report a serious bug with the earning calendar dataset. I'm noticing that this dataset has dramatically different behavior depending on the start date of the backtests. In other words the factor BusinessDaysSincePreviousEarnings() returns totally different values depending on when I am starting my backtest.

Below I created a small test case to reproduce the bug:

from quantopian.pipeline import Pipeline  
from quantopian.algorithm import attach_pipeline, pipeline_output  
from quantopian.pipeline.data.eventvestor import EarningsCalendar  
from quantopian.pipeline.factors.eventvestor import (  
    BusinessDaysUntilNextEarnings,  
    BusinessDaysSincePreviousEarnings  
)

def initialize(context):  
    schedule_function(get_stocks, date_rules.every_day(),  
                      time_rules.market_open(hours=1.0))  
    pipe = Pipeline()  
    pipe = attach_pipeline(pipe, name='pipeline')  
    previous_earning = BusinessDaysSincePreviousEarnings()  
    recent_earning_report = (previous_earning < 1)  
    pipe.set_screen(recent_earning_report)

def get_stocks(context, data):  
    results = pipeline_output('pipeline')  
    print results.index.map(lambda x:x.symbol)  

Now if you test this code for the last two weeks and if you vary the start date in your backtest, you will notice that a different set of stocks have previous_earning < 1.

For example for the period Sept 26-Oct 07, 2016, it will output:

2016-09-26 07:30 PRINT []
2016-09-27 07:30 PRINT []
2016-09-28 07:30 PRINT [u'WOR']
2016-09-29 07:30 PRINT []
2016-09-30 07:30 PRINT []
2016-10-03 07:30 PRINT [u'CGA']
2016-10-04 07:30 PRINT []
2016-10-05 07:30 PRINT []
2016-10-06 07:30 PRINT [u'PKE']
2016-10-07 07:30 PRINT []

But, for Sept 30-Oct 07, 2016 it will output:
2016-09-30 07:30 PRINT []
2016-10-03 07:30 PRINT [u'CGA']
2016-10-04 07:30 PRINT []
2016-10-05 07:30 PRINT [u'AZZ' u'RELL' u'MON']
2016-10-06 07:30 PRINT [u'CMTL' u'PKE' u'EMMS' u'MG']
2016-10-07 07:30 PRINT [u'STRP']

As you can see all of sudden some stocks show up with previous_earning < 1 for the last three days of the back test.

The bug I am reporting here is not specific to these particular dates. I have seen the same behavior for many different backtest intervals. The general trend that I am observing is that usually the output of the factor BusinessDaysSincePreviousEarnings() is unreliable for the first couple of weeks of backtests.

Regards,
-- Arash

Arash, thank you for bringing this to our attention.

A solution to the issue has been implemented and you should no longer be seeing this issue. Do you mind giving it another shot and letting me know if you experience the same problem?

Hi Seong,

Yes, I believe the problem is fixed now. My backtests are consistent and the above algorithm is also working properly.

I appreciate your support!
-- Arash

I am observing another anomaly with this dataset these days. There were several times in the past few weeks that I noticed that some stocks in this dataset had their BusinessDaysSincePreviousEarnings wrong. I understand that this dataset is probably collected using crowd-sourcing and there are always chances of mistakes. But, the frequency of mistakes has changed so dramatically these days that I am starting to believe that there might be a systematic problem in this dataset. I have been working with this dataset for a year now and I never noticed this much mistakes.

For example, today (Feb 09) for the following stocks BusinessDaysSincePreviousEarnings was assigned to zero whereas they released their reports yesterday and BusinessDaysSincePreviousEarnings should have been 1:

NSIT, ZEN, CRAY, FTK, PAYC, BLKB, ALNY, TTMI, PPC, IMPV, PCMI.

Note that neither I have cherry-picked these stocks nor I have checked all the stocks reported today. I found these stocks almost by chance. That's why it's indicating a bigger problem in this dataset.

Here is the code that you can run to test it. Run the backtest for two days from Feb 08 to Feb 09:

from quantopian.pipeline import Pipeline  
from quantopian.algorithm import attach_pipeline, pipeline_output  
from quantopian.pipeline.data.eventvestor import EarningsCalendar  
from quantopian.pipeline.factors.eventvestor import (  
    BusinessDaysUntilNextEarnings,  
    BusinessDaysSincePreviousEarnings  
)

def initialize(context):  
    schedule_function(get_stocks, date_rules.every_day(),  
                      time_rules.market_open(hours=1.0))  
    # Create and attach an empty Pipeline.  
    pipe = Pipeline()  
    pipe = attach_pipeline(pipe, name='pipeline')  
    # Construct Factors.  
    previous_earning = BusinessDaysSincePreviousEarnings()  
    recent_earning_report = (previous_earning < 1)  
    pipe.add(previous_earning, 'pe')  
    # Remove rows for which the Filter returns False.  
    pipe.set_screen(recent_earning_report)

def get_stocks(context, data):  
    results = pipeline_output('pipeline')  
    print results['pe'][symbols('NSIT', 'ZEN', 'CRAY', 'FTK', 'PAYC', 'BLKB', 'ALNY', 'TTMI', 'PPC', 'IMPV', 'PCMI')]  

And here are the mistakes I see today (Feb 10). Similar to my previous comment the following stocks reported yesterday but today their BusinessDaysSincePreviousEarnings is zero (instead of one):

QUOT, CTRL, CPSI, COLM, WEB, ATEN, HDP, RPD, SXT, CUB, NWS, NWSA, NCR.

Hi Arash,

This behavior is actually as designed. The BusinessDaysUntilNextEarnings and BusinessDaysSincePreviousEarnings are computed with the calendar_time in mind. If an earnings call happens after market close on day N, it is considered to have occurred on business day N+1 since day N+1 is the first day that the algo has to react to the event. If an event happens before market open, an algorithm can react to the event on the same calendar day. Announcements made before market open on calendar day N are considered to occur on business day N.

Does this help?

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hi Jamie,

Thanks for the quick reply. This totally makes sense.

Can you confirm that it was always like this, and, the logic of the dataset has not changed? In the past, I remember seeing some stocks that were going to report after market close, but the dataset was saying that they had reported on day N (instead of N+1). I want to make sure that my backtests are consistent.

-- Arash

Arash,

There was actually a change in the factor definitions a month ago that added consideration of the calendar_time. Prior to the change, a report on calendar day N was always considered to be a report on business day N+1. I'm realizing now that we should have announced the change. I apologize for the lack of communication.

Jamie,

The definition of the factor has indeed changed. Prior to the change, business days and calendar days were aligned but now there is one-day offset between them for the after-market reports.

The main problem is that now our backtests are giving totally different numbers. Our algorithms are not optimized for this factor at all, and, to be honest, I think because of that I have been losing money since the beginning of the year.

I believe a better practice would be to keep the factor consistent in order to have backward compatibility between ongoing live algorithms and their backtests. It would be much better if a new argument/flag/factor is introduced such that users could select their desired behavior.

Please note that such changes with no warnings or announcements are very dangerous as they have a major impact on our live algorithms.

-- Arash