Known limitations¶
What this release does not do, or does only approximately. Each section says what the limitation is, when it affects your numbers, and what to do about it. None of them affects the anomaly-testing protocol's headline results under its default settings, except where a section says so.
- Trading costs at holding periods longer than one month
- Factor trading costs are those of a reconstruction of the Fama-French portfolios
- A stock with no panel row in June has no annual data that year
- The random seed is part of the specification
- The demo-database stamp is a guard, not a proof of provenance
run_bivariate_sorthas no per-stock trading costs- The Chen-Zimmerman download depends on Hugging Face
Trading costs at holding periods longer than one month¶
run_univariate_sort prices trading costs on held legs: each portfolio is bought at a
trade and left alone until the next, and the cost is that of the trades between what the
portfolio holds and its new targets
(Ch 13, Held legs). With holding_period=h,
h > 1, the portfolios are not held legs: every month each leg earns the return of fresh
target weights over the union of the last h formations.
What is refused. run_univariate_sort(..., tcosts=<per-stock panel>, holding_period=h)
with h > 1 raises ValueError. There are no net returns for overlapping portfolios. Gross
returns at any h are computed as before.
What is still approximate at holding_period=1. The held-leg calculation follows the
portfolio it reports, with these simplifications:
- Dividends are reinvested free of charge. A position grows with the stock's total return, so a dividend buys more of the stock that paid it and that purchase is not charged.
- A stock that loses its market cap becomes cash at its last value, earns nothing until the next trade, and is not charged for the exit.
- A stock without a return in a month earns the average of the leg's other stocks, and a stock without a half-spread is traded for free.
- A trade costs the half-spread on the dollars traded: no price impact, no commissions, no short-sale fees, and the long and the short leg are not netted against each other.
- The first purchase is not charged. Its cost is reported as one number (
entry_cost) and is not in the cost series or the net returns. - A portfolio's own cost is not its part of a pair's cost under
"capital".ptf_costsandptf_toprice every portfolio as a portfolio held by itself. Under"dollar"the two extreme columns add up to the pair's cost; under"capital"they do not.
The standalone calc_tcosts (the MATLAB calculation; nothing in the package calls it)
still accepts holding_period > 1. There it takes holdings between rebalances at target
weights and does not net a stock that leaves one vintage and enters another in the same
month. It raises for lower-frequency formations (annual or gapped rebalancing) and custom
weight matrices with holding_period > 1.
What to do. Report net returns at holding_period=1. Details:
Ch 15, calc_tcosts.
Factor trading costs are those of a reconstruction of the Fama-French portfolios¶
The generalized alpha uses each factor's published return (Ken French's) and a trading cost the toolkit computes (Ch 9b). The cost is that of portfolios built to match the ones behind the published return: the 2×3 portfolios are held between trades (June; every month for UMD), and each side of a factor is brought back to equal shares of its 2×3 portfolios every month, as averaging their returns every month assumes. Two differences from the published portfolios remain:
- The 2×3 portfolios drift with
ret. Between trades a position grows with the stock's total return. Ken French's portfolios are value-weighted every month, so their weights follow market cap, which also moves with share issues and repurchases. - The 2×3 sorts are the toolkit's. They are rebuilt from CRSP and Compustat with NYSE breakpoints and are not Ken French's own portfolio assignments.
How large. On a CIZ database built in November 2026 (sample 1925 to 2025,
tcosts_type=full), in % a month. Returns are averaged over the months for which the
database has the published factor; costs over July 1926 to December 2025, with zero in
the months before a factor's first trade:
| Factor | Return of the reconstruction | Published return | Correlation | Trading cost | Of which monthly re-split |
|---|---|---|---|---|---|
| SMB | 0.152 | 0.164 | 0.996 | 0.060 | 0.011 |
| HML | 0.322 | 0.347 | 0.989 | 0.082 | 0.012 |
| RMW | 0.275 | 0.266 | 0.968 | 0.035 | 0.006 |
| CMA | 0.175 | 0.239 | 0.982 | 0.049 | 0.005 |
| UMD | 0.634 | 0.612 | 0.996 | 0.508 | 0 |
CMA's reconstruction earns 0.064% a month less than the published factor, the largest gap of
the five; the cause has not been examined. The reconstruction's return enters no result (the
published return is used everywhere); it shows how well the priced portfolios stand in for
the published ones. The build logs the same numbers for your database (lines
FF factor <F>: held sides … in the compute-ff-tcosts stage).
A consequence to know. SMB, HML, RMW and CMA carry a small cost in every month, for the monthly re-split of each side. A test signal that trades once a year pays in its trade months only: its return is that of legs left alone between trades, so it owes no such charge.
A stock with no panel row in June has no annual data that year¶
Annual Compustat columns are stored on the row of the June in which the record becomes
available, and aa.fill_months and aa.load(..., fill_annual=True) carry a value forward
only on rows that follow a June row with a value. A stock that has no row in ccm_panel in
that June (for example one that becomes a US common share later in the year, or one with a
gap in its CRSP record over the June) has no annual values from that record in any month.
Its next June starts a new record as usual.
When it matters. Only where annual data are used in months other than June: a filled
load, a signal you fill with aa.fill_months, and the two built-in signals that do so
(value-momentum and value-momentum-profitability in nmv_anomalies). A sort on a June-only
signal cannot hold such a stock in any case. The cases are rare; see
Ch 7.
The random seed is part of the specification¶
Two steps of the protocol draw random numbers, and both are seeded so that a rerun gives the same numbers:
- Tie-break noise. Before sorting, each anomaly signal gets noise of order
1e-12, so that stocks with exactly equal signal values are split between portfolios at random rather than by row order. The draw is seeded (default seed20231201), with one random stream per anomaly, keyed by the anomaly's name: an anomaly gets the same draw whatever other anomalies are in the comparison set. - LASSO cross-validation. The combination strategies choose the LASSO penalty by
shuffled K-fold cross-validation, seeded (
random_state=0).
A different seed is a different result. For continuous signals the tie-break draw changes nothing measurable. For tie-heavy signals (binary event flags, such as dividend initiations or credit-rating downgrades, and small-integer counts) it decides which tied stocks land in the extreme portfolios, and changing the draw has moved such an anomaly's long-short return by up to about 0.1 %/month and its t-statistic by more than 2.
What to do. Report results with their seeds. Every protocol run records them in its run
manifest under scientific.seeds
(Ch 2, Run manifests); two runs with the
same scientific_id used the same seeds.
The demo-database stamp is a guard, not a proof of provenance¶
aa setup-database --demo (or setup_database(demo=True)) builds a database from
deterministic synthetic data, for trying the toolkit without a WRDS subscription. Such a
database is stamped as synthetic; aa run-protocol and test_signal refuse it unless you pass
--allow-demo-data / allow_demo_data=True, and then label every output
SYNTHETIC DEMO DATA — NOT REAL RESEARCH OUTPUT. Without --demo, a build with no WRDS
credentials, or with a failed download, stops with an error instead of substituting
synthetic data.
The stamp has limits:
- It fails open. A database with no stamp, or one whose stamp cannot be read, is treated as real. The stamp exists to catch an accidental demo build, not to certify a database.
- Only the protocol checks it.
aa.load, the sorts and the Fama–MacBeth regressions run on a demo database without complaint. - Only a full rebuild clears it. A production run over a stamped database clears the
stamp only with
aa setup-database --full-refreshfrom the first stage. A partial run (--start-from, or a scoped rebuild) may leave synthetic rows behind, so it keeps the stamp and logs a warning.
What to do. Keep demo and research databases in separate project folders (the database
lives at Data/aa.duckdb in the project folder; see The project folder),
and check scientific.demo_data in the
run manifest (Ch 2, Run manifests).
run_bivariate_sort has no per-stock trading costs¶
run_univariate_sort computes turnover, trading costs and net returns from per-stock costs.
run_bivariate_sort does not: it reports gross returns only. Its tcosts= argument is
accepted for signature compatibility and is currently ignored: passing it does not
produce net returns.
What to do. For net returns of a strategy, run it as a univariate sort with tcosts=.
The Fama–French factors' own trading costs come from a separate path
(Ch 9b) and are not affected. Details:
Ch 13, Entry points.
The Chen-Zimmerman download depends on Hugging Face¶
The anomaly zoo comes from the Chen–Zimmerman Open Source Asset Pricing releases, which are
branches of the public Hugging Face dataset
OpenSourceAP/CrossSection
(Google Drive, where they used to be, could not handle the download volume). The build
downloads Firm Level Characteristics/signed_predictors_dl_wide.parquet (~1.9 GB in 2026.10)
and SignalDoc.csv from one commit of the release's branch and checks each against the
size and checksum Hugging Face lists. No account or token is needed, but both
huggingface.co and *.hf.co (the CDN the large file is served from) must be reachable;
a firewall that allows only the first lets the release lookup through and then times out on
the download.
Without cz_release_version, the build uses the newest release on Hugging Face, looked up
when stage 23 runs (2026.10 today). A rebuild after Chen and Zimmermann publish a new
release therefore uses the new one, and the zoo can change. For a paper, pin a release with
aa set-params --cz-release-version 2026.10. A pinned release must be one this version of
the package knows (2022.03, 2022.04, 2023.08, 2024.08, 2024.10, 2025.10, 2026.10). If the
release list cannot be read, the newest of these is used, with a warning.
Downloads retry dropped connections, timeouts and HTTP 429/5xx (five attempts, with backoff) and resume a partial download where it stopped. A missing file, a missing branch or a checksum mismatch is not retried.
When it affects you. Only while building or rebuilding a database, at stage 23,
fetch-cz-anomalies, which runs just before finalize. A C-Z failure does not stop the
build: the rest of the database is built, the stage is recorded as failed-nonfatal, and the
run ends with "Build finished; 1 stage(s) did not complete: fetch-cz-anomalies" and what to do,
with exit code 0. The database then has no cz_anomalies table, so aa.load_cz_anomalies and
aa run-protocol stop with a message saying so until you fetch it. Nothing is downloaded
from Hugging Face before stage 23; at startup aa setup-database checks cz_release_version
and logs which local C-Z files it found, or that stage 23 will download them. Where
huggingface.co or *.hf.co is blocked, the download times out.
Avoiding it. Download both files before the build, as the README recommends.
What to do. Any one of:
- allow
huggingface.coand*.hf.cothrough the firewall, or run the build on a network that reaches them; - download
signed_predictors_dl_wide.parquet(under Firm Level Characteristics) andSignalDoc.csvfrom the release's branch (the error names it, e.g.Data-Release-2026.10), keep their names, and save them anywhere underData/staging/,Data/, or the directory you runaafrom (aninputs/folder there is a good place), or keep them anywhere and runaa set-params --cz-signals-path <file> --cz-signal-doc-path <file>.
Then fetch the zoo with aa setup-database --start-from fetch-cz-anomalies, which runs only
that stage and finalize, so the WRDS stages are not repeated. A file you
supply yourself does not say which release it is from. A SignalDoc.csv found the same way
is used with it; without one, the signal documentation is the cz_release_version release's
(default: the newest), downloaded. Keep the two from the same release. The run manifest
records which release each file came from under data_vintage.cz_release_resolved, and the
Hugging Face branch and commit of each file read from a release under
data_vintage.cz_release_source.