AssayingAnomalies 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. assayinganomalies-0.9.0/CHANGELOG.md +62 -0
  2. assayinganomalies-0.9.0/CITATION.cff +46 -0
  3. assayinganomalies-0.9.0/LICENSE +23 -0
  4. assayinganomalies-0.9.0/MANIFEST.in +4 -0
  5. assayinganomalies-0.9.0/PKG-INFO +596 -0
  6. assayinganomalies-0.9.0/README.md +548 -0
  7. assayinganomalies-0.9.0/pyproject.toml +93 -0
  8. assayinganomalies-0.9.0/setup.cfg +4 -0
  9. assayinganomalies-0.9.0/src/assayinganomalies/__init__.py +172 -0
  10. assayinganomalies-0.9.0/src/assayinganomalies/analytics/__init__.py +137 -0
  11. assayinganomalies-0.9.0/src/assayinganomalies/analytics/anomaly_decay.py +255 -0
  12. assayinganomalies-0.9.0/src/assayinganomalies/analytics/costs.py +436 -0
  13. assayinganomalies-0.9.0/src/assayinganomalies/analytics/gen_alpha.py +768 -0
  14. assayinganomalies-0.9.0/src/assayinganomalies/analytics/held.py +924 -0
  15. assayinganomalies-0.9.0/src/assayinganomalies/analytics/ols.py +76 -0
  16. assayinganomalies-0.9.0/src/assayinganomalies/analytics/plots.py +83 -0
  17. assayinganomalies-0.9.0/src/assayinganomalies/analytics/protocol.py +1806 -0
  18. assayinganomalies-0.9.0/src/assayinganomalies/analytics/regressions.py +723 -0
  19. assayinganomalies-0.9.0/src/assayinganomalies/analytics/res_to_print.py +1613 -0
  20. assayinganomalies-0.9.0/src/assayinganomalies/analytics/results.py +5987 -0
  21. assayinganomalies-0.9.0/src/assayinganomalies/analytics/sorts.py +2918 -0
  22. assayinganomalies-0.9.0/src/assayinganomalies/analytics/subsamples.py +80 -0
  23. assayinganomalies-0.9.0/src/assayinganomalies/cli.py +800 -0
  24. assayinganomalies-0.9.0/src/assayinganomalies/client.py +48 -0
  25. assayinganomalies-0.9.0/src/assayinganomalies/compustat_extras.py +390 -0
  26. assayinganomalies-0.9.0/src/assayinganomalies/config.py +1073 -0
  27. assayinganomalies-0.9.0/src/assayinganomalies/data_access.py +603 -0
  28. assayinganomalies-0.9.0/src/assayinganomalies/db/__init__.py +9 -0
  29. assayinganomalies-0.9.0/src/assayinganomalies/db/cache.py +38 -0
  30. assayinganomalies-0.9.0/src/assayinganomalies/db/manager.py +47 -0
  31. assayinganomalies-0.9.0/src/assayinganomalies/db/migrations.py +62 -0
  32. assayinganomalies-0.9.0/src/assayinganomalies/db/reader.py +123 -0
  33. assayinganomalies-0.9.0/src/assayinganomalies/db/writer.py +111 -0
  34. assayinganomalies-0.9.0/src/assayinganomalies/ingest/__init__.py +11 -0
  35. assayinganomalies-0.9.0/src/assayinganomalies/ingest/compustat.py +592 -0
  36. assayinganomalies-0.9.0/src/assayinganomalies/ingest/crsp.py +123 -0
  37. assayinganomalies-0.9.0/src/assayinganomalies/ingest/crsp_daily.py +616 -0
  38. assayinganomalies-0.9.0/src/assayinganomalies/ingest/crsp_source.py +935 -0
  39. assayinganomalies-0.9.0/src/assayinganomalies/ingest/cz_anomalies.py +1091 -0
  40. assayinganomalies-0.9.0/src/assayinganomalies/ingest/cz_release.py +651 -0
  41. assayinganomalies-0.9.0/src/assayinganomalies/ingest/data/compustat_variables.csv +83 -0
  42. assayinganomalies-0.9.0/src/assayinganomalies/ingest/ff_factors.py +136 -0
  43. assayinganomalies-0.9.0/src/assayinganomalies/ingest/gibbs.py +268 -0
  44. assayinganomalies-0.9.0/src/assayinganomalies/ingest/ken_french.py +77 -0
  45. assayinganomalies-0.9.0/src/assayinganomalies/ingest/sample_end.py +147 -0
  46. assayinganomalies-0.9.0/src/assayinganomalies/ingest/wrds_client.py +401 -0
  47. assayinganomalies-0.9.0/src/assayinganomalies/logging_utils.py +40 -0
  48. assayinganomalies-0.9.0/src/assayinganomalies/ops.py +26 -0
  49. assayinganomalies-0.9.0/src/assayinganomalies/pipeline.py +3557 -0
  50. assayinganomalies-0.9.0/src/assayinganomalies/plotting.py +96 -0
  51. assayinganomalies-0.9.0/src/assayinganomalies/provenance.py +305 -0
  52. assayinganomalies-0.9.0/src/assayinganomalies/py.typed +2 -0
  53. assayinganomalies-0.9.0/src/assayinganomalies/reporting/__init__.py +56 -0
  54. assayinganomalies-0.9.0/src/assayinganomalies/reporting/bib/newSignalTestBib.bib +136 -0
  55. assayinganomalies-0.9.0/src/assayinganomalies/reporting/figures.py +865 -0
  56. assayinganomalies-0.9.0/src/assayinganomalies/reporting/latex.py +1723 -0
  57. assayinganomalies-0.9.0/src/assayinganomalies/reporting/tables.py +1129 -0
  58. assayinganomalies-0.9.0/src/assayinganomalies/run_manifest.py +749 -0
  59. assayinganomalies-0.9.0/src/assayinganomalies/session_cache.py +312 -0
  60. assayinganomalies-0.9.0/src/assayinganomalies/signal_io.py +339 -0
  61. assayinganomalies-0.9.0/src/assayinganomalies/signal_tester.py +47 -0
  62. assayinganomalies-0.9.0/src/assayinganomalies/stage_registry.py +360 -0
  63. assayinganomalies-0.9.0/src/assayinganomalies/tiebreak.py +36 -0
  64. assayinganomalies-0.9.0/src/assayinganomalies/transforms/__init__.py +20 -0
  65. assayinganomalies-0.9.0/src/assayinganomalies/transforms/anomaly_fill.py +141 -0
  66. assayinganomalies-0.9.0/src/assayinganomalies/transforms/betas.py +1283 -0
  67. assayinganomalies-0.9.0/src/assayinganomalies/transforms/compustat.py +1719 -0
  68. assayinganomalies-0.9.0/src/assayinganomalies/transforms/crsp_daily.py +1221 -0
  69. assayinganomalies-0.9.0/src/assayinganomalies/transforms/crsp_monthly.py +1118 -0
  70. assayinganomalies-0.9.0/src/assayinganomalies/transforms/nmv_anomalies.py +842 -0
  71. assayinganomalies-0.9.0/src/assayinganomalies/transforms/tcosts.py +1880 -0
  72. assayinganomalies-0.9.0/src/assayinganomalies.egg-info/PKG-INFO +596 -0
  73. assayinganomalies-0.9.0/src/assayinganomalies.egg-info/SOURCES.txt +75 -0
  74. assayinganomalies-0.9.0/src/assayinganomalies.egg-info/dependency_links.txt +1 -0
  75. assayinganomalies-0.9.0/src/assayinganomalies.egg-info/entry_points.txt +2 -0
  76. assayinganomalies-0.9.0/src/assayinganomalies.egg-info/requires.txt +18 -0
  77. assayinganomalies-0.9.0/src/assayinganomalies.egg-info/top_level.txt +1 -0
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.9.0]
8
+
9
+ First release of the Python package. It replaces the MATLAB AssayingAnomalies
10
+ toolkit, which stays available, unmaintained, on the repository's
11
+ `matlab-legacy` branch.
12
+
13
+ Version numbers start at 0.9.0, the version the paper's revision was run on.
14
+ Fixes are 0.9.x. The releases numbered 0.1 to 2.0.6 that PyPI lists under the
15
+ same name (2024) are an earlier, unrelated Python implementation; they are
16
+ withdrawn, and their numbers say nothing about this package. The installed
17
+ version is `assayinganomalies.__version__` and `aa --version`; database builds
18
+ and protocol runs record it in their manifests, and the report prints it in
19
+ its first footnote.
20
+
21
+ ### What the package contains
22
+
23
+ - A database build from your own WRDS account into one DuckDB file
24
+ (`aa setup-database`): CRSP monthly and daily, Compustat annual and
25
+ quarterly, the Fama-French factors, the Chen-Zimmerman anomaly zoo, trading
26
+ costs and betas.
27
+ - Univariate and bivariate portfolio sorts, factor regressions, Fama-MacBeth
28
+ regressions, trading costs and generalized alphas, as public functions.
29
+ - The anomaly-testing protocol of Novy-Marx and Velikov, "Assaying Anomalies",
30
+ with its LaTeX/PDF report (`aa run-protocol`, `aa.test_signal`).
31
+ - A JSON run manifest for every database build and protocol run: package
32
+ version, data vintage, sample, input hashes and seeds.
33
+
34
+ ### Differences from the MATLAB toolkit
35
+
36
+ Results are deliberately not identical to MATLAB's.
37
+
38
+ - **Held legs.** A sort buys each portfolio in a month in which the signal has
39
+ values and holds it, without rebalancing, until the next such month. Trading
40
+ costs are those of the trades this takes, and the first purchase is reported
41
+ separately and not charged. The Fama-French factor costs are computed the
42
+ same way.
43
+ - **Annual Compustat columns are stored in the June they become available
44
+ only**, so a signal built from them trades once a year. `aa.fill_months` and
45
+ `aa.load(..., fill_annual=True)` carry the June value through the following
46
+ May.
47
+ - **CRSP's CIZ format (Flat File Format 2.0) is the default.** The legacy SIZ
48
+ format, which ends in December 2024, can still be selected; the two give
49
+ slightly different numbers.
50
+ - **Chen-Zimmerman files come from Hugging Face**, for any release from
51
+ 2022.03 to 2026.10; pin a release to reproduce a zoo.
52
+ - **Randomness is seeded**: tie-breaking noise and cross-validation folds are
53
+ reproducible, and the seed is part of the specification of a result.
54
+ - **Bugs in the MATLAB code are corrected**, among them trading-cost inputs
55
+ that dropped NASDAQ spreads for part of the sample, a ranking step that ran
56
+ within stock instead of across stocks, and errors in report tables and
57
+ figure labels.
58
+
59
+ The README has the quickstart and the known limitations. The tutorial will be
60
+ on [assayinganomalies.com](https://assayinganomalies.com).
61
+
62
+ [0.9.0]: https://github.com/velikov-mihail/AssayingAnomalies/releases/tag/v0.9.0
@@ -0,0 +1,46 @@
1
+ cff-version: 1.2.0
2
+ message: >-
3
+ If you use this software, please cite the paper below (preferred citation)
4
+ and the software itself.
5
+ title: AssayingAnomalies
6
+ type: software
7
+ version: 0.9.0
8
+ license: MIT
9
+ repository-code: "https://github.com/velikov-mihail/AssayingAnomalies"
10
+ url: "https://assayinganomalies.com"
11
+ abstract: >-
12
+ Python toolkit for building a CRSP/Compustat research database from WRDS and
13
+ testing cross-sectional return anomalies: portfolio sorts, Fama-MacBeth
14
+ regressions, trading-cost-adjusted performance and the full anomaly-testing
15
+ protocol of Novy-Marx and Velikov.
16
+ keywords:
17
+ - asset pricing
18
+ - anomalies
19
+ - cross-section of stock returns
20
+ - portfolio sorts
21
+ - Fama-MacBeth
22
+ - transaction costs
23
+ - CRSP
24
+ - Compustat
25
+ authors:
26
+ - family-names: Velikov
27
+ given-names: Mihail
28
+ affiliation: Pennsylvania State University
29
+ - family-names: Novy-Marx
30
+ given-names: Robert
31
+ affiliation: University of Rochester
32
+ contact:
33
+ - name: Assaying Anomalies
34
+ email: assayinganomalies@gmail.com
35
+ preferred-citation:
36
+ type: article
37
+ title: Assaying Anomalies
38
+ authors:
39
+ - family-names: Novy-Marx
40
+ given-names: Robert
41
+ - family-names: Velikov
42
+ given-names: Mihail
43
+ year: 2026
44
+ journal: SSRN Working Paper
45
+ doi: 10.2139/ssrn.4338007
46
+ url: "https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4338007"
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Robert Novy-Marx and Mihail Velikov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
@@ -0,0 +1,4 @@
1
+ # Extra files for the sdist.
2
+ include CHANGELOG.md
3
+ include CITATION.cff
4
+ prune tests