ta-oliver / infertrade

Open source trading and investment strategy library designed for accessibility and compatibility
Apache License 2.0
34 stars 20 forks source link

Vortex Strategy test is failing and needs investigation #229

Closed ta-oliver closed 3 years ago

bi-kash commented 3 years ago

@ta-oliver Tests are failing randomly. Randomness is due to dependency on randomly seeded simulated test data. Yeah we got to investigate it. We need to save the data_frame that causes test fails.

ta-oliver commented 3 years ago

We can fix the random seeds and run 5 times? That will give same result each time but check a variety of scenarios.

bi-kash commented 3 years ago

We can fix the random seeds and run them 5 times? That will give the same result each time but check a variety of scenarios.

The probability of these tests failing is around 0.1 i.e. once in about 10 tests. or maybe even less. So not sure if those running 5 times will catch the bug that produces it. It's again a chance.

ta-oliver commented 3 years ago

Can do more than 5 as long as test are fast.

What makes certain outcomes fail?

NikolaR01 commented 3 years ago

In my case: The "signal" column is filled with NaN values after "vortex_indicator" is called, the NaN value is coming from "trn"

trn = true_range.rolling(window).sum()

And when we try and compare the "signal" column to determine bearish and bullish movements we are comparing a NaN value to a number

bullish = df_with_signals["signal"] >= 0 bearish = df_with_signals["signal"] < 0

This results in different values in the "allocation" columns

bi-kash commented 3 years ago

Thanks, @NikolaR01.

ta-oliver commented 3 years ago

Looks good. Thanks @bi-kash and @NikolaR01 .