Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Earnings Calendar Next Day

I am super novice and for last 3 days trying to write a code about getting the sid for firms about to make earnings announcement next trading day. Not sure how to do that. Wrote few lines, which is presented below:

# This section is only importable in the backtester  
from quantopian.algorithm import attach_pipeline, pipeline_output  
from datetime import date  
import odo  
import pandas as pd 

# General pipeline imports  
from quantopian.pipeline import Pipeline  
from quantopian.pipeline.factors import AverageDollarVolume

# Import the datasets available  
# For use in your algorithms  
# Using the full dataset in your pipeline algo  
from quantopian.pipeline.data.eventvestor import EarningsCalendar 

# To use built-in Pipeline factors for this dataset  
from quantopian.pipeline.factors.eventvestor import (  
BusinessDaysUntilNextEarnings,  
BusinessDaysSincePreviousEarnings  
)

def make_pipeline():  
    # Create our pipeline  
    pipe = Pipeline()  
    # Screen out penny stocks and low liquidity securities.  
    dollar_volume = AverageDollarVolume(window_length=20)  
    is_liquid = dollar_volume.rank(ascending=False) < 1000  
    # Create the mask that we will use for our percentile methods.  
    base_universe = (is_liquid)

    # Add pipeline factors  
    pipe.add(EarningsCalendar.previous_announcement.latest, 'previous_announcement')  
    pipe.add(EarningsCalendar.next_announcement.latest, 'next_announcement')  
    pipe.add(BusinessDaysSincePreviousEarnings(), "business_days_since")  
    pipe.add(BusinessDaysUntilNextEarnings(), "business_days_next")

    # Set our pipeline screens  
    pipe.set_screen(is_liquid)  
    return pipe

def initialize(context):  
    attach_pipeline(make_pipeline(), "pipeline")  
def before_trading_start(context, data):  
    print get_datetime('US/Pacific')  
    results = pipeline_output('pipeline')  
    bnext = results['business_days_next']  
    if bnext == 1:  
        tnext = bnext  
    print tnext