Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
First algorithm

Hi.
I'm new to quantopian and I'm trying to write my first algorithm.
What I want to do is:-
- use the Q500US stocks.
- each day, 5 mins before close - grab the current price, yesterday's close price as well as the close price from 5, 10 and 30 days ago.
- apply a simple filter e.g. only keep the stocks whose current price is above the 1, 5, 10 and 30 day close prices.
- Of the stocks selected, keep the top 10 by market capitalisation.
- rebalance the portfolio to hold these 10 stocks in equal proportion.

Any help would be greatly appreciated.