I found a similar question but no answer; only that the author had found his answer.
So, how do I find the LEAN Python Methods List: Descriptions, etc.
??
Thank you!
QUANTCONNECT COMMUNITY
I found a similar question but no answer; only that the author had found his answer.
So, how do I find the LEAN Python Methods List: Descriptions, etc.
??
Thank you!
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.
Mia Alissi
QuantConnect's LEAN engine is primarily written in C#, and its Python functionality is achieved through a C# to Python interoperation layer. This means that the Python version of LEAN accesses the C# methods. Therefore, the Python methods in LEAN are essentially the same as the C# methods.
You can find the LEAN class documentation here. Although this documentation is for C#, you should be able to access all of the C# methods in LEAN using Python.
For Python-specific information, you can refer to the Python and LEAN section in the QuantConnect documentation. This section explains how Python interacts with the LEAN engine and provides some examples.
Additionally, you can check out the tutorials provided by QuantConnect. These tutorials cover the QuantConnect API in both C# and Python.
Lastly, you can also refer to the LEAN API documentation for a comprehensive list of all methods and properties.
Please note that Python in LEAN is not exactly the same as standard Python due to the interoperation with C#. For example, named parameters are not supported when your Python code calls C#/.NET code inside LEAN. However, named parameters are not ignored when Python code calls other Python code since then, the entire execution happens in the Python runtime.
Here is an example of how to use the
History
method in Python:In this example,
qb.History
is a method call to the LEAN engine. The returned object is aMemoizingEnumerable
which is a raw C# type accessible in Python. You can directly enumerate this object with standard Pythonfor
loops, or to convert it to a native type, wrap the object in thelist()
.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.
Fred Marshall
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!