markowitz.data_providers.yfinance¶
markowitz.data_providers.yfinance
¶
yfinance adapter that conforms to the same surface as :class:PolygonProvider.
The legacy :mod:markowitz.data.providers module already wraps yfinance for the
single-close column workflow used by the optimizer's Parquet cache. This
adapter delegates to it and reshapes the output into the TitleCase OHLCV frame
that the rest of :mod:markowitz.data_providers consumes, so a caller can
swap Polygon out for yfinance without changing downstream code.
Only :meth:get_eod is supported. :meth:get_ticker_meta and
:meth:get_grouped_daily have no equivalent in yfinance for our purposes
(no point-in-time index membership) and raise :class:PolygonError to make
that explicit at the call site.
YFinanceProvider(inner: Any = None)
¶
yfinance-backed provider matching :class:PolygonProvider's surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inner
|
Any
|
Optional pre-built provider exposing |
None
|
Source code in src/markowitz/data_providers/yfinance.py
get_eod(ticker: str, start: date, end: date) -> pd.DataFrame
¶
Return daily OHLCV via yfinance, normalized to TitleCase columns.
yfinance returns Open/High/Low/Close/Volume natively when called
through yf.download, but the legacy adapter in this repo collapses
the frame down to a single close column. We reconstruct the full
OHLCV view by re-querying yfinance directly when available, falling
back to a close-only frame (Open/High/Low filled with NaN, Volume with
0) when the inner provider doesn't expose it.