QM027 Hands-on Lab: Cross-Sectional Ranking and Hold Buffers

QM027 · Hands-on Lab

Objective

Compare pure Top-3 selection with an Entry-3 / Hold-5 rule as two assets repeatedly cross the entry boundary.

Python

rank_history = [
    {"A":1,"B":2,"C":3,"D":4,"E":5},
    {"A":1,"B":2,"C":4,"D":3,"E":5},
    {"A":1,"B":2,"C":3,"D":4,"E":5},
]

def buffered(ranks, previous, k=3, hold=5):
    incumbents = sorted([x for x in previous if ranks[x] <= hold], key=ranks.get)
    selected = incumbents[:k]
    for x in sorted(ranks, key=ranks.get):
        if len(selected) == k: break
        if x not in selected: selected.append(x)
    return selected

prev = []
for t, ranks in enumerate(rank_history, 1):
    topk = sorted(ranks, key=ranks.get)[:3]
    buf = buffered(ranks, prev)
    print(t, "TopK", topk, "Buffered", buf)
    prev = buf

Audit questions

  1. Why can the buffered portfolio differ from the current Top-3 even with identical current ranks?
  2. Which rule produces more boundary turnover in this example?
  3. Does lower turnover prove higher expected return?
  4. What extra historical state is required to reconstruct a hold-buffer portfolio exactly?

Interpretation boundary

The ranks are synthetic. The exercise demonstrates selection path dependence and turnover buffering; it does not imply that Top-\(K\) or a particular hold buffer is optimal for expected return.

Return to the article

Back to QM027