Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Writer's block! Looking to collaborate

So I have this idea about determining if a stock is under accumulation/distribution.

I have a strong SQL background but still learning python here and I'm stuck. I have two essential pieces of what I need - whether the SPY was up or down by date (using get_pricing) for the last X number of days, and whether all stocks in my universe were up or down in the last X number of days by date (using pipeline). The problem I'm running into is comparing the two - in SQL I'd store them off in a table variable and JOIN them and potentially use CASE statements and various aggregate and ranking functions to get 'er done.

I suspect that what I'm trying to is possible but I'm going about it all wrong. Any help the community could provide would be appreciated!

Details of what I'm trying to do are in the header of the notebook.

2 responses

One other thing you will need to consider with a strategy like this is earnings releases, public announcements and SEC filings. These often have a big impact on stock prices - and may steer the stock price regardless of what the market is doing.

@Mohammad - I agree with you 100%. I'd definitely want to add some guardrails in for these types of events.