Changelog

This changelog is generated automatically from GitHub Releases.

v1.0.0

2026-10-26 · GitHub

v1.0.0 (2026-10-26)

  • Changed (missing breakpoint_options_main): compute_portfolio_returns() now raises ValueError: breakpoint_options_main must be provided. when the argument is missing, as portfolio_sort_options() already did. The argument follows arguments with defaults and therefore has a None default, although it is required; before, a missing value failed later in compute_breakpoints() with a message that did not name it.
  • Changed (empty portfolio panel): the message of compute_portfolio_returns() for an empty panel now names the cause, a missing sorting value in every row, instead of citing insufficient observations.
  • Documented (first-of-month dates): the help of add_lagged_columns() and join_lagged_values() states that lags in whole months or years require first-of-month dates, as returned by download_data(), and how to truncate other dates.
  • Docs (README): the README follows the R package: the same sections and examples, plus the Damodaran download and the factor library tools, corrected dataset names and links, and the Python-only backend, index constituents, and FISD examples.
  • Dependencies (lock file): uv.lock updates certifi, pillow, and nbconvert to releases without known security vulnerabilities. This affects only the development and documentation environments; installing the package resolves its dependencies independently of the lock file.

v0.9.0

2026-10-26 · GitHub

v0.9.0 (2026-10-26)

  • Breaking (default backend is polars): the public API now returns polars data frames by default, as announced and as used throughout the book. Call tf.set_backend("pandas") once after importing the package to keep receiving pandas data frames. Pandas input is still accepted under either backend.

  • Breaking (pandas is optional): pandas is no longer a direct dependency. Install the pandas extra (pip install "tidyfinance[pandas]") to use the pandas backend; without pandas, set_backend("pandas") raises an ImportError that says so.

  • Changed (quantiles as in R): breakpoints (compute_breakpoints()), the min_size_quantile cutoff of filter_sorting_data(), the minimum market cap of breakpoints_min_size_threshold, the cap of ret_excess_vw_capped, winsorize(), and trim() now compute quantiles exactly as R’s quantile(). numpy and polars use the same definition but interpolate with different floating-point arithmetic, so when a quantile fell on an observation, the two packages could differ in the last bit and place that stock on different sides of a breakpoint or cutoff. A comparison of both packages on the same data found such a stock on 4 of 120 formation dates of a momentum sort.

  • Added (staggered portfolios): compute_portfolio_returns() and implement_portfolio_sort() gain holding_period and skip for staggered rebalancing, as in Jegadeesh and Titman (1993): portfolios are formed every period, each cohort is held for holding_period periods starting skip periods after formation, and the return of a portfolio is the equal-weighted average of the cohorts held in a period. A stock stays in its cohort for the whole holding period, even if its sorting variables are missing or it fails a screen later; with implement_portfolio_sort(), the screens of filter_options() decide only which stocks enter the cohort formed in a period (timing="every_period" removes failing rows with a warning). The capped weights of held stocks use the cap of the formation universe on each date, computed without stocks whose mktcap_lag is missing. Both arguments sit after rebalancing_month, as in R, and cannot be combined with it. This follows r-tidyfinance [#324](https://github.com/tidy-finance/py-tidyfinance/issues/324).

  • Breaking (screens at formation): with annual rebalancing (rebalancing_month), implement_portfolio_sort() and filter_sorting_data() now apply the screens of filter_options() in the formation month only and keep every stock that passes them for the whole holding period (ex-ante screens). Before, the screens were applied in every month, so a stock that, e.g., fell below the price screen after formation lost its holding-month returns, which can bias factor returns. The previous behaviour is available with filter_options(timing="every_period") and issues a warning. filter_sorting_data() gains a rebalancing_month argument. Without rebalancing_month, nothing changes. This follows r-tidyfinance [#321](https://github.com/tidy-finance/py-tidyfinance/issues/321).

  • Breaking (capped value weights): the capped value-weighted returns of compute_portfolio_returns() and implement_portfolio_sort() (ret_excess_vw_capped) now cap market capitalization at the cap_weight percentile of NYSE stocks on each date, following Jensen, Kelly, and Pedersen (2023), instead of the percentile of all stocks. The new cap_weight_exchanges argument selects the exchanges; cap_weight_exchanges=None restores the previous behaviour. Without an exchange column, or on dates without NYSE stocks, the cap falls back to all stocks with a warning. This follows r-tidyfinance [#319](https://github.com/tidy-finance/py-tidyfinance/issues/319).

  • Breaking (dependent sorts with a size threshold): in dependent bivariate sorts, breakpoints_min_size_threshold of the main breakpoints is now applied with one minimum market cap per date, computed from the full cross-section, instead of a separate one within each secondary portfolio. Before, e.g., excluding the smallest 20% of NYSE stocks from the asset-growth breakpoints within size halves excluded the smallest 20% of each half. This applies to the default compute_breakpoints(); custom breakpoint functions receive their options unchanged. This follows r-tidyfinance [#319](https://github.com/tidy-finance/py-tidyfinance/issues/319).

  • Fixed (Fama-French timing): ff_adjustment=True in add_lagged_columns() and join_lagged_values() now implements the Fama and French (1993) timing: the last observation per identifier and calendar year (the fiscal year-end) is used from July of the following year through June of the year after that, whatever the month of the fiscal year-end. Previously, it only kept the last observation per year and then applied the lag window, so the value took effect in a month that depended on the fiscal year-end and the lags instead of in July. The lag arguments, lag and max_lag in add_lagged_columns() and min_lag and max_lag in join_lagged_values(), are now optional: they are required without ff_adjustment and ignored with a message with ff_adjustment=True. Combine with drop_na=True in add_lagged_columns() when the accounting columns of a monthly panel are only filled at fiscal year-ends. This follows r-tidyfinance [#323](https://github.com/tidy-finance/py-tidyfinance/issues/323).

  • Fixed (CRSP v2 delisting returns): download_data("WRDS", "crsp_monthly" / "crsp_daily") with version="v2" (the default) now keeps the month and the day that carry a stock’s delisting return. CIZ includes the delisting return in mthret and dlyret, but stksecurityinfohist holds no active record after a stock’s last trading day, so the common-stock screens were evaluated at month end (or on the delisting day) and dropped these observations. Their security information is now looked up on the last trading day (securityenddt). The docstring documents how delisting returns enter v1 and v2. This follows r-tidyfinance [#320](https://github.com/tidy-finance/py-tidyfinance/issues/320).

  • Added (Damodaran): a "Damodaran" domain for download_data() that downloads the cost of capital (WACC) by industry from Aswath Damodaran’s data library, e.g. download_data("Damodaran", "wacc"). region selects the US (default), Europe, Japan, emerging markets, global, China, India, or Australia, New Zealand, and Canada ("rest"), and year reads archived years (from 1998 for the US) into a panel. Reading the Excel files requires the optional fastexcel package, available as the new extra pip install tidyfinance[excel]. This follows r-tidyfinance [#298](https://github.com/tidy-finance/py-tidyfinance/issues/298).

  • Added (WRDS progress): WRDS downloads report their progress. get_wrds_connection() says when it connects (with a reminder to approve the Duo request) and when the connection succeeds or fails. CRSP monthly, Compustat, CCM links, FISD, and TRACE downloads say when the download starts and, when it ends, how long it took; daily CRSP shows its batch progress in one line that is updated in place and cleared at the end, instead of printing a line per batch. get_wrds_connection() and all WRDS download functions gain quiet=False to suppress these messages, which can also be passed through download_data(). download_data("Pseudo Data", ...) accepts quiet too and then omits its notice, so the same call works for both domains. Messages go to standard error. This follows r-tidyfinance [#326](https://github.com/tidy-finance/py-tidyfinance/issues/326).

  • Fixed (factor library download): download_data("Tidy Finance", "factor_library", ...) reads the factor library again. The files released on 2026-10-20 are written with nanoparquet, which stores ret in single precision but declares it as double in the embedded Arrow schema. The native polars reader takes the type from that schema and failed on the mismatch. Parquet files from Hugging Face are now read through pyarrow (polars.read_parquet(..., use_pyarrow=True)), which reads the stored type; the data on Hugging Face are unchanged. A downloaded file that cannot be parsed now raises right away instead of being downloaded again five times and reported as a download failure.

  • Breaking (default price column): the default price column of data_options() is now prc_lag, the nominal price at the end of the previous month, instead of prc_adj, which the default CRSP v2 download does not return, so the min_stock_price screen failed on downloaded data. download_data("WRDS", "crsp_monthly") (v1 and v2) and the pseudo CRSP data now return prc_lag. In v1, it is the absolute value of altprc, with zero prices set to missing; in v2, it is the previous month’s prc. Pass data_options(price="prc_adj") to keep the previous behaviour. This follows r-tidyfinance [#321](https://github.com/tidy-finance/py-tidyfinance/issues/321).

  • Fixed (WRDS connection errors): get_wrds_connection(), and thus every WRDS download, now explains a failed connection: it raises a ConnectionError that lists the likely causes (wrong credentials, missing two-factor authentication, terms of use not accepted) and keeps the original error as the cause, with the username and password replaced by placeholders. The docstrings of get_wrds_connection() and set_wrds_credentials() and the README document what a WRDS account needs before the first connection. This follows r-tidyfinance [#325](https://github.com/tidy-finance/py-tidyfinance/issues/325).

  • Fixed (Open Source Asset Pricing): download_data("Open Source Asset Pricing") no longer parses the HTML page that Google Drive returns instead of the data, e.g., when the download quota of the file is exceeded. It now returns an empty data frame with a warning that says why, instead of a data frame whose column names are fragments of the page.

  • Changed (Open Source Asset Pricing): the default sheet_id is now the October 2025 release (v2.0.0) of the long-short returns instead of the August 2024 release (v1.4.0).

  • Fixed (factor library grid): the grid of the factor library is now downloaded once per Python session and cached in memory, so download_data("Tidy Finance", "factor_library", ...) and download_data("Tidy Finance", "factor_library_grid") no longer download the grid of more than four million rows on every call. Use download_data("Tidy Finance", "factor_library_grid", refresh=True) to download it again. A failed download is not cached.

  • Changed (legacy dataset warning): passing a legacy identifier as dataset, such as "factors_ff_3_monthly", "wrds_crsp_monthly", "macro_predictors_monthly", or "hf_factor_library", now warns that this value is deprecated and names the dataset that replaces it, e.g. dataset='factors_ff_3_monthly' is deprecated. Use dataset='Fama/French 3 Factors' instead. The warnings previously gave a generic example instead of the replacement for the value passed.

  • Breaking (trim()): trim() now sets the values beyond the cut quantiles to NaN and keeps the length of the input, as in R, instead of dropping them, so the result can be assigned back to a column.

  • Breaking (create_summary_statistics()): missing values now propagate as in R: unless drop_na=True, a variable with missing values gets missing statistics, while n still counts its non-missing values. drop_na=True drops missing values per variable (and observations with a missing by group) instead of dropping rows with a missing value in any variable. The variable column now comes before the by column, and the quantiles use the package’s exact quantile.

  • Breaking (estimate_betas()): id_col is replaced by data_options, whose id and date elements name the identifier and date columns, as in R. A variable named intercept in model now raises an error, and a lookback shorter than the number of regressors warns.

  • Fixed (compute_long_short_returns()): an unknown direction now raises an error instead of silently computing top minus bottom. The function reads the return columns that compute_portfolio_returns() produces, so the same custom data_options can be passed to both functions, and data without any return column raises an informative error.

  • Added (option typos): breakpoint_options(), filter_options(), and data_options() warn when an extra option is within one edit of a known option name (e.g. exclude_finacials). The option is still kept.

  • Fixed (Stambaugh-Yuan): download_data("Stambaugh-Yuan", ...) returned an empty frame because the default URL no longer exists. Both Stambaugh data files (mispricing and liquidity factors) are now read from the URLs of the R package.

  • Fixed (index constituents): download_data("Index Constituents", ...) reads Nasdaq 100, FTSE 100, and MSCI World from the Swiss professional pages of iShares, since the German retail pages were removed, and adds MDAX, TecDAX, STOXX Europe 600, MSCI Emerging Markets, MSCI Europe, MSCI ACWI, and S&P SmallCap 600, matching R.

  • Added (factor library costs and persistence): download_data("Tidy Finance", "factor_library_costs", ...) downloads the turnover, the trading cost, and the microcap share of each portfolio, with the same filters and ids as "factor_library". "factor_library_persistence" downloads how up to date each sorting variable is under each lag and rebalancing frequency, optionally for some sorting_variables only.

  • Added (factor library releases): revision pins the commit of the Hugging Face dataset tidy-finance/factor-library (returns and costs) and grid_revision that of tidy-finance/factor-library-grid (grid and persistence); both default to "main". The grid is cached once per revision, and a revision that does not exist fails with a clear message.

  • Added (factor library rate limit): the factor library downloads up to 16 files at once and 8 per second on average, also across calls. Files that Hugging Face refuses with HTTP 429 are downloaded again after the limit resets, twice at most, before the download fails with a message that explains the limit.

  • Added (download functions): the per-source download functions are now public under the names of the R package, e.g. download_data_fred(), download_data_jkp(), download_data_wrds_crsp(), download_data_pseudo_crsp(), download_factor_library_grid(), download_factor_library_ids(), and get_available_huggingface_files(). download_data() remains the main entry point. list_supported_types() is added as a deprecated alias of list_supported_datasets().

  • Documented (pseudo data): the pseudo data use numpy’s random generator, so the values for a given seed differ from those of the R package; the schema and the distributions are the same.

  • Fixed (missing returns in portfolio sorts): a stock with a missing return now makes the return of its portfolio missing in compute_portfolio_returns() and implement_portfolio_sort(), as in R. Before, the missing return entered the equal- and value-weighted averages as zero. In bivariate sorts, a cell with a missing return drops out of the average across the secondary portfolios. The message about missing portfolio returns now names a missing stock return as a cause.

  • Changed (integer portfolios): assign_portfolio() returns an Int64 series, and the portfolio column of compute_portfolio_returns() and implement_portfolio_sort() is Int64, matching the integer portfolios of R. Before, both were Float64.

  • Changed (overwritten columns): functions that create a column that already exists in the input now warn and overwrite it, as in R, instead of raising an error. This covers the portfolio columns and mktcap_lag_capped of compute_portfolio_returns() and the temporary columns of add_lagged_columns(), join_lagged_values(), filter_sorting_data(), compute_long_short_returns(), and implement_portfolio_sort(). Lagged columns that already exist still raise an error, as in R.

  • Fixed (Goyal-Welch rp_div): download_data("Goyal-Welch", ...) now computes rp_div as the future excess market return defined in the chapter Accessing and Managing Financial Data: next period’s log return of the index with dividends minus next period’s log risk-free rate, log(1 + Rfree). Before, it subtracted the simple risk-free rate of the current period. This follows r-tidyfinance [#350](https://github.com/tidy-finance/py-tidyfinance/issues/350).

  • Changed (website chapters): list_tidy_finance_chapters() and open_tidy_finance_website() follow the new tidy-finance.org, which shows the R and the Python code of each chapter side by side: the chapters are those of the website, in its order (adding the-tidyfinance-package and colophon, renaming clean-enhanced-trace-with-r to clean-enhanced-trace, and dropping changelog), and the pages open at https://www.tidy-finance.org/chapters/ instead of /python/. This follows r-tidyfinance [#349](https://github.com/tidy-finance/py-tidyfinance/issues/349).

  • Fixed (Fama-French breakpoints): download_data("Fama-French", ...) reads all eight breakpoint datasets. "Prior (2-12) Return Breakpoints" returned an empty frame because its file was parsed with the <=0/>0 columns of the ratio files instead of count, and the files without a header row (ME, Operating Profitability, Investment, and Prior (2-12)) lost their first observations (one, or three for Prior (2-12)). This follows r-tidyfinance [#347](https://github.com/tidy-finance/py-tidyfinance/issues/347).

  • Breaking (date_col): add_lagged_columns(), join_lagged_values(), and estimate_fama_macbeth() no longer take date_col. As in R, the date column is set with data_options, e.g. data_options=data_options(date="month").

  • Breaking (download_data_constituents()): the function takes only index and path, as in R. The dataset alias and the silently ignored **kwargs are removed, and download_data("Index Constituents", ...) passes only its extra keyword arguments, e.g. download_data("Index Constituents", index="DAX").

  • Breaking (disconnect_connection()): the argument is named con, as in R, instead of connection.

  • Breaking (implement_portfolio_sort()): portfolio_sort_options follows rebalancing_month, holding_period, and skip, as in R. It is still required; calls that passed it as the fourth positional argument have to name it. breakpoint_function of assign_portfolio() and breakpoint_function_main and breakpoint_function_secondary of compute_portfolio_returns() and implement_portfolio_sort() default to compute_breakpoints, as in R, instead of None.

  • Changed (create_summary_statistics()): the variables are passed as separate arguments, like ... in R, e.g. create_summary_statistics(data, "ret", "size", by="group"). A single list of names still works.

  • Changed (CCM link defaults): linktype and linkprim of download_data_wrds_ccm_links() and download_data_pseudo_ccm_links() default to ("LU", "LC") and ("P", "C"), as in R. The pseudo version took None before; both accept lists and tuples.

  • Breaking (internal helpers): get_available_famafrench_datasets(), load_wrds_credentials(), and process_trace_data() are no longer part of the public API, which now matches the exports of the R package. download_data_wrds_trace_enhanced() still cleans the TRACE data, and list_supported_datasets(domain="Fama-French") lists the Fama-French datasets.

  • Breaking (disconnect_connection() errors): an error raised when closing the connection now propagates, as in R, instead of being swallowed with a return value of False. The function returns True once the connection is closed. Daily CRSP downloads still close the connection after a failed query, without a failing close replacing the error of the download.

v0.5.3

2026-10-05 · GitHub

v0.5.3 (2026-10-05)

  • Fixed (index constituents): download_data("Index Constituents", ...) works again for DAX, EURO STOXX 50, Dow Jones Industrial Average, S&P 500, Nasdaq 100, FTSE 100, and MSCI World. iShares removed the German retail pages the holdings files were downloaded from; they are now read from the Swiss professional pages. The header row of a holdings file is detected automatically instead of skipping a fixed number of rows (#80).
  • Added (index constituents fallback): a new path argument reads an iShares or BlackRock holdings CSV saved from the fund’s web page instead of downloading it, e.g. download_data("Index Constituents", path="holdings.csv"). index is optional with path. When a download fails, the error message now names the URL and points to path (#80).

v0.5.2

2026-10-01 · GitHub

v0.5.2 (2026-10-01)

  • Fixed (Yahoo Finance dates): Stock price downloads now use the exchange’s local time zone, falling back to UTC when the metadata is missing or empty. This corrects previous-day dates for markets such as Australia and New Zealand. Requests include a two-day buffer and results are filtered to include both start_date and end_date, matching r-tidyfinance [#305](https://github.com/tidy-finance/py-tidyfinance/issues/305). An end date of today can include the current, still-forming daily bar.
  • Fixed (factor library layout): download_data("Tidy Finance", "factor_library", ...) reads the new layout of the factor library on Hugging Face, where the returns hold only id, date, and ret in files of 1,000 consecutive IDs named after their range (e.g., id_0000001-0001000.parquet). The file that holds each requested ID is computed from the ID, so only those files are downloaded, each once. Neither dataset is listed any more: the grid is read by name from portfolio_sort_grid.parquet, so it keeps working when the grid dataset gains more files. The result has the columns id, date, and ret followed by the grid columns; it no longer has a ret_type column, and the weighting scheme is in the weighting_scheme column of the grid. Returns are stored in single precision and returned as 64-bit floats. IDs without returns, whose portfolio sort produced no portfolios, are absent from the result with a warning. Version 0.5.1 cannot read the new layout. This follows r-tidyfinance [#306](https://github.com/tidy-finance/py-tidyfinance/issues/306).
  • Breaking (factor library sorting variables): The factor library now builds on the signals of Open Source Asset Pricing, so sorting variables carry their names, e.g. "size" instead of "me", "high52" instead of "52w", and "assetgrowth" instead of "ag". The grid covers 179 sorting variables and adds the "1m" lag, the "bivariate-dependent" and "bivariate-independent" sorting methods, and "capped VW" weighting. The examples and documented grid values follow the new release.

v0.5.1

2026-09-01 · GitHub

v0.5.1 (2026-09-01)

  • Fixed: Goyal-Welch (macro predictor) CSV parse no longer fails when the S&P Index column uses thousands separators (e.g. "1,049.34"). Rows after Polars’ default schema-inference window were previously dropped as an empty download.

v0.5.0

2026-08-05 · GitHub

v0.5.0 (2026-07-29)

  • Polars rewrite: the entire package is now implemented in polars. All module-level functions take and return polars.DataFrame objects, calendar-date columns are typed as polars.Date (matching the R package and the book), and the polars backend (set_backend("polars"), as used throughout the Tidy Finance book) is a zero-overhead pass-through. The public API and the default pandas backend are unchanged: pandas users keep receiving pandas frames, with conversion now happening at the package boundary (pandas in → polars internals → pandas out). polars moved from an optional extra to a core dependency.
  • Missing values are nulls: data frame outputs now represent missing values as polars nulls (surfacing as NaN/NaT after conversion under the pandas backend), instead of float NaN sentinels.
  • Breaking (create_summary_statistics): output columns now follow the R package naming — n, mean, sd, min, q50, max (plus q01…q99 with detail=True) — and grouped summaries return a tidy long table (one row per group × variable) instead of pandas MultiIndex columns.
  • Breaking (assign_portfolio): returns a polars.Series under the polars backend (a pandas.Series under the default pandas backend, as before).
  • Lag arguments accept polars duration strings: add_lagged_columns / join_lagged_values accept lags as polars offsets (e.g. "1mo", "1y2mo") in addition to ints (days), datetime.timedelta/pd.Timedelta, and calendar pd.DateOffset objects.
  • Internal SQL and HTTP readers now parse directly into polars (polars.read_database for WRDS, polars.read_csv/read_parquet on fetched bytes elsewhere).
  • Dependencies trimmed: dropped requests (unused since v0.2.2 — all HTTP goes through curl_cffi); replaced the dotenv wrapper package with its actual implementation python-dotenv; moved lxml to the new optional scraping extra (it only powers get_available_famafrench_datasets, which now raises a clear ImportError pointing at pip install tidyfinance[scraping] when lxml is absent). The polars extra is kept as a no-op for backward compatibility.
  • Breaking (estimate_betas), aligned with r-tidyfinance: coefficient columns are now named intercept and beta_<variable> (was Intercept and the bare variable name), and the identifier and date columns come first, so the output is <id>, date, intercept, beta_<variable>, ....
  • Deprecated (estimate_betas lookback), aligned with r-tidyfinance: lookback now accepts a duration string — "60mo", "30d", and the sub-day units "h", "m", "s" — which rolls over calendar periods exactly as R’s months(60) does. Observations falling in the same period are pooled, so the result has one row per identifier and period with date floored to the period start; for daily data a "3mo" window therefore yields a monthly beta series fitted on every observation in the trailing three months. Passing a plain integer keeps the previous positional window (a count of consecutive observations, one output row per input row) and now emits a DeprecationWarning. The two agree on a gap-free panel with one observation per period, so monthly examples are unaffected; they differ when a panel has holes.
  • Fix (estimate_betas default min_obs): the default is now round(0.8 * lookback) as in r-tidyfinance, rather than truncating. For lookback 6 this gives 5 instead of 4; lookback 60 is unchanged at 48.
  • Breaking (estimate_fama_macbeth), aligned with r-tidyfinance: the column order is now factor, risk_premium, n, standard_error, t_statistic (n moved from last to third), the intercept row is labelled intercept (was Intercept, and now matches estimate_model), and rows are returned in model-term order — the intercept first, then the regressors as they appear in the formula — instead of alphabetically.
  • Breaking (estimate_betas): duration lookbacks drop windows below min_obs instead of returning null rows.
  • Breaking (estimate_fama_macbeth): too-small date groups and unknown vcov_options keys raise; added data_options.
  • Breaking (compute_rolling_value): callbacks receive the active backend’s frame type.
  • Breaking (TRACE): pre-2012 messages restricted to trc_st = 'T'.
  • Breaking (FF breakpoints): column names are strings ("0-5"), not tuples.
  • Fixed: pd.DateOffset(n) day lags; Series index alignment (pandas backend); CRSP v1 ccm-link join; one-sided risk_free date ranges; NaN as missing in filter_sorting_data; WRDS numeric columns cast to float.

v0.4.0

2026-07-27 · GitHub

  • Polars backend returns WRDS date columns as Date (#66): WRDS calendar-date columns (datadate, trd_exctn_dt, CCM link dates, FISD dates) are now cast to polars.Date instead of polars.Datetime, matching the R package.
  • Added FRED-MD and FRED-QD macroeconomic databases: download_data("FRED", "FRED-MD" / "FRED-QD") download the McCracken and Ng (2016, 2021) macro panels. transform=True applies each series’ transform code; vintage enables point-in-time analysis.
  • Added Global Factor Data, Pastor-Stambaugh, and Stambaugh-Yuan downloads: download_data("Global Factor Data") downloads portfolios, industries, or cutoffs from Jensen, Kelly, and Pedersen (2023). download_data("Pastor-Stambaugh") and download_data("Stambaugh-Yuan") download the liquidity and mispricing factors.
  • OSAP download aligned with beginning-of-month and scaled returns: download_data("Open Source Asset Pricing") now uses beginning-of-month dates (was end-of-month) and decimal returns (divided by 100).
  • sorting_variable is now optional for factor_library: it returns the default construction for all sorting variables when omitted, and passing None for a filter column removes that filter.
  • Added detail parameter to estimate_fama_macbeth: detail=True returns coefficients plus summary statistics (mean r_squared, adj_r_squared, n_obs). Default unchanged.
  • Dependencies (replaced pyfixest with formulaic): dropped pyfixest for formulaic.

v0.3.0

2026-06-27 · GitHub

  • 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).

Version 0.1.1

2025-03-21 · GitHub

Initial PyPI release