In an attempt to replicate the functionality of the now-defunct EventVestor factors BusinessDaysUntilNextEarnings and BusinessDaysSincePreviousEarnings, I've scrapped earnings data for 2020 from the Yahoo! Earnings Calendar, put it into a CSV file (the complete CSV file can be found here), and imported it into Quantopian's self-serve data setup. From the pipeline, the following fields can be accessed:
Date, Estimate, Actual, Surprise
I then use the factors BusinessDaysUntilNextEvent and BusinessDaysSincePreviousEvent with my data to get the days until the next earnings release and the days since the last earnings release:
next_earnings = BusinessDaysUntilNextEvent(inputs = [earnings_data_2020.date])
prev_earnings = BusinessDaysSincePreviousEvent(inputs = [earnings_data_2020.date])
The BusinessDaysSincePreviousEvent factor gives the correct number of days since the last earnings release, but the BusinessDaysUntilNextEvent factor just gives the negative of the value returned by BusinessDaysSincePreviousEvent, e.g. if BusinessDaysSincePreviousEvent returns 7 for a security, BusinessDaysUntilNextEvent returns -7.
How can I get the correct functionality from BusinessDaysUntilNextEvent?