I'm trying to create a function to exit all positions held on the day before the stock's next earnings report is released. It looks like I should be able to use the data provided from EventVestor. The built-in BusinessDaysUntilNextEarnings pipeline factor will be equal to 1 when this is the case.
Can you use this factor outside of a pipeline?
- If so, how could I get this factor for the current stocks held. Say this is in a list called "context.current_stocks".
- If not, is there another way to do this? I've looked into adding these factors as output from my pipeline, but apparently you cannot incorporate your current positions in your pipeline (see post).
Thanks!