machine-learning-for-trading icon indicating copy to clipboard operation
machine-learning-for-trading copied to clipboard

Chapter 08 :- 02_vestorized_backtest.ipynb

Open Quantuary opened this issue 3 years ago • 0 comments

Line 11

long_signals = ((predictions
                .where(predictions > 0)
                .rank(axis=1, ascending=False) > N_LONG)
                .astype(int))
short_signals = ((predictions
                  .where(predictions < 0)
                  .rank(axis=1) > N_SHORT)
                 .astype(int))
  • wouldn't we want to long stock in the Top 15 highest expected return? e.g. Rank 1 to 15 with the highest expected return rank first (descending order). Hence we need rank <= 15 ?
  • and short the lowest expected return stock from 1 to 15 again, due to lowest return rank first?

Quantuary avatar Sep 02 '22 18:09 Quantuary