You can see them by adding them to columns.
Try this: Set a breakpoint on line 57, run it, then type each of these one at a time followed by [enter]:
context.out
context.out.sort_values(by='pe_ratio', ascending=False).head()
context.out.sort_values(by='pe_ratio', ascending=False).tail()
I shortened column names for multiple reasons.
pe_ratio = Fundamentals.pe_ratio.latest
return Pipeline(
columns = {
'pe_ratio': pe_ratio,
'factrs' : testing_factors,
'BGC' : bottom_20_secs,
'TGC' : top_20_secs,
},
screen = securities_to_trade & ((pe_ratio > 10) | (pe_ratio < 30)))
This includes some code to log the top and bottom 3 also. I always use it.
if 'log_pipe_done' not in context: log_pipe(context, data)
def log_pipe(context, data):
log.info('pipe len {}'.format(len(context.out)))
log.info('.\n{}'.format(context.out.sort_values(by='pe_ratio', ascending=False).head(3)))
log.info('.\n{}'.format(context.out.sort_values(by='pe_ratio', ascending=False).tail(3)))
context.log_pipe_done = 1
Looks like this
2017-08-07 05:45 log_pipe:65 INFO pipe len 12
2017-08-07 05:45 log_pipe:66 INFO .
BGC TGC factrs pe_ratio
Equity(37849 [IPXL]) True False 131.0 29.166667
Equity(45503 [AAOI]) False True 2849.0 22.746479
Equity(4537 [LRCX]) False True 2783.0 19.090331
2017-08-07 05:45 log_pipe:67 INFO .
BGC TGC factrs pe_ratio
Equity(50595 [BIVV]) False True 2786.0 14.366372
Equity(49139 [FIT]) True False 100.0 13.644444
Equity(5121 [MU]) False True 2864.0 12.633484
End of logs.