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
In these two episodes we develop an optimiser class using the CVXPY optimisation package, implement it into our trading bot and then evaluate the backtest with some extra charts.
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.
DaveGilbert
367
,
Well done! Thanks.
0
DaveGilbert
367
,
Have you tried using skylight? Do you know how to synch pycharm with quantconnect cloud? How?
0
Derek Melchin
STAFF
,
Hi Dave,
Syncing local QC project files with our cloud servers using Skylight is straightforward. Watch our latest YouTube video for a quick demonstration. For more information on Skylight, checkout our recent blog post about it: A New Era For Desktop Algorithmic Trading.
Best, Derek Melchin
1
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.
Mohamed Arshath
153
,
Thanks for this wonderful series, Ollie. I am trying to understand certain things
In the SelectFine method, the secrities list from the main algo gets set to the selected universe and the method also returns the universe. does the returned universe have any function?
def SelectFine(self, fine):
universe = self.FilterFactor(self.FilterFinancials(fine))
# self.algorithm.Log(f"Universe consists of {len(universe)} securities")
self.algorithm.securities = universe
return [f.Symbol for f in universe]
0
Rahul Chowdhury
39.9k
,
Hey Mohamed,
The return universe is the set of securities whose data we are subscribed to. The data for those securities can be accessed in the AlphaModel within the Update method.
class MyAlpha(AlphaModel):
def Update(self, algorithm, data):
insights = []
for symbol in data.Keys:
# create insights
return insights
The algorithm Ollie created doesn't use this feature, however, a set of symbols, a empty array or Universe.Unchanged must be returned during universe selection, otherwise the algorithm will throw an error.Learn more in the documentation on Universe Selection and Alpha Creation.
Best Rahul
1
Mohamed Arshath
153
,
Thanks Rahul! Appreciate it!
0
Jason Benner
156
,
Hey Ollie,
I just cloned this and ran a backtest and for some reason in Nov 2008 I am getting it drop down to 0 dollars....its taking a big short in something I think. Anyway not sure if I am doing something wrong, I dont think I changed anything when I cloned your code above. Does this happen to you now?
0
Derek Melchin
STAFF
,
Hi Jason,
I was able to backtest the strategy over November 2008 without experiencing the same issue. See the attached backtest for reference. I'd recommend cloning the original code files again to fix the issue.
Best, Derek Melchin
1
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.
Petter Hansson
10.5k
,
Is QC using the actual bid ask spread now or is that still on the TODO-list?
Since I thought I should contribute the way you did: Be wary about such small wins and losses. I got Sharpe 31 out of sample (June) but what I immediately pay attention to is an average loss of 0.02%, and I would expect the spread to be wider than that except maybe in the largest cap stocks at best of times.
Interesting code sample nonetheless.
1
Shile Wen
63.5k
,
Hi Petter,
Bid-Ask spread data (aka L1 data) is available for backtests, but it is not yet ready for Live Trading.
Best, Shile Wen
0
Dung Le
334
,
Hi Ollie,
Thanks for the great series.
I noticed that you defined a new class vs extended existing class when it comes to the Algorithm framework. For example:
class ValueAlphaModel():
vs.
class NullAlphaModel(AlphaModel):
Are there any specific reasons why you chose the first but not the second? I am also surprised that the Algorithm object can pick up your newly created model. Could you shed some light here? Thanks!
Leo
0
Derek Melchin
STAFF
,
Hi Dung Le,
Ollie's implementation does not implement the Algorithm Framework. We can see that because it doesn't use SetAlpha, SetPortfolioConstruction, etc... it only borrows the terminology.
The algorithm object is able to pick up the models used in the backtest even though they are not subclassing the built-in framework models because they are all called on in the RebalancePortfolio method in main.py.
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.
Dung Le
334
,
Thanks for the detailed explanation, Derek. That makes perfect sense.
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!