markowitz.data_providers.factory¶
markowitz.data_providers.factory
¶
Factory that picks the right provider based on environment configuration.
:func:make_provider returns :class:PolygonProvider when a Polygon API key
is available (either passed in or read from POLYGON_API_KEY), and the
:class:YFinanceProvider adapter otherwise. The factory is the single
recommended entry point for callers that want to be agnostic about whether a
key is configured — the Streamlit demo and the universe builder both go
through it.
make_provider(api_key: str | None = None, *, inner_yfinance: Any = None) -> PolygonProvider | YFinanceProvider
¶
Return a Polygon provider if a key is configured, otherwise yfinance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
Explicit Polygon API key. When |
None
|
inner_yfinance
|
Any
|
Optional pre-built provider passed straight through to
:class: |
None
|