trophy

Long Only, ETF Alpha Streams Competition with $27,500 Prize Pool

Back

Discrepancy between DailyFx in Python and C#

Hello everyone,  Need help with DailyFx Calendar.

@Jared Broad; @Alexandre Catarino

I am trying to build an algo using forex calendar as a signal. I started with the implementation of @JayJayD. But i do not know if i wrongly translated his code to Python but i noticed some discrepancy in the data when trying to implement DailyFx in Python.

In order to understand the origine of the differences, i wrote those two little algo which logs each time the signal is meet (date, symbol, signal count, calendar meaning, STD) for both algo. I noticed the following

1- While Having the same intruction, we get more signals from the C# algo than the one written in python (Please see algo and logs) 44 signals in python and +200 signals with C# . So my question if the following, Does the API from python and C# return the same data? does the python dailyFx API lack data? or did i make a mistake trying to get the same information when trying to access the same info from python?

2- Calendar Meaning; we get "worse" or "better" in C# and  "1" or "2" in python. Once again is it a mistake from me or the data has different structure using whether Python or C#?

3-STD : I also noticed that that STD in C# round to 5 figures while python does not. This is Why i rounded it in python to make sure that STD in both languages return the same values, and this seems to be ok.

4- Finally would you please help me with decimal translation? does 50m; 0.7m; 0.02m could be respectively translated in python to decimal.Decimal(50); decimal.Decimal(0.7); decimal.Decimal(0.02).

 

NB: C# algo is the one i am trying to translate in Python so it should be considered as the original code.

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.


Here is the C# code.

0


Hi  Moussa BAMBA this turned out to be a rather complicated issue. Because python does not support function overloads by the arguments we can only have OnData(Slice) vs in C# we have OnData(DailyFx). The C# DailyFX overload passes in all the events which occur on the same timestep, where the python version is truncating the data to 1 point and only sending the last one.

We're going to continue looking into this to find a solution which works. Generally speaking, I wouldn't recommend daily fx in live trading as it does not accurately report its times. The real times are often 1-2 minutes past the reported event time, which makes the backtesting unrealistic. 

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.


Thank you Jared Broad for your time.

I have been really struggling to find a potential error in ly Python Code.

As you do not recommend Daily Fx for live trading (Live trading being the goal at the end of the day) ; Is there any other tool which could could allow us to reach the same goal?

Could we accurately use any other forex calendar? (If not we will have to drop a lot of Alpha idea and strategy we could built around this)

0

0

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