kieranjwood / trading-momentum-transformer

This code accompanies the the paper Trading with the Momentum Transformer: An Intelligent and Interpretable Architecture (https://arxiv.org/pdf/2112.08534.pdf).
https://kieranjwood.github.io/publication/momentum-transformer/
MIT License
432 stars 188 forks source link

Result diff between my validation and paper #17

Open danbo6 opened 4 months ago

danbo6 commented 4 months ago

Hi, Thank you very much for your great work! But I tried to run the code with everything unchanged, but the result is quite different. image

The code I used to plot the result, btw I didn't include the cpu module in the features: data_list = [ pd.read_csv( os.path.join( _get_directory_name(experiment_name, interval), "captured_returns_sw.csv" ),

typ="series",

        )
        for interval in train_intervals
    ]

df = pd.concat(data_list) pnls = df.groupby("time")["captured_returns"].sum() cumulative_returns = (1 + pnls).cumprod() - 1

plt.figure(figsize=(10, 6)) cumulative_returns.plot() plt.title('Cumulative Returns Over Time') plt.xlabel('Date') plt.ylabel('Cumulative Returns') plt.grid(True) plt.show()