You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Dependencies (removed statsmodels): The statsmodels dependency was dropped; the regression-based functions now use pyfixest instead. estimate_model and the cross-sectional / IID-variance steps of estimate_fama_macbeth call pyfixest.feols, and estimate_betas was rewritten to estimate rolling betas via closed-form OLS on cumulative cross-product sums (the design Gram matrix X'X and moment vector X'y are accumulated and rolled by cumulative-sum differencing, then solved once per window). This follows the fast beta estimation approach, generalized to multiple regressors, and returns coefficients identical to ordinary least squares while avoiding a full refit per window (#49).
Docs (Great Docs): Added a Great Docs documentation site configured via great-docs.yml, including LLM-friendly artifacts (llms.txt, llms-full.txt). The API reference is generated from the numpydoc docstrings; build locally with great-docs build (on Windows set PYTHONUTF8=1 to avoid a cp1252 decode error during post-processing). The generated great-docs/ build directory is gitignored. (#29)
Breaking (Python version): The minimum supported Python is now 3.11 (was 3.10), as required by the Great Docs toolchain.
Docs (R parity): Fixed docstring discrepancies surfaced by the rendered reference, aligning the Python docs with r-tidyfinance: breakpoint_options (removed a duplicated breakpoints_exchanges entry and documented the previously undocumented breakpoints_min_size_threshold), create_summary_statistics (enumerated the reported statistics and detail quantiles), compute_portfolio_returns / implement_portfolio_sort (min_portfolio_size univariate/bivariate semantics and the "set to 0 to deactivate" behavior), estimate_betas (lookback annotated as int to match its use as an observation-count window), and winsorize (corrected the x type to np.ndarray and documented the [0, 0.5] range for cut).
Polars support: the public API can now work with polars data frames via a global backend. Call tidyfinance.set_backend("polars") (default "pandas"; get_backend() reports the current setting). When set to "polars", the data-bearing functions (download_data, the estimate_*/compute_* family, add_lagged_columns, assign_portfolio's frame inputs, list_supported_datasets, etc.) return polars data frames, and all of them also accept polars input regardless of the active backend (converted to pandas internally). DataFrame outputs convert; Series/dict/ndarray returns (e.g. assign_portfolio) are left as-is, and date indices are preserved as columns. Internals remain pandas-based for now. Requires the optional polars dependency (pip install tidyfinance[polars]) (#42).
Breaking (WRDS credentials): WRDS credentials are now read exclusively from environment variables (e.g. via a .env file). Support for config.yaml has been removed: set_wrds_credentials() now writes a .env file (with WRDS_USER and WRDS_PASSWORD), and get_wrds_connection() no longer accepts a config_path argument. The pyyaml dependency was dropped. Migrate any existing config.yaml credentials into a .env file or environment variables.
Breaking (CRSP): the monthly CRSP price column returned by download_data(domain="wrds", dataset="crsp_monthly") is now named prc (was altprc), aligning with r-tidyfinance and both book editions. The value is unchanged — it is mthprc from the CRSP v2 monthly stock file; altprc was the legacy (v1) column name and was semantically stale for v2 downloads. Update any downstream code that referenced altprc (including the dependent mktcap computation).
Fix (Fama-MacBeth Newey-West):estimate_fama_macbeth now matches R's sandwich::NeweyWest defaults, so the Python and R editions agree on Newey-West t-statistics. The previous implementation used statsmodels HAC with a fixed maxlags=6 and no prewhitening (textbook Newey-West 1987); the new numpy implementation uses VAR(1) prewhitening plus the automatic Newey & West (1994) bandwidth, Bartlett kernel, recoloring, and no finite-sample adjustment (verified against sandwich 3.1.1 to ~1e-13). vcov_options now mirrors R's interface (lag, prewhite, adjust) and defaults to None; the legacy maxlags key is accepted as a deprecated alias for lag (preserving the old no-prewhitening behavior) and emits a DeprecationWarning (#35).
Fix (CRSP column order):download_data(domain="wrds", dataset="crsp_monthly") now orders listing_age before mktcap to match r-tidyfinance's download_data_wrds_crsp() (..., siccd, listing_age, mktcap, mktcap_lag, ...). Values are unchanged; only the column order differed (#36).
Fix (TRACE regime cutoff):process_trace_data now uses the correct Dick-Nielsen (2014) enhanced-TRACE regime cutoff of 2012-02-06 (was the transposed 2012-06-02). Samples spanning Feb 6 – Jun 2, 2012 were previously cleaned under the wrong cancellation/correction/reversal regime, producing incorrect output; samples entirely after June 2012 were unaffected. This aligns the Python edition with r-tidyfinance's download_data_wrds_trace_enhanced() (#34).
download_data() now uses the human-readable domain names returned by list_supported_datasets() (e.g., "Fama-French", "Global Q", "WRDS", "Tidy Finance"). The "pseudo" and "tidyfinance" domains were renamed to "Pseudo Data" and "Tidy Finance". The previous machine-readable domain names (e.g., "famafrench", "wrds", "pseudo", "tidyfinance") are soft-deprecated but still accepted.
Breaking (package API): the dataset-specific _download_data_* helpers (e.g. _download_data_wrds, _download_data_macro_predictors, _download_data_constituents, _download_data_factors_ff, _download_data_factors_q, _download_data_osap, _download_data_risk_free, _download_data_stock_prices) are no longer re-exported from the package root. Public access continues via the dispatcher download_data(domain, dataset, ...). If you need a helper directly, import it from its defining module (e.g. from tidyfinance.data_download import _download_data_wrds).