XGBoost Stock Ranking and a Five-Day Portfolio Rebalancing Example
Summary
This document presents a Chinese-stock ranking workflow built around an XGBoost RankNet model. It constructs price-return and trading-activity features, labels stocks using clipped forward returns divided into quantile bins, and separates training data from later prediction data. The trading example selects five high-ranked stocks, assigns larger weights to higher-ranked names, caps each position at 20% of portfolio value, and uses a five-day holding period. It also describes gradually allocating available cash and replacing weaker holdings after the initial build-up period.
The post's central issue is that the workflow reportedly runs in AIstudio and backtests successfully but fails in simulated trading with a string-formatting TypeError. It provides code and the error, but no diagnosis or fix, and it gives no performance results. The example is platform-specific; the excerpt does not establish whether the failure comes from the model, data handling, or trading engine, so the allocation logic should not be taken as a validated live-trading strategy.
Key ideas
- The example trains an XGBoost RankNet model to rank Chinese stocks using price and activity features.
- Forward returns are clipped and grouped into quantile labels for model training.
- The portfolio buys five top-ranked stocks with rank-weighted allocations and a per-stock capital cap.
- The example uses a five-trading-day holding period and later sells holdings that rank relatively poorly.
- The reported simulated-trading TypeError is not diagnosed or resolved in the document.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.