What Matters: A ranking does not specify a portfolio. DN’s invented scores order four assets perfectly in six periods, yet a top-two rule loses 68 basis points after its stated turnover costs. The example isolates the conversion from scores to holdings. It does not establish a forecasting edge, reproduce Qlib’s engine, or estimate any market’s executable returns.
Evidence: This 2027 edition uses source files checked on 28 November 2026 and an original Python replay executed on that date. Every asset, score, return and cost in the demonstration is hypothetical. Inputs, configuration, calculation and results are retained with the experiment.
The missing step between a good score and a good result
A model can place the best subsequent performer above the worst without explaining how much to hold, when to rebalance, which current positions to retain or how to pay for the changes. Those choices determine exposure and trading activity. A ranking metric describes one property of the prediction. A portfolio result describes a decision policy applied to that prediction under a particular accounting and execution model.
Imagine two research notes presenting the same scores. One holds the highest-ranked asset, another holds the top two equally, and a third holds the whole universe. Their prediction inputs agree, but their concentration and turnover differ. Comparing their final results as if only model quality had changed would miss the main intervention: the portfolio rule.
Qlib makes these responsibilities visible in its pinned LightGBM example. It specifies data segments, a predictive model, a TopkDropoutStrategy, a benchmark and exchange-cost assumptions. DN uses that separation as a research question. The small worksheet below is independently authored and does not reproduce that configured strategy.
A deliberately generous ranking
We created four asset labels, A through D, and six numbered periods. The supplied score ordering exactly matches each period’s subsequently supplied return ordering. That agreement is built into the fixture. It is not a claim that a model could know the ordering before the period began. We made the prediction input unusually favorable so that the portfolio conversion could be examined clearly.
The top-two rule assigns one-half of reference notional to each selected asset. The winning pair alternates between A/B and C/D. Gross period results are the average of the two supplied returns. Returns are expressed in basis points: one basis point is one-hundredth of one percent.
| Period | Selected pair | Gross bp | Traded reference notional | Cost bp | Net bp |
|---|---|---|---|---|---|
| 1 | A, B | 8 | 1 | 10 | −2 |
| 2 | C, D | 6 | 2 | 20 | −14 |
| 3 | A, B | 7 | 2 | 20 | −13 |
| 4 | C, D | 9 | 2 | 20 | −11 |
| 5 | A, B | 5 | 2 | 20 | −15 |
| 6 | C, D | 7 | 2 | 20 | −13 |
| Total | Six decisions | 42 | 11 | 110 | −68 |
Where the 110 basis points come from
The initial purchase moves from cash to two half-weight positions, so total purchased notional equals one reference portfolio. Each later switch sells one portfolio and buys another. Our traded-notional convention counts both sides, producing two reference portfolios per switch. One initial purchase plus five complete switches gives eleven multiples of reference notional.
We charge an invented ten basis points per unit of traded notional. Eleven times ten is 110 basis points. Subtracting that from the 42-basis-point gross sum gives −68. There is no separate hidden commission added afterward. The ten-basis-point assumption is a single cost input, not a quote from an exchange and not a prediction of slippage.
The convention matters. A report that calls half the absolute weight change “one-way turnover” would display a different turnover number. Multiplying that number by a cost calibrated to two-sided traded volume would misstate costs. Preserve the definition alongside the value; a field named turnover alone is insufficient for reproduction.
The accounting is intentionally narrow
All period arithmetic uses a fixed reference notional. We add basis-point contributions rather than compound account equity. The next rebalance compares target weights without carrying forward weight drift caused by different asset returns. We include initial purchases and exclude final liquidation. These simplifications make the calculation hand-checkable, but they also limit what the output means.
A full account simulation would track shares or contracts, cash, prices, fees, changing equity and the trades needed to reach the next target. Minimum order sizes, unavailable instruments and partial fills could prevent exact targets. Adding those mechanisms would answer a larger question. The present result establishes the behavior of the disclosed arithmetic, not the outcome of such a larger simulator.
Changing the holding rule changes the answer
Keeping all four assets equally produces 14 gross basis points in this fixture. Because the target set never changes, the simplified model records only the initial one-unit purchase. At the same ten-basis-point cost, its net sum is four basis points. It captures less gross return than the top-two rule but pays much less modeled cost.
This comparison does not prove broad diversification always beats a concentrated ranking strategy. We authored one tiny alternating example. It demonstrates that a ranking and a holding rule can favor different objectives. The chosen assets, their returns and the cost convention jointly create the result.
| Scenario | Gross bp | Cost bp | Net bp | Interpretation |
|---|---|---|---|---|
| Top two, ten-bp cost | 42 | 110 | −68 | Baseline fictional policy |
| Top two, zero cost | 42 | 0 | 42 | Cost arithmetic boundary |
| All four, ten-bp cost | 14 | 10 | 4 | Different selection policy |
Retention rules deserve their own experiment
A policy that retains some existing positions can reduce trading, but it may also keep lower-ranked assets. The useful comparison holds the prediction file, decision times and accounting rules fixed while changing only the retention policy. Report both the gross result forgone and the cost avoided. Reporting only the turnover reduction would leave half the decision unexamined.
Qlib’s example names a dropout parameter within its strategy configuration. That is a reason to inspect the actual configured strategy before claiming a replication. Our worksheet selects the top K afresh each period and has no dropout parameter. Giving it the same project label would not make its rebalance semantics equivalent.
Use the worksheet as a conversion audit
Rows contain a numbered period, an asset identifier, a score and a subsequent return in basis points. The worksheet sorts by score within each period, selects K assets and assigns equal target weights. Asset names break score ties consistently. Duplicate asset-period rows and periods with fewer than K assets are rejected because they make the requested holdings ambiguous.
Begin with the authored rows and confirm the totals. Set cost to zero to separate gross selection from the cost assumption. Set K to four to inspect concentration and trading changes. If you replace the rows, preserve their actual chronology outside the worksheet: it cannot verify that scores existed before the outcomes or that the same universe was available at each decision.
What should accompany a real ranking file?
| Question | Record to preserve | Consequence if absent |
|---|---|---|
| When was the score available? | Forecast timestamp and information cutoff | Prediction timing remains unverified |
| Which assets were eligible? | Dated universe and exclusions | Selection bias cannot be assessed |
| How were positions changed? | Target rule and execution timing | The score cannot be replayed into holdings |
| What did trading cost? | Cost convention and sensitivity range | Gross results cannot support a net claim |
| What remained invested? | Cash, weights and terminal treatment | Different account definitions may be compared |
A break-even cost is a sensitivity, not an execution quote
The top-two fixture’s gross sum divided by its traded-notional total is 42/11, approximately 3.818 basis points per traded unit. At that constant cost, the fixed-reference net sum reaches zero. This threshold is useful because it connects the apparent gross advantage directly to the trading activity required to obtain it. It is still calculated from authored inputs and is not an estimate of what a venue would charge.
A single cost number also hides variation across decisions. A difficult rebalance may coincide with the largest price move or the least available liquidity. Real evaluation should preserve the relationship between timing, size and cost where evidence permits it. Applying the same optimistic average to every trade can miss that dependence. For this worksheet, vary the constant transparently and label the resulting values as sensitivities. Do not describe the break-even input as an available execution route, a guaranteed fee tier or a recommendation to trade.
Methodology and practical limits
DN executed an original standard-library Python replay and independently checked the browser calculation against the 42, 11, 110 and −68 totals. Boundary checks cover zero cost and the full four-asset universe. Invalid-input checks cover blank K, negative costs and duplicate observations. These checks support implementation consistency for the specified cases.
No Qlib installation, trained model, live feed or broker was used. There is no estimated statistical uncertainty because the example is a constructed arithmetic demonstration, not a sample from a defined market population. Its practical next step is a documented ranking-to-holdings receipt in the Trading Tool Lab, with source timing and decisions retained in the Research Desk.
Download the dated source and scenario record (JSON) · Download the reproducible calculation pack (ZIP).
Frequently asked questions
Does the perfect ranking come from a trained model?
No. The scores and later returns were deliberately authored in the same order. The example grants a favorable ranking to isolate holdings and cost arithmetic. It provides no evidence of forecast skill.
Why count a full switch as two units of traded notional?
The convention counts sales and purchases. Selling one reference portfolio and buying another produces two units. A one-way turnover convention is also possible, but its associated cost calibration must be stated consistently.
Can I interpret −68 basis points as a real account return?
No. It is a fixed-reference sum with no compounding, weight drift, terminal liquidation or executable-order constraints. A real account simulation needs those additional rules and appropriately timed observations.
Primary sources and evidence
- Qlib example workflow. Separate data segments, model, strategy and transaction-cost configuration Checked 2026-11-28.
- Qlib project. Scope of the quantitative-research framework Checked 2026-11-28.
Editorial disclosure: This research explains documented capabilities and original worked examples. Inclusion does not imply endorsement, a commercial relationship or verified trading performance. No placement in this article was purchased.
Corrections and updates: Send source-backed corrections to press@decentralised.news. This 2027 edition was checked on 28 November 2026; documentation, permissions and product availability can change.




