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

Why do we need 'scaled_position' when calculate 'calc_net_returns'. #15

Open danbo6 opened 4 months ago

danbo6 commented 4 months ago

Hi,

As title, I saw you use the 'scaled_position' to calculate trading cost by calling diff on 'scaled_position'. I thought the output of the model is already a scaled position, since your label is a scaled return. Also don't you should call shift(1) https://github.com/kieranjwood/trading-momentum-transformer/blob/master/mom_trans/classical_strategies.py#L70 here when you calculate 'annualised_vol ', since you do the same here https://github.com/kieranjwood/trading-momentum-transformer/blob/master/mom_trans/classical_strategies.py#L137.