LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
I'm brand new to the platform. Looking for advice on 2 questions.
1. Lets say at 10am, how would I find the top 50 stocks (in SP500 or QC500) by percentage gain since previous close? And then for example go long those stocks. Is this possible in quantconnect?
2. Let's say my strategy involves doing the above, but I want to keep track of the top 10 stocks that performed best doing this strategy for the last 5 days. So that on day 6 I can add these to my signal, whats the best way to do this?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Rahul Chowdhury
39.9k
,
Hey Allan,
We can use QC500UniverseSelectionModel to add the QC500 stocks into our universe.
Whenever we add a new stock, we make a history call for the first previous close data point. After that, we will update the previous close for that stock with a scheduled event that stores the close value at market close.
Then another scheduled event, Rebalance, that fires everyday 30 minutes after market open will pick out the top 50 stocks with the largest gains.
Everyday at market close in our scheduled event, we liquidate all our shares and repeat the process the next morning.
Every friday, another scheduled event determines our top performers for that week. We accomplish this by keeping track of the returns for each symbol. We store the returns of each trade every day before market close in a dictionary keyed by symbol.
Check out the comments in backtest for more details.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Loading...
To unlock posting to the community forums please complete at least 30% of Boot Camp. You can
continue your Boot Camp training progress from the terminal. We
hope to see you in the community soon!