Please accept my apologies for the frequent messages. I am writing to you regarding a doubt that has arisen after analyzing your code.
While reviewing your code, I observed that you have used StandardScaler on both features and the return target variable in the function set_scalers(self, df)
. This approach is perfectly acceptable. However, I have concerns regarding the calculation of captured returns in the custom loss function defined in SharpeLoss
class inside deep_momentum_network file.
Specifically, the function call(self, y_true, weights)
uses scaled returns in the first argument. The captured returns are then calculated using this scaled return and the position size, captured_returns = weights * y_true
. This results in a return that is not accurate since it is based on scaled returns rather than actual returns.
Furthermore, there is no provision to unscale the returns or position in the code as the only function that does that is format_predictions(self, predictions)
, which does never get called.