Update dataset card for the OSAP release and id-range files
Browse filesDescribes the three-column id-range layout, the 179 OSAP sorting variables and the zero-month convention. Merge together with the upload of the new returns.
README.md
CHANGED
|
@@ -10,7 +10,7 @@ tags:
|
|
| 10 |
- portfolio-sorts
|
| 11 |
- empirical-finance
|
| 12 |
size_categories:
|
| 13 |
-
-
|
| 14 |
task_categories:
|
| 15 |
- tabular-regression
|
| 16 |
- time-series-forecasting
|
|
@@ -18,31 +18,33 @@ task_categories:
|
|
| 18 |
|
| 19 |
# Tidy Finance Factor Library: Portfolio Returns
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
## Dataset Details
|
| 24 |
|
| 25 |
### Dataset Description
|
| 26 |
|
| 27 |
-
The dataset contains monthly long-short portfolio returns for
|
| 28 |
|
| 29 |
- **Curated by:** Christoph Frey (Lancaster University), Christoph Scheuch (Tidy Intelligence), Stefan Voigt (University of Copenhagen), Patrick Weiss (Reykjavík University)
|
| 30 |
-
- **License:**
|
| 31 |
|
| 32 |
### Dataset Sources
|
| 33 |
|
|
|
|
|
|
|
| 34 |
- **R package:** [github.com/tidy-finance/r-tidyfinance](https://github.com/tidy-finance/r-tidyfinance)
|
| 35 |
- **Python package:** [github.com/tidy-finance/py-tidyfinance](https://github.com/tidy-finance/py-tidyfinance)
|
| 36 |
-
- **Demo:** [factors.tidy-finance.org
|
| 37 |
|
| 38 |
## Uses
|
| 39 |
|
| 40 |
### Direct Use
|
| 41 |
|
| 42 |
- Empirical asset pricing research: evaluating factor models, testing anomalies, and benchmarking portfolio strategies.
|
| 43 |
-
- Robustness analysis: comparing factor returns across
|
| 44 |
- Teaching and replication: reproducing canonical results from the asset pricing literature.
|
| 45 |
-
- Sensitivity analysis: studying how
|
| 46 |
|
| 47 |
### Out-of-Scope Use
|
| 48 |
|
|
@@ -51,119 +53,75 @@ The dataset contains monthly long-short portfolio returns for 50 sorting variabl
|
|
| 51 |
|
| 52 |
## Dataset Structure
|
| 53 |
|
| 54 |
-
The
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
<table>
|
| 58 |
-
<thead>
|
| 59 |
-
<tr>
|
| 60 |
-
<th>Column</th>
|
| 61 |
-
<th>Type</th>
|
| 62 |
-
<th>Description</th>
|
| 63 |
-
</tr>
|
| 64 |
-
</thead>
|
| 65 |
-
<tbody>
|
| 66 |
-
<tr>
|
| 67 |
-
<td><code>id</code></td>
|
| 68 |
-
<td>int32</td>
|
| 69 |
-
<td>Unique specification identifier linking to the portfolio sort grid</td>
|
| 70 |
-
</tr>
|
| 71 |
-
<tr>
|
| 72 |
-
<td><code>date</code></td>
|
| 73 |
-
<td>date32</td>
|
| 74 |
-
<td>Month of the portfolio return</td>
|
| 75 |
-
</tr>
|
| 76 |
-
<tr>
|
| 77 |
-
<td><code>ret_type</code></td>
|
| 78 |
-
<td>string</td>
|
| 79 |
-
<td>Return type: <code>vw</code> (value-weighted) or <code>ew</code> (equal-weighted)</td>
|
| 80 |
-
</tr>
|
| 81 |
-
<tr>
|
| 82 |
-
<td><code>ret</code></td>
|
| 83 |
-
<td>double</td>
|
| 84 |
-
<td>Monthly long-short portfolio excess return</td>
|
| 85 |
-
</tr>
|
| 86 |
-
<tr>
|
| 87 |
-
<td><code>sorting_variable</code></td>
|
| 88 |
-
<td>string</td>
|
| 89 |
-
<td>Sorting characteristic (e.g., <code>ag</code> for asset growth, <code>bm</code> for book-to-market)</td>
|
| 90 |
-
</tr>
|
| 91 |
-
<tr>
|
| 92 |
-
<td><code>sorting_variable_lag</code></td>
|
| 93 |
-
<td>string</td>
|
| 94 |
-
<td>Lagging convention: <code>3m</code>, <code>6m</code>, or <code>ff</code> (Fama-French)</td>
|
| 95 |
-
</tr>
|
| 96 |
-
</tbody>
|
| 97 |
-
</table>
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
The `sorting_variable` partition key identifies the characteristic (e.g., `ag` for asset growth, `bm` for book-to-market). The `sorting_variable_lag` partition key identifies the lagging convention (`3m`, `6m`, or `ff` for the Fama-French convention). The `id` column maps to a separate specification grid that documents all preprocessing choices for each specification (breakpoints, exclusions, rebalancing frequency, etc.).
|
| 103 |
-
|
| 104 |
-
### Sorting variables
|
| 105 |
-
|
| 106 |
-
The 50 sorting variables span seven categories: investment, profitability, valuation, momentum, intangibles, trading frictions, and financing. See the companion paper for the full list and definitions.
|
| 107 |
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
<thead>
|
| 114 |
-
<tr>
|
| 115 |
-
<th>Choice</th>
|
| 116 |
-
<th>Options</th>
|
| 117 |
-
</tr>
|
| 118 |
-
</thead>
|
| 119 |
-
<tbody>
|
| 120 |
-
<tr>
|
| 121 |
-
<td>Size exclusion</td>
|
| 122 |
-
<td>None; bottom 20th NYSE percentile</td>
|
| 123 |
-
</tr>
|
| 124 |
-
<tr>
|
| 125 |
-
<td>Exclusion of financials</td>
|
| 126 |
-
<td>No; Yes</td>
|
| 127 |
-
</tr>
|
| 128 |
-
<tr>
|
| 129 |
-
<td>Exclusion of utilities</td>
|
| 130 |
-
<td>No; Yes</td>
|
| 131 |
-
</tr>
|
| 132 |
-
<tr>
|
| 133 |
-
<td>Exclusion of neg. earnings</td>
|
| 134 |
-
<td>No; Yes</td>
|
| 135 |
-
</tr>
|
| 136 |
-
<tr>
|
| 137 |
-
<td>Sorting variable lag</td>
|
| 138 |
-
<td>3 months; 6 months; Fama-French</td>
|
| 139 |
-
</tr>
|
| 140 |
-
<tr>
|
| 141 |
-
<td>Rebalancing</td>
|
| 142 |
-
<td>Monthly; Annual (July)</td>
|
| 143 |
-
</tr>
|
| 144 |
-
<tr>
|
| 145 |
-
<td>Breakpoint quantiles (main)</td>
|
| 146 |
-
<td>5; 10</td>
|
| 147 |
-
</tr>
|
| 148 |
-
<tr>
|
| 149 |
-
<td>Double sort</td>
|
| 150 |
-
<td>Single; Dependent; Independent</td>
|
| 151 |
-
</tr>
|
| 152 |
-
<tr>
|
| 153 |
-
<td>Breakpoint quantiles (secondary)</td>
|
| 154 |
-
<td>2; 5</td>
|
| 155 |
-
</tr>
|
| 156 |
-
<tr>
|
| 157 |
-
<td>Breakpoint exchanges</td>
|
| 158 |
-
<td>NYSE; All</td>
|
| 159 |
-
</tr>
|
| 160 |
-
<tr>
|
| 161 |
-
<td>Weighting</td>
|
| 162 |
-
<td>Equal-weighted; Value-weighted</td>
|
| 163 |
-
</tr>
|
| 164 |
-
</tbody>
|
| 165 |
-
</table>
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
## Dataset Creation
|
| 169 |
|
|
@@ -175,12 +133,15 @@ Existing factor libraries (e.g., the French Data Library) provide canonical fact
|
|
| 175 |
|
| 176 |
#### Data Collection and Processing
|
| 177 |
|
| 178 |
-
|
|
|
|
|
|
|
| 179 |
|
| 180 |
#### Who are the source data producers?
|
| 181 |
|
| 182 |
- CRSP (Center for Research in Security Prices) at the University of Chicago
|
| 183 |
- Compustat (S&P Global Market Intelligence)
|
|
|
|
| 184 |
|
| 185 |
### Personal and Sensitive Information
|
| 186 |
|
|
@@ -188,14 +149,16 @@ The dataset contains aggregated portfolio-level returns only. No individual-leve
|
|
| 188 |
|
| 189 |
## Bias, Risks, and Limitations
|
| 190 |
|
| 191 |
-
- **
|
| 192 |
-
- **
|
|
|
|
| 193 |
- **Historical data:** Returns reflect past market conditions and do not predict future performance.
|
| 194 |
- **Data vendor dependence:** Reproducing the dataset from scratch requires WRDS access (CRSP and Compustat subscriptions).
|
|
|
|
| 195 |
|
| 196 |
### Recommendations
|
| 197 |
|
| 198 |
-
|
| 199 |
|
| 200 |
## Citation
|
| 201 |
|
|
@@ -208,4 +171,18 @@ Researchers should consult the companion paper for detailed variable definitions
|
|
| 208 |
year={2026},
|
| 209 |
journal={Working Paper}
|
| 210 |
}
|
|
|
|
|
|
|
|
|
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
- portfolio-sorts
|
| 11 |
- empirical-finance
|
| 12 |
size_categories:
|
| 13 |
+
- 1B<n<10B
|
| 14 |
task_categories:
|
| 15 |
- tabular-regression
|
| 16 |
- time-series-forecasting
|
|
|
|
| 18 |
|
| 19 |
# Tidy Finance Factor Library: Portfolio Returns
|
| 20 |
|
| 21 |
+
Monthly long-short portfolio returns for 179 firm characteristics across 4,105,728 portfolio construction specifications. The data cover US common stocks from January 1960 to December 2024.
|
| 22 |
|
| 23 |
## Dataset Details
|
| 24 |
|
| 25 |
### Dataset Description
|
| 26 |
|
| 27 |
+
The dataset contains monthly long-short portfolio returns for 179 sorting variables: the continuous predictors published by [Open Source Asset Pricing](https://www.openassetpricing.com/) (Chen and Zimmermann, 2022) and the three CRSP-based signals that Open Source Asset Pricing adds (short-term reversal, price, and size). Each sorting variable is evaluated across all valid combinations of construction choices: sample exclusions, lagging conventions, breakpoints, sorting methods, weighting schemes, and rebalancing frequencies. Every return series is identified by an `id` that links to the [specification grid](https://huggingface.co/datasets/tidy-finance/factor-library-grid), which records all choices behind the series.
|
| 28 |
|
| 29 |
- **Curated by:** Christoph Frey (Lancaster University), Christoph Scheuch (Tidy Intelligence), Stefan Voigt (University of Copenhagen), Patrick Weiss (Reykjavík University)
|
| 30 |
+
- **License:** CC0 1.0
|
| 31 |
|
| 32 |
### Dataset Sources
|
| 33 |
|
| 34 |
+
- **Construction pipeline:** [github.com/tidy-finance/factor-library](https://github.com/tidy-finance/factor-library)
|
| 35 |
+
- **Specification grid:** [tidy-finance/factor-library-grid](https://huggingface.co/datasets/tidy-finance/factor-library-grid)
|
| 36 |
- **R package:** [github.com/tidy-finance/r-tidyfinance](https://github.com/tidy-finance/r-tidyfinance)
|
| 37 |
- **Python package:** [github.com/tidy-finance/py-tidyfinance](https://github.com/tidy-finance/py-tidyfinance)
|
| 38 |
+
- **Demo:** [factors.tidy-finance.org](https://factors.tidy-finance.org/)
|
| 39 |
|
| 40 |
## Uses
|
| 41 |
|
| 42 |
### Direct Use
|
| 43 |
|
| 44 |
- Empirical asset pricing research: evaluating factor models, testing anomalies, and benchmarking portfolio strategies.
|
| 45 |
+
- Robustness analysis: comparing factor returns across methodological specifications.
|
| 46 |
- Teaching and replication: reproducing canonical results from the asset pricing literature.
|
| 47 |
+
- Sensitivity analysis: studying how construction choices (breakpoints, weighting, rebalancing, lags) affect factor premia.
|
| 48 |
|
| 49 |
### Out-of-Scope Use
|
| 50 |
|
|
|
|
| 53 |
|
| 54 |
## Dataset Structure
|
| 55 |
|
| 56 |
+
The returns are stored in Parquet files with three columns:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
| Column | Type | Description |
|
| 59 |
+
| --- | --- | --- |
|
| 60 |
+
| `id` | int32 | Specification identifier, the key of the specification grid |
|
| 61 |
+
| `date` | date32 | Month of the return |
|
| 62 |
+
| `ret` | float32 | Monthly long-short excess return |
|
| 63 |
+
|
| 64 |
+
Everything else about a series, such as its sorting variable, lag, sorting method, or weighting scheme, is a property of its `id` and is recorded in the specification grid, so it is not repeated in the returns.
|
| 65 |
+
|
| 66 |
+
The files are cut by contiguous ranges of 1,000 ids and named after the range they cover, so the file that holds a series follows from its `id` alone:
|
| 67 |
+
|
| 68 |
+
```
|
| 69 |
+
id_0000001-0001000.parquet
|
| 70 |
+
id_0001001-0002000.parquet
|
| 71 |
+
...
|
| 72 |
+
id_4105001-4106000.parquet
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
Within a file, rows are sorted by `id` and `date`. The last file is named after its nominal range although it only holds ids up to the last id of the grid.
|
| 76 |
+
|
| 77 |
+
### Months without a return, and missing series
|
| 78 |
+
|
| 79 |
+
- A month without a valid long-short return is stored as exactly `0`. This happens before a signal starts, after it ends, and when a sort collapses to a single portfolio. Most Open Source Asset Pricing signals end before December 2024, so most series end in a run of zeros. Genuine returns are never exactly zero, so filter `ret != 0` to restrict a series to the months in which the factor exists.
|
| 80 |
+
- Specifications whose sort produced no portfolios at all have no rows. This applies to `rdcap` and `probinformedtrading` when small firms are excluded, because Open Source Asset Pricing provides these signals only for small firms.
|
| 81 |
+
- `ret` is stored in single precision. Compare a downloaded series with a locally rebuilt one using a tolerance of about `1e-6`.
|
| 82 |
+
|
| 83 |
+
## Loading the Data
|
| 84 |
+
|
| 85 |
+
With the [tidyfinance](https://github.com/tidy-finance/r-tidyfinance) R package, version 0.8.0.9005 or later, which selects series by their construction choices or by `id` and joins the specification grid:
|
| 86 |
+
|
| 87 |
+
```r
|
| 88 |
+
library(tidyfinance)
|
| 89 |
|
| 90 |
+
download_data("Tidy Finance", "factor_library", sorting_variable = "bm")
|
| 91 |
+
download_factor_library_ids(c(1L, 2L, 3L))
|
| 92 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
Without the package, compute the file that holds an `id` and read only that file, for example with DuckDB:
|
| 95 |
+
|
| 96 |
+
```sql
|
| 97 |
+
SELECT *
|
| 98 |
+
FROM 'hf://datasets/tidy-finance/factor-library/id_0000001-0001000.parquet'
|
| 99 |
+
WHERE id IN (1, 2, 3);
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
A glob over all files also works, but it reads the metadata of every file first, so reading the files computed from the ids is faster.
|
| 103 |
+
|
| 104 |
+
### Specification grid
|
| 105 |
+
|
| 106 |
+
Each sorting variable is evaluated across the combinations of:
|
| 107 |
+
|
| 108 |
+
| Choice | Options |
|
| 109 |
+
| --- | --- |
|
| 110 |
+
| Size filter | None; exclude stocks below the 20th NYSE size percentile |
|
| 111 |
+
| Exclusion of financials | No; Yes |
|
| 112 |
+
| Exclusion of utilities | No; Yes |
|
| 113 |
+
| Exclusion of negative earnings | No; Yes |
|
| 114 |
+
| Minimum listing age | 24 months |
|
| 115 |
+
| Sorting variable lag | 1 month (timing of Open Source Asset Pricing); 3 months; 6 months; Fama-French |
|
| 116 |
+
| Rebalancing | Monthly; Annual (July) |
|
| 117 |
+
| Portfolios in the main sort | 3; 5; 10 |
|
| 118 |
+
| Sorting method | Univariate; Bivariate dependent; Bivariate independent (size as the second variable) |
|
| 119 |
+
| Portfolios in the size sort | 2; 5 |
|
| 120 |
+
| Minimum size for the main breakpoints | None; 20th percentile |
|
| 121 |
+
| Breakpoint exchanges | NYSE; NYSE, AMEX, and NASDAQ |
|
| 122 |
+
| Weighting | Equal-weighted; Value-weighted; Capped value-weighted (market capitalization capped at its 80th percentile each month) |
|
| 123 |
+
|
| 124 |
+
Invalid combinations are removed: univariate sorts have no size sort, and `size` itself is not used in bivariate sorts. See the [specification grid](https://huggingface.co/datasets/tidy-finance/factor-library-grid) for the exact values.
|
| 125 |
|
| 126 |
## Dataset Creation
|
| 127 |
|
|
|
|
| 133 |
|
| 134 |
#### Data Collection and Processing
|
| 135 |
|
| 136 |
+
Stock returns, market capitalization, exchange, industry, price, and listing age come from the CRSP monthly stock file, and book equity and earnings from Compustat, both via WRDS. Compustat is used only for the negative book equity and negative earnings filters. The sorting variables are the signed firm-level predictors of the Open Source Asset Pricing release. The [`tidyfinance`](https://github.com/tidy-finance/r-tidyfinance) R package implements the portfolio sorts, and the full pipeline is in [github.com/tidy-finance/factor-library](https://github.com/tidy-finance/factor-library).
|
| 137 |
+
|
| 138 |
+
The signals enter the 1-month lag at the timing of Open Source Asset Pricing, which already accounts for when the underlying data become available. The 3-month, 6-month, and Fama-French conventions add further lag for robustness. Annual Compustat data count as available six months after the fiscal year end, matching Open Source Asset Pricing.
|
| 139 |
|
| 140 |
#### Who are the source data producers?
|
| 141 |
|
| 142 |
- CRSP (Center for Research in Security Prices) at the University of Chicago
|
| 143 |
- Compustat (S&P Global Market Intelligence)
|
| 144 |
+
- Open Source Asset Pricing (Andrew Y. Chen and Tom Zimmermann)
|
| 145 |
|
| 146 |
### Personal and Sensitive Information
|
| 147 |
|
|
|
|
| 149 |
|
| 150 |
## Bias, Risks, and Limitations
|
| 151 |
|
| 152 |
+
- **Look-ahead and survivorship bias:** The lagging conventions are designed to avoid look-ahead bias, but the dataset reflects the CRSP and Compustat universe with its known survivorship characteristics.
|
| 153 |
+
- **Signal coverage:** Signals start and end at different dates, which shows up as leading and trailing zero months. `std_turn` also covers only small firms, so its series have long runs of zero months.
|
| 154 |
+
- **US equities only:** International markets are not included.
|
| 155 |
- **Historical data:** Returns reflect past market conditions and do not predict future performance.
|
| 156 |
- **Data vendor dependence:** Reproducing the dataset from scratch requires WRDS access (CRSP and Compustat subscriptions).
|
| 157 |
+
- **Data revisions:** CRSP, Compustat, and Open Source Asset Pricing revise their data between releases, so a rebuild can differ slightly from a published release. Earlier releases stay available through the commit history of this dataset.
|
| 158 |
|
| 159 |
### Recommendations
|
| 160 |
|
| 161 |
+
Consult the specification grid and the companion paper before using the data. When reporting results, state the `id` of every series used.
|
| 162 |
|
| 163 |
## Citation
|
| 164 |
|
|
|
|
| 171 |
year={2026},
|
| 172 |
journal={Working Paper}
|
| 173 |
}
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
Please also cite Open Source Asset Pricing:
|
| 177 |
|
| 178 |
+
```bibtex
|
| 179 |
+
@article{ChenZimmermann.2022,
|
| 180 |
+
title={Open Source Cross-Sectional Asset Pricing},
|
| 181 |
+
author={Chen, Andrew Y. and Zimmermann, Tom},
|
| 182 |
+
journal={Critical Finance Review},
|
| 183 |
+
volume={11},
|
| 184 |
+
number={2},
|
| 185 |
+
pages={207--264},
|
| 186 |
+
year={2022}
|
| 187 |
+
}
|
| 188 |
+
```
|