Can I use about 6000 stocks from NYSE and NASDAQ stocks in my algo and use a screening function once per month or once per two weeks ?
The algo will reset/erase the list and then append a maximum of 200 stocks with the desired criteria to context.stocks = [] list.
The thing is that I can't use my function within before_trading_start(context) because I need to use the stock price data to sort the stocks:
def before_trading_start(context):
sort_stocks(context,data)
Runtime exception: NameError: global name 'data' is not defined
or
InvalidBeforeTradingStartMethod: 0070 before_trading_start(context, data) accepts too many arguments
So, I will use: