Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Manipulating the variable/factor for only one Morningstar sector

Hello,

I am naive at coding and have been developing a strategy with PEG ratio. The following code is ought to do the following:

1) Get the peg_ratio factor for all the stocks.
2) For the 308 Morningstar sector (which is communication services) I want to get the peg_ratio inverted (-peg_ratio).

This is a part of the processing that I am aiming to do, I am going to combine it with other factors to get an increased predictiveness with the IC mean and a steady mean return.

Thank you in advance, I hope I can progress towards a solid algorithm with your help. :)