Back

Python local examples/documentation?

Hi,

what is the procedure for running python example algorithms locally? I was able to run python in the cloud very easily but the source distribution readme still refers to IronPython. Do I change the language in the config.json to Python and then give the python module name as the algorithm name in config.json? I have used Python.net a lot from within python but I see that you are using nPython.exe, which frightens me since it hints that maybe you are calling python from inside your c# code instead of the other way around? 

Update Backtest








We are a little behind on documentation and examples. The readme will be updated shortly.
In order to run algorithm written in Python locally, we need to edit the config.json:

"algorithm-type-name": "BasicTemplateAlgorithm",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/BasicTemplateAlgorithm.py",

Actually we only use nPython.exe to compile the python scripts for error checking.

The engine calls python from inside the C# engine and the other way around.
Like C# algorithms, the python module has a class that inherits from QCAlgorithm. After we import the module in C#, we create an instance of that python class and make it "act like" an instance of QCAlgorithm. That way, the object is modified by both python and C# which, being the engine, is also responsible for sending events to handlers that may be overridden in python. 

 

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.


Update Backtest





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.


Loading...

This discussion is closed