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
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.
Varad Kabade
31.1k Pro
,
Hi Cool nemo,
When using ScheduledUniverseSelectionModel the algorithm does not receive the Fine Fundamental data, so self.Securities[symbol].Fundamentals is a None type object. To resolve this, we need to use Coarse+Fine Universe Selection instead. Best, Varad Kabade
0
Cool nemo
208 Pro
,
@Varad kabade,thank u for u reply
Is that sure we can't get Fundamentals outside `Coarse+Fine Universe Selection` ?
0
Edited by Cool Nemo
Varad Kabade
31.1k Pro
,
Hi Cool nemo, Yes, We can only get Fundamental data when we use fine Universe selection. Refer to the following thread for more information about using Fundamental data outside fine Universe selection, Best, Varad Kabade
0
Big mak
1.2k Pro
,
Cool nemo,
If you need to access fundamentals outside of the Fine Filter, you may want to save the fine fundamental object for the stocks you are interested in. Once you save it, you can access it later. Here's an example where you can access new fundamental data in a custom function (MainFunction) using self.stocks (which is a list of FineFundamental objects).
0
Varad Kabade
31.1k Pro
,
Hi Big mak, Thank you for your response. An alternative way is to use the Fundamentals property of the security object. With this, we don't have to store all the fundamentals objects explicitly. Refer to the attached code snippet. Â
Securities[symbol].Fundamentals.MarketCap
Best, Varad Kabade
0
Big mak
1.2k Pro
,
Thanks Varad. Any idea how to do that for all stocks in the securities list, and preferably in one line? Kind of like the way I had it in my attached code.
0
Louis Szeto
STAFF Pro
,
Hi Big mak
Since the return of Varad's code snippet is a float, you may set up a panda Series/dataframe to store the data, but they cannot be appended by a single line as pandas data structures' limitation. There is no additional benefit on putting them all into a single either. Please refer to the attached backtest as an example.
Best, Louis Szeto
0
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.
Big mak
1.2k Pro
,
Is there any advantage to doing it the way you and Varad are suggesting with self.Securities? I just tested it; it's twice as slow and arguably less readable with the for loop vs list comprehension. Is there something I'm missing?
0
Louis Szeto
STAFF Pro
,
Hi Big mak
Both ways shall work fine, but using a new list will induce extra memory usage. The speed of a list iteration and a for-loop should be similar.
Best Louis Szeto
0
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.
Big mak
1.2k Pro
,
Thanks Louis, that answers my question.Â
A list like this is quite small in memory, so unless the original poster or any future viewer is extremely strapped on memory, the 2x speed improvement from accessing a finefundamental object vs Self.Securities is likely a good tradeoff. I would imagine that this speed difference comes from accessing a finefundamental object vs using self.Securities.
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!