resid is a small library for daily cross-sectional return residualization.
It includes a CLI for local
FinanceData/marcap KRX data and does
not download or supplement that dataset.
Install mise, then:
git clone https://github.com/FinanceData/marcap.git ../marcap
mise install
uv syncPython 3.14 and the dependencies are pinned in mise.toml and uv.lock.
uv run resid ../marcap/data --config resid.tomlThe positional data path is required. Other CLI values override matching TOML
fields; for example, --universe-size 500 or --regression-method sqrt-cap-wls.
Copy resid.toml for another experiment. See uv run resid --help for all
overrides. Artifacts are written as typed, compressed Parquet files.
| Notation | File | Schema |
|---|---|---|
| ε | epsilon.parquet |
(date, ticker, specific_return) |
| r | r.parquet |
(date, ticker, return) |
| X | X.parquet |
(date, ticker, <one column per factor>) |
| f | f.parquet |
(date, <one column per factor>) |
epsilon is the primary output. The other files support reconstruction and
diagnosis. Sequential fits expose a weighted orthogonal basis, so X is the
exact design used for reconstruction.