Asset panel, trend, momentum and the portfolio lab
Code:
pipeline/tipsheet/compute/assets.pytrend.py,momentum.pyportfolio_lab.py,aftertax.pypublish/models.py,publish/lab.py
Bundles: models/* and lab/*.
Rules and results: the rules are pre-registered, so results can’t be fitted after the fact:
docs/research/trend_momentum_spec.mddocs/research/portfolio_lab_spec.md
Each spec logs its results, including the null ones.
The asset panel
Daily growth-of-₹1 series for each asset class:
| Asset | Source | Notes |
|---|---|---|
| Equity | NSE total-return indices: Nifty 50, Next 50, 100, 500, Midcap 150, Smallcap 250 and others | Bad prints repaired (see indices.md) |
| Gold | World Gold Council INR price, from 2005 | The domestic price including import duty, which is what Indian gold ETFs track. Before 2005, it is ratio-linked to the USD price × USD/INR. The duty premium is 1–2% before 2012, 8–15% after the 2012–13 hikes and about 5% after the 2024 cut |
| G-sec | NSE 5-year benchmark G-sec index (total return), from 2001 | A 5-year bond, not a broad bond index |
| Cash | Accrues the 91-day T-bill yield, using only yields already published | 2012–2025 CAGR 6.66%, against 6.26% for NSE’s 1-day rate index |
Backtest rules common to all models
-
No look-ahead. Signals use the close of day t, and trades happen at the close of day t+1, so the position first earns the return from close t+1 to close t+2. Until 2026-10-03 the code traded at the signal’s own close; see the audit correction in
trend_momentum_spec.md. -
Monthly rules use completed month-ends only. A close early in a new month is not a month-end.
-
Calendar time: CAGR and running costs use calendar days; NSE has about 249 sessions a year, not 252. Volatility and Sharpe are annualised with √252 by convention.
-
Trading cost: 0.10% of value traded, each way.
-
Annual running costs while invested:
Equity Gold G-sec Cash 0.15% 0.50% 0.20% 0.20% -
Multiple testing: the deflated Sharpe ratio (Bailey and López de Prado, 2014), counting every trial honestly.
-
Periods reported: full sample, each half, and 2012 onward.
After-tax results (aftertax.py)
- Tax engine: since 2026-10-03, the lab’s (
lab/tax.py, rules in Appendix B ofportfolio_lab_v2_spec.md). - Lots: matched first in, first out. Each gain is classified by sale date and holding period:
- Equity: STCG at the slab, 10%, 15% and then 20%; LTCG at the lower of 10% plain and 20% indexed before October 2004, then exempt, then 10% and then 12.5%. January 2018 prices are grandfathered.
- Debt and liquid funds: indexation before April 2023; slab rate for units bought from April 2023 (section 50AA); 12.5% after 24 months for older units sold from 2024-07-23.
- Gold ETFs: section 50AA until 2025-04-01; 12.5% after 12 months.
- Cess: as in force.
- Settlement: losses are set off within each financial year and carried forward for eight years. Each year’s tax is settled at the year’s last session and paid the next session by selling both legs pro rata.
- Simplifications: everything is sold at the end; the investor is in the 30% slab with no surcharge; the annual equity exemption is ignored.
Headline results
These were logged on 2026-10-01 and corrected by the audit on 2026-10-03 (data to 1 Oct 2026).
Trend rules:
- They cut the Nifty 50’s worst fall from −59.5% to between −26% and −44%.
- None is significant after deflation.
- After tax, they trail buy-and-hold on every large-cap index, by 1.1–5.2 points a year (1.9–6.1 before the audit corrected the timing and the tax engine).
- The 200-day rule’s pre-tax edge on mid and small caps is 1.2 and 2.1 points a year (deflated values 0.10 and 0.14).
Sector momentum: not significant.
Portfolio lab (2002-10 to 2026-09):
- 60/20/20 beat 60/40 (16.4% vs 14.7% CAGR), and did so in 76% of rolling 5-year windows.
- The permanent and equal-three mixes had the best Sharpe (0.89).
- Tactical portfolios lost 1.6–2.8 points a year to tax.
The model board (/models/)
Spec: docs/research/models_v1_spec.md, registered 2026-10-08 (commit 3220f4e).
Code:
pipeline/tipsheet/models/:registry.yamlandregistry.py(the board),run.py,live.pyandforeign.pypublish/model_board.py- the refresh step
steps/quant_models.py
Bundles: models/board, models/library, models/live, and for each model models/m/<code>, models/curve/<code> and models/weights/<code>.
One engine. Every model runs on the portfolio lab’s engine (lab/engine.py), with:
- the lab’s costs by date and its tax engine;
- decisions at a close and trades at the next close.
Models taken from the lab (from_lab) use the lab’s rule and rebalancing unchanged, so their numbers match /lab/. The single-market trend rules are the same rules as /trend/evidence/. They run on the lab’s cost schedule here, so their numbers can differ slightly from that page.
Window. Each model starts at the first session after its first decision, and never before 2005-04-01. It is compared with a fixed mix of the same assets, rebalanced each January, over exactly the same dates:
- the lab’s convention is equal weight of the rule’s non-cash assets;
- the spec sets the mix for the new models.
Foreign legs:
- S&P 500: Kite’s US500 to 2016-05-30, then FRED
SP500. The years from 2005 to 2024 match S&P’s published calendar returns to 0.01 point. - Nasdaq-100: Nasdaq’s official history.
- Dividend sensitivity: iShares IVV, total return.
- Conversion and timing: ECB rates, lagged one NSE session.
- Holding route: held through LRS:
- 0.60% each way and 0.10% a year;
- taxed as shares not listed in India (
lab/tax.py, classforeign).
- What leaves the pipeline: only composite model curves and statistics. The publisher refuses a model that holds a single foreign index alone.
Sectors. There are twelve, one index per sector. In the live-only universe, each sector counts from 13 months after its launch date in compute/trend_launch_dates.csv.
The trend score. barometers_trend.signals gives 24 votes on each market’s level over cash. The weekly models trade only when a weight is more than 5 points off target.
Amendment 16 rules (2026-10-14). Four rule kinds in lab/rules.py: one_over_n (equal weights in every sleeve, back to equal at each month-end), robust_trend (each sleeve half in on its 12-month average, half on its 12-month return over cash), robust_momentum (eight weekly votes: best equity sleeve over 63/126/189/252 sessions if it passes a return-over-cash or above-its-average test, else the fallback; weights are vote shares) and adaptive (top three by 126-session return, minimum variance on the Ledoit-Wolf covariance of 60 sessions). Each is in the look-ahead scramble test. 1/N is graded against the Nifty 500 bought and held, the others against equal weights of their assets. The references on the site come from apps/site/src/lib/papers.ts, each DOI checked against Crossref.
Amendment 18 rule (2026-10-14). countercyclical reads mcap_gdp (density_mcap_gdp.parquet) and govt_debt (BIS government debt / GDP from gt_series.parquet, dated nine months after its quarter begins, when it was public) through countercyclical_inputs in models/run.py; those steps run before the model step but are not hard needs: a model whose plan comes out empty (inputs missing that night) is set aside for the run and its last published bundles stand (set_aside in the step record).
Board state:
- the target in force (the latest decision of a completed period);
- the date it began;
- for monthly rules, the decision “if the month ended today”;
- the numbers behind each decision.
The aggregate is the mean equity share across the board’s models, excluding benchmarks, with foreign equity counted as equity.
Statistics:
- Deflated Sharpe: 184 counted trials (lab 136, trend 35, sector v1 2, new 11), with the cross-sectional variance taken across the board’s models.
- Bootstrap: a 90% stationary-bootstrap interval (mean block 12 months) for the pre-tax gap to the fixed mix.
- Timing luck: each monthly rule (except the valuation glides) is rerun with decisions 0 to 20 sessions before each month-end.
The live log (live.py):
- one row per model per session from the entry date, never recomputed;
- each row’s SHA-256 chains to the previous row (
verifyruns before every append, and a broken chain stops the run); - sessions filled in after the day are marked
late; - a model whose own prices stop before the board’s last session logs only up to its last real price (
live_endsinrun.py, fromasset_tri_daily.observed.json). The panel carries the 5-year G-sec and gold forward, so without this a carried price would enter the log as a zero return for good: gold reaches the cloud in E2 (23:15), after the evening’s E1 run, and the 5-year G-sec waits for the weekly per-index fetch because NSE’s daily index file omits it. The held sessions are appended, markedlate, once the price arrives; the board’s meta lists them aslive_held. Before 2026-10-14 this hold did not exist, and rows from 1 to 13 October recorded flat prices for the 5-year G-sec and gold; the log was rebuilt once from the corrected data (spec amendment 20,live_rebuilds.yaml), and the old log is kept asmodels_live_log.superseded.2026-10-14-carried-prices.parquet. - a foreign leg (S&P 500, Nasdaq-100, IVV) whose source is late is held the same way.
lag_ontocarries a US close for up to ten days, solate_foreigninforeign.pycompares each leg’s last rupee close with the last NYSE session before the board’s end (a US holiday is not late). A late leg holds its models’ live logs at the NSE session that first read its last close, and the board’s “Behind” note names it from its US date. The release gate (ops/freshness.py) treats a foreign series up toFOREIGN_HOLD_LIMIT(5) sessions behind as a warning, not a block; beyond that it blocks. Added on 2026-10-26, when FRED’s SP500 stopped at 21 October while its Dow and Nasdaq series were current, and the gate stopped the evening release.
It lives in .cache/derived/models_live_log.parquet, which the cloud refresh keeps in R2, and is published in full as models/live.
16 October 2026 comparison and recording update
The rebuilt model comparison uses the exact shared weekly observation dates across selected models and benchmarks, rebased to one rupee at the first shared date. It does not fill gaps. Window returns include model costs and exclude tax; an after-tax window requires a separate start-date simulation. Weekly-observed falls can miss daily troughs, and sub-year windows are not annualised. Editorial group membership does not depend on performance.
Since-entry returns recomputed from current wealth remain backtests. Frozen
paper-log returns are separate. A row is reconstructed when recorded after
its session date in India, even if it was the latest source session then.
Only the latest contiguous on-time suffix is presented as a contemporaneous
record. Legacy hashes stay unchanged; new rows hash recording metadata too.
Log-versus-replay reconciliation uses matching daily pre-tax returns and is
unavailable without daily replay. Source ETF NAV rows remain internal; the
separately registered ETF model results do not replace the original foreign
price-index models. See
docs/reference/international-etf-sources.md.
ETF versions
The ETF-input amendment is registered in docs/research/models_etf_spec.md.
IVV represents US large caps; ACWI includes developed and emerging markets,
including India. Each has separate trend, GTAA and dual-momentum versions.
The original index-input models keep their codes and histories. ACWX is an
available input, with no new strategy in this amendment.
ETF signals and returns use official full-workbook NAVs with ex-date distributions reinvested and splits accounted for, converted to INR at the last available ECB rate of the US date (maximum four calendar days). Only US dates strictly before the Indian session are available to a decision. A new version stops when its final actual workbook observation first reaches the Indian calendar. A newer screener YTD cannot fill the missing tail. Each model waits for its entire signal lookback; no pre-inception history is added.
Fund expenses are already in NAV. Additional annual fund drag is zero for these ETF assets, with assumed execution costs of 0.60% each way. NAV-based execution is an approximation. ETF-version results are before investor tax and dividend withholding; the capital-gains-only engine is not used to claim an after-tax return from a reinvested distribution series. Monthly issuer reconciliation residuals remain documented in the source-quality note.
Published paper-log precision
The models/live audit export publishes returns at the twelve-decimal
precision used in the hash payload, with an explicit hash_version on every
row. Version 1 covers previous hash, model, session date, net return, gross
return and the target JSON string; version 2 also covers recording time and
the late flag. The payload is a compact JSON list. Non-finite gross returns
are null. Each model begins at 64 zeroes.
The older public export rounded returns to four decimals, which prevented readers from recomputing its hashes from that JSON. The export is corrected; the stored ledger and its existing hashes are unchanged. The publication round-trip is tested for both versions and on actual frozen rows.