Back to Community
Piotroski 9 using pipeline

So I am trying to get reacquainted with Q, my last stab at it was when Pipeline was just announced. To try it out, I decided to try to implement the Piotroski 9 strategy. After writing an implementation there are two wrinkles though- one is that I seem to get a lot more companies that pass the filter than sources like AAII say I should. How can I see if a screen at any given point has a certain stock/security in its list? I would like to see if this is some sort of data difference or much more likely some sort of bug in my implementation. At any given point in the code, I would like to be able to write something like screen_criteria.contains("some_symbol")

My second, and perhaps larger issue is- I decided to see how my potentially buggy screen would perform in an algorithm. I implemented this by scheduling the rebalance function to run monthly and run the pipeline. However, it takes about 90 seconds to run, and I am getting a
"TimeoutException: Too much time spent in handle_data and/or scheduled functions. 50 second limit exceeded." error when running this. I believe the long running time is necessary since Piotroski requires (as far as I understand it anyway) to compare the trailing twelve months performance on the year prior for several measures, so essentially requiring two years of data. Its not clear to me if by providing the mask it is actually reducing the amount of processing/data required the way I intend it to.

I am probably doing something very noobishly and there are far more efficient ways to do this- if you could take a look and let me know, I would be very thankful.

Loading notebook preview...
Notebook previews are currently unavailable.