Skip to content

v0.8.6 - Adj Close column (yfinance-style)

Choose a tag to compare

@saidsurucu saidsurucu released this 17 Apr 21:22
· 11 commits to master since this release

New Features

  • Adjusted Close column (closes #12): Ticker.history() now accepts auto_adjust=True to include a yfinance-style Adj Close column. The column is computed by backward-applying each ex-dividend's (close - amount) / close factor to all prior closes, on top of the existing split adjustment. The result is a total-return price series — what you'd have if every dividend were reinvested on its ex-date.
import borsapy as bp
stock = bp.Ticker('THYAO')
df = stock.history(period='5y', auto_adjust=True)
df[['Close', 'Adj Close']].tail()

Parameter semantics

auto_adjust Close Adj Close
False (default) split-adjusted (unchanged) not present
True split-adjusted (unchanged) split + dividend adjusted

Default behaviour is unchanged — back-compat preserved.

Technical Changes

  • borsapy/ticker.py: new pure _compute_adj_close() helper + wiring in Ticker.history()
  • 10 new unit tests in tests/test_ticker.py covering empty frames, missing Amount column, zero/negative amounts, out-of-range dividends, multiple compounding ex-dates, tz-aware/naive index mismatches, and zero-close guards