Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Testing Earnings Date triggers with Fetcher

Hi Everyone,

I'm having trouble marrying the earnings date data from my csv with my stock data. I've set up a test algorithm that buys a stock 4 days before earnings and sells the day after earnings (it's not something i'd actually use).

The problem I'm having is that when looping through each stock, the earnings data isn't matching up with each stock. Instead, each stock is using the last known earnings data that gets pulled in.

Any suggestions on how to fix? (Also, does anyone have suggestions on how I can have the code read just the earnings date from the csv and then calculate the 4 days before and 1 day after? I manually entered the extra dates in the csv.)

Thanks for any help!

4 responses

Hi JP Checa,

Could you clarify what you mean by The problem I'm having is that when looping through each stock, the earnings data isn't matching up with each stock. Instead, each stock is using the last known earnings data that gets pulled in?

It'd be helpful if you could show what you're getting versus what you expect to get.

Alternatively, you can use Eventvestor's earning calendar dataset through our builtin Pipeline API (shown in the attached algo). You can head to the page to activate the free sample version.

The sample version will allow you to backtest from 01 Jan 2007 - 03 Feb 2014. The full dataset will give you complete access for $5/month.

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.

Thanks for the reply. To clarify my issue, each stock is using the same earnings date rather than their own specific date. I'm not sure how I can get them to use their own individual earnings date using my csv file.

Hi JP,

Looks like you were always setting context.earningst to the last available earnings date as well as using symbol= versus symbol_column= in Fetcher.

I'd add the same context.ordered logic as the algorithm I posted above (which buys 4 days before an earnings and sells 1 day afterwards) to correctly order securities but the issue you were having should be fixed with this version.

Ah ok. Awesome. Thanks so much!