Hi.
How can I see easily all methods of a variable without going over other people's codes? For instance, in this line:
[x for x in coarse if x.HasFundamentalData]
is there a way to know that the coarse (CoarseFilter argument) elements have the HasFundamentalData method?
Thanks!
Fred Painchaud
Hi Skuperst,
Hit CTRL + Space in the IDE after the . (dot). Be patient sometimes as it can take time. It won't work at other times.
The current web IDE is imperfect, enough so it should be updated soon, hopefully I am not jinxing it right now 😊, with a much better alternative, where CTRL + Space will work well all the time.
Also, keep this nearby:
https://lean-api-docs.netlify.app/index.html
This is your Holy Refman guiding you in the right direction - towards the light of completed backtests.
😊
Fred
Skuperst
Thanks Fred for the quick answer.
I am not sure how can it help for the line above, where x is a loop variable. At what moment I have to hit CTRL + Space in order to see the methods of x? HasFundamentalData among them.
S.
Fred Painchaud
Hi,
“After the dot”.
x.<CTRL + Space>
Ref :
Each time you enter a dot, auto-complete will pop up or you can also hit CTRL + Space. In all cases, it works better if you type slowly and if you wait. Even then, it can fail to work in some circumstances.
To use the linked API (which I called the Holy Refman above), you need to understand types and object-orientation. It is a cross-referenced catalog of every method and attribute of every class in every namespace in LEAN…
It is Christmas so we need to talk straight (and yes, re-start old family feuds 😊): the web IDE is not a proper IDE. It's getting changed… more on this later on. In a proper IDE (the reason why some develop their algorithms locally), you have easy access to all of that. But kick back, a proper IDE is coming up for the web.
Fred
Skuperst
Thanks Fred. For the reply nd the link.
I wish you Happy Christmas and (const x=0) feuds in your family in year n≥2022.
Probably I didn't explain well my issue. The slow typing and patience have nothing to do with it :)
Take for instance coarse, the CoarseFilter argument. It's a list. It's entries have certain methods. In [x for x in coarse] I can add the condition if x.HasFundamentalData because coarse[0] (and all other elements) has this method, HasFundamentalData. There is, however, no way to learn about this or any other method using CTRL + Space. Even if I type x=coarse[0] in one line and x. right below, the CTRL + Space option will give nothing, since it would require compilation. It works, for example, when I type self. and wait for the Buy option to appear: self is a reserved word, so the dot is “suggestive”. On the other hand, x. means nothing before the compilation.
Thank you.
Fred Painchaud
Hi Skuperst,
😊
I'll spare you from my comments on that last post. But for your own amazement on this Boxing Day, take any of your Python code that works and change “self” by a word of your choosing, say “hello”, in the code…
Like:
It will work perfectly.
“self” is not a reserved word in Python - it is just another variable which is named “self” by convention.
That being said, if CTRL + Space does not work for you, use the Holy Refman (API docs):
https://lean-api-docs.netlify.app/index.html
You'll find all methods for anything and whatever and everything…
Cheers,
Fred
Skuperst
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.
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!