Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Help with trading earnings from external file

Hi. I’m trying to construct the following algo:
- open position in n days after the earnings report, given that the stock gapped down at opening after the announcement.
- hold stock for m days and close.

Earnings dates, as well as n and m are taken from external file (n and m are given by the columns ‘entry’ and ‘holding period’ respectively).

It seems that the open signal is correct. However, for stocks CMA, CTSH positions are opened on 2002-10-17 instead of 2002-10-16. My first idea is that there is not enough cash for it. Am I right and is there a way to ensure that there is enough cash reserved for all the positions?