Try this and see if it helps you see what's going on
#long_short_screen = (longs | shorts)
long_short_screen = ~fsf_value.percentile_between(10, 90, mask=universe) # just some lows & highs, ~ means not
With that change, there is output on 8/9.
Then toggle use_the_mask_that_works
on line 87 off and on. Partial diff below...
In this first section, notice there are no longs or shorts. That means with the original long_short_screen
, the dataframe is empty of course.
use_the_mask_that_works OFF
2011-08-09 07:00 log_data:327 INFO Rows: 6587 Columns: 8
min mean max
combined_factor nan nan nan NaNs 6587/6587
ebt_ltm -2800180000.0 443824822.892 35156900000.0 NaNs 3886/6587
ebt_win -121594000.0 339883491.163 11939300000.0 NaNs 3886/6587
fsf -252.072043633 inf inf NaNs 3962/6587
longs False 0.0 False
qf -5274280000.0 7049287416.09 822583000000.0 NaNs 3212/6587
qf_win -2280840.0 4940088680.93 167153000000.0 NaNs 3212/6587
shorts False 0.0 False
2011-08-09 07:00 log_data:342 INFO _ _ _ combined_factor _ _ _
... combined_factor highs
combined_factor ebt_ltm ebt_win fsf \
Equity(21 [AAME]) NaN NaN NaN NaN
Equity(25 [ARNC_PR]) NaN NaN NaN NaN
Equity(31 [ABAX]) NaN 19721000.0 19721000.0 0.034702
Equity(37 [ABCW]) NaN NaN NaN NaN
Notice the difference in fsf here ...
use_the_mask_that_works ON
2011-08-09 07:00 log_data:327 INFO Rows: 6587 Columns: 8
min mean max
combined_factor -5.80677784964 0.119662267913 20.4170142151 NaNs 6249/6587
ebt_ltm -2800180000.0 448632896.568 35156900000.0 NaNs 3886/6587
ebt_win -145421000.0 550752342.018 12728000000.0 NaNs 6245/6587
fsf -0.396482834994 0.0768264835087 1.69785455888 NaNs 6249/6587
longs False 0.0256565963261 True
qf -5274280000.0 7083996590.61 822583000000.0 NaNs 3212/6587
qf_win 338625000.0 11157241586.6 196765000000.0 NaNs 6079/6587
shorts False 0.0256565963261 True
2011-08-09 07:00 log_data:342 INFO _ _ _ combined_factor _ _ _
... combined_factor highs
combined_factor ebt_ltm ebt_win fsf \
Equity(33807 [IBKR]) 20.417014 574936000.0 574936000.0 1.697855
Equity(36243 [AGNC]) 18.013224 509928000.0 509928000.0 1.505878
Equity(6330 [RAD]) 7.835089 234671000.0 234671000.0 0.693011
Equity(32627 [GTU]) 4.957366 156846000.0 156846000.0 0.463185
Part of it is that without the mask, winsorize is operating on all 8000+ stocks.
Also, with this, down to 540 stocks instead of the 6587 above. I thought this would not be necessary.
screen = universe & long_short_screen
Not an end result answer, just hopefully some info and a test that can help.