This code accompanies the the paper Trading with the Momentum Transformer: An Intelligent and Interpretable Architecture (https://arxiv.org/pdf/2112.08534.pdf).
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.
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"
),
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](https://github.com/kieranjwood/trading-momentum-transformer/assets/113409741/1b39fd8c-c125-4526-822b-ef79206df105)
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",
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()