Ref:
I cloned the algorithm given by the staff member. What i see is, if the rebalancing is set to 4 weeks, the first security is purchased after 4 weeks. If it is set for 2 weeks, the first security is purchased after 2 weeks only. I am a little confused on what does rebalancing exactly do? Ideally I would assume that when the algo receives an insight, it should trade, but only rebalance the portfolio as per the our rebalancing setting. What am i missing?
Shile Wen
Hi Rakesh,
I was unable to reproduce the issue. Please attach a backtest that reproduces the issue.
Best,
Shile Wen
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.
Rakesh Gopal
Thanks for your reply. The code is just a clone of your code. I have just modified the delta to 2 weeks and 4 weeks. I have attached 2 backtests as repro.
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.
Rakesh Gopal
Attached the backtest of your cloned code (Only change is delta is set to 2 weeks and 4 weeks)
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.
Lucas Silva
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.
Aaron Todd
I feel like a lot of people are perhaps missing the point. They aren't "creating" a new Python API. The Lean implementation is accessed via IronPython's dotnet integration http://ironpython.net/documentation/dotnet/
More than likely what they are proposing is some wrapper API that hides this detail. Of course Python developers, of which I count myself, are going to want the proposed API but it doesn't change the fact underneath your code is calling C# code.
If I was writing something unrelated to QC that integrates with .NET framework classes (e.g a winforms app) I wouldn't expect the imports/API to differ and in fact they don't.
I appreciate that the QC team is trying to make this more accessible and familiar to Python developers but I just don't see enough benefit in maintaining some wrapper API (even if it can be auto-generated) just because the style differs.
QC team feel free to correct me if I've made an incorrect assumption somewhere.
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.
AMP 2
Aaron, from an engineering standpoint you're probably right. But what you seem to be missing is that adoption by the Python community is a MASSIVE benefit. Not a technical benefit, but a social one (look at Quantopian for instance).
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.
Alexandre Catarino
Aaron is correct. It will be a auto-generated wrapper.
I do not want to believe that python coders are not coming to QuantConnect because of its API. We do have benefits over other platforms that should be more important than style.
Nonetheless, we want to provide this API to make people "feel at home".
The point of this thread is: "Do they care and/or want it?".
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.
Jared Broad
@Aaron you're right, technically that is the implementation. Like other decisions we make regarding the LEAN stack though we try to make the right decision regardless of difficulty which is why we started this wrapper project. From your detailed analysis though it looks like there are no good ways to support Numpy/Panda - either fix IronPython or create a raw python api using ZMQ messaging to talk to LEAN. Personally I like how IPy compiled dll's run lightening fast so lean towards that solution.
Ultimately we want LEAN-Python to support all the built in libraries; so regardless of the API we have some thinking to do. The best course now is probably to spend more time seeing if IronPython can support Pandas/Numpy/SciPy - then continue the wrapper project.
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.
Aaron Todd
developer I understand and appreciate the tradeoffs they are making though.
@Alexandre, absolutely that is partially my point, the style makes little
difference, the capabilities are more important.
@Jared Yes, I can appreciate that, I don't mean to derail the conversation
either since the point of this thread was to simply take a vote, so
apologies. I was just trying to make sure everyone understood why the
current API looks the way it does and it wasn't a choice between creating
it one way or another necessarily. To your point maybe that isn't their
concern and if offering a Python API is possible and people want it then by
all means. And yes I would agree figuring out the numpy/pandas/scipy
integration is perhaps more important to people but that's a whole
different problem.
Anyway to hopefully put the thread back on track my vote is to keep it the
way it is ala C#.
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.
Lucas Silva
Then on placing order the method MarketOnOpenOrder was not really clear to me. Maybe a name improvement. Is it placing an order as Market?
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.
Alexandre Catarino
Hi Lucas,
In the new style, MarketOnOpenOrder would be called market_on_open_order. The style wouldn't make it clearer for you, right?
The name logic is the following: order is the substantive and market on open is the adjective. It is a market on open, since it will be executed when the exchange opens at the market price of the security. I think it would be too wordy to call it MarketOnExchangeOpenOrder.
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.
Jared Broad
Thank you all for the feedback. Lets call the discussion paused for now until we can resolve a way of getting the science/math libraries to talk to C#!
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!