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 failing test #214

Closed ta-oliver closed 3 years ago

ta-oliver commented 3 years ago

Minor changes, but vortex strategy is failing reconcilation:


[gw0] [100%] FAILED test_allocations.py::test_vortex_strategy 
tests/test_allocations.py:564 (test_vortex_strategy)
def test_vortex_strategy():
        df_with_signals = vortex_indicator(df, window=25)
        df_with_allocations = allocations.ROC_strategy(df, 25, max_investment)

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

        df_with_signals.loc[bearish, "allocation"] = -max_investment
        df_with_signals.loc[bullish, "allocation"] = max_investment

>       assert pd.Series.equals(df_with_allocations["allocation"], df_with_signals["allocation"])
E       AssertionError: assert False
E        +  where False = <function NDFrame.equals at 0x7f372d78a680>(0      0.2\n1      0.2\n2      0.2\n3      0.2\n4      0.2\n      ... \n995   -0.2\n996   -0.2\n997   -0.2\n998   -0.2\n999   -0.2\nName: allocation, Length: 1000, dtype: float64, 0     NaN\n1     NaN\n2     NaN\n3     NaN\n4     NaN\n       ..\n995   NaN\n996   NaN\n997   NaN\n998   NaN\n999   NaN\nName: allocation, Length: 1000, dtype: float64)
E        +    where <function NDFrame.equals at 0x7f372d78a680> = <class 'pandas.core.series.Series'>.equals
E        +      where <class 'pandas.core.series.Series'> = pd.Series

test_allocations.py:575: AssertionError