All,
Hoping for some help here since my Python skills are still a WIP. This is an algo that is generating trading signals shortly after market open. It looks at today's opening price relative to the previous two day's highs and lows. I'm using set_universe to scan through all stocks that have a high z-score to either short or long.
After diving deeper into why this isn't working, line 39 draws an All-NaN slice. My assumption was because lines 34 & 36 are separate dataframes. I tried concatenating into one dataframe and converting them to series, but this did not work.
The other piece of help that I'm looking for is a more efficient way to code the signals and turn them into long/short orders and to close all positions by market close. Lines 49-58 is how I'm currently generating the signals - not sure if there would be a better way. def PlaceOrder and def CloseOrder also feel inefficient to me and would love help here.