I'm new to Quantopian and coding.
Is there a way to limit one's security_list to those stocks that are members of an index (such as the Dow Jones Industrial Average) or stocks contained in an ETF (such as XLF)?
For example, if I wanted to run a backtest for a "Dogs of the Dow" strategy (investing in the 10 highest dividend yields in the DJIA), the script would have to first determine that AAPL belonged to the DJIA only after Mar 2015 and that AT&T bounced into and out of the DJIA on such and such dates. Is there a way that I can lookup and filter DJIA membership as if it were an attribute that belonged to Apple, AT&T, and all other stocks? Attribute may not be the right word.
Similarly, if I wanted to backtest a "Dogs of the XLF" strategy, how would one write a script to determine if and when a given stock was included in that ETF? Any help would be much appreciated, thanks!
Incidentally, I don't care about the dividend yield aspect of this - that was just an illustration.