> ## Documentation Index
> Fetch the complete documentation index at: https://docs.forii.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Metric Registry

> Dual-tag taxonomy, point-in-time rules, and how to add a predictor.

## Dual tags

Every predictor is a registered function carrying two tags:

* **category** — the standard financial taxonomy, shown to humans (valuation,
  profitability, efficiency, leverage, growth, momentum, size, liquidity)
* **group** — the ML feature-set alias used by models (value, profitability,
  investment, momentum, size)

```python theme={null}
from predictors.registry import MetricContext, metric

@metric("mom1m", "momentum", "momentum", "prior-month simple return")
def mom1m(ctx: MetricContext) -> pd.Series:
    return ctx.monthly["ret"].shift(1)
```

Registration happens at import; the panels, `get_metrics`, `list_metrics`, and
every REST endpoint pick the new metric up automatically.

## The taxonomy

| category | predictors | ML group |
| - | - | - |
| momentum | mom1m · mom6m · mom12m · mom36m · chmom · indmom | momentum |
| valuation | bm · bm\_ia · ep · sp · dp · dy · cashpr · rd\_mve | value |
| profitability | operprof · ps | profitability |
| efficiency | depr | profitability |
| growth | agr · invest · chinv · nincr | investment |
| leverage | lgr · chcsho | investment |
| size | mvel1 | size |
| liquidity | current\_ratio · quick\_ratio (planned) | — |

Definitions follow the open-source asset-pricing literature
(Chen-Zimmermann): `ps` = Piotroski F-score, `nincr` = consecutive
earnings-increase quarters, `depr` = depreciation/PP\&E, `chcsho` = net share
issuance, `agr` = 12-month asset growth, `operprof` = operating profits over
book equity.

## Point-in-time rule

A metric value for month-end `t` may only use data observable at
`t - asof_lag` months:

* `asof_lag=0` — a fiscal year ending 2015-03-31 is usable from 2015-03-31
  (the academic standard)
* `asof_lag=3` — approximates the results-announcement delay

`MetricContext` carries only data that passes the filter — metric functions
cannot see the future even if they try.

## Panels

`build-panel` runs the registry over every ticker's staged monthly prices and
writes one CSV per ML group to `intermediate_data/panels/`:

```
nse_code,date,mom1m
INFY,2003-02-28,0.0
INFY,2003-03-31,-0.0045592705167172
```

`get_panel(metric)` reads the panels back as a wide date × ticker
cross-section — the exact shape the ML pipeline consumes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.