Hello all! I am new to all this so I apologize if this question seems rudimentary... but I am trying to utilize some sector momentum screen, to then overweight stocks in that particular sector. I am trying to do this in the research notebook first before moving to IDE, as I don't find the IDE as intuitive to code and test things in.
I've attached the notebook I am currently working from. I found something similar here: https://www.quantopian.com/posts/dynamic-asset-allocation and lines 32-58 of their code make sense to me when reading it. However I can't figure out how to do something similar in the research environment.
I've created kind of a hacky function (I blame my new-ness to programming) that I think does what I want. It takes many steps, but eventually gets out the sector codes of the top 3 sectors over the past month. There are 2 issues I currently see with this though, within the function in order to use the returns module, I need to input dates. So not sure if that's possible or how to execute that in the actual trading IDE. Also, I am unsure if I can call a function in a pipeline, if it's possible I can't seem to figure it out. I basically would like to call the function (or do something similar to what the best_sectors function does) within the pipeline, so that I am returned a list of stocks to long that have one of the top 3 sector codes.
Thanks to anyone who can help out!