Back

Differences between C# and Python or in Data

Hi,

I am trying to port the example strategy : Momentum Effect in Country Equity Indexes, written in Python to C#. The results appear to be quite different. Upon closer examination of the ranking table at any rebalance point, there appears to be a discrepancy between momentum ranks in C# and Python (produced by MOM indicator). I've attached the python and C# versions here. Looking at the Debug Console:

62114_1569623165.jpg

Why is there a difference?

I am attaching the Python and C# codes below.

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.


...And the Python varsion...

0


Hi Ivan,

We are sorry that there is an error with Python version code. The self.symbols list under the def Initialize(self) function lack comma between "EIDO" and "EWI", "NORW" and "EWY". These two pairs are served as a whole respectively, this is why "EWY" cannot be recognized and doesn't appear in the result. It will work and the results will be the same between C# and Python after adding comma.

Thanks!

1

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