Metadata-Version: 2.5
Name: nlalpha-yfinance
Version: 0.1.1
Summary: Yahoo Finance daily data provider for NLAlpha
Project-URL: Homepage, https://github.com/ruimarj/nlalpha-yfinance
Project-URL: Repository, https://github.com/ruimarj/nlalpha-yfinance
Project-URL: Issues, https://github.com/ruimarj/nlalpha-yfinance/issues
License-Expression: AGPL-3.0-or-later
License-File: LICENSE
Requires-Python: <3.13,>=3.12
Requires-Dist: nlalpha-core>=0.7.0
Requires-Dist: nlalpha-data>=0.4.0
Requires-Dist: pandas<3,>=2.3
Requires-Dist: yfinance<2,>=1.7
Description-Content-Type: text/markdown

# nlalpha-yfinance

Yahoo Finance daily data provider for NLAlpha. The package implements the `DataProvider` contract from `nlalpha-data` and registers itself as the `yfinance` provider.

This is a best-effort convenience provider, not a production market-data service. It is not yet published to PyPI.

## Installation

Install the package and its runtime dependencies with your package manager:

```bash
pip install nlalpha-yfinance
```

For local development from this workspace, install the package in editable mode:

```bash
pip install -e .
```

The provider requires Python 3.12 and the `yfinance` and `pandas` libraries. The distribution must be installed (editable for development) because the plugin reads its version from distribution metadata.

## Discovery

The package exposes an entry point in the `nlalpha.data` group:

```toml
[project.entry-points."nlalpha.data"]
yfinance = "nlalpha_yfinance:YFinancePlugin"
```

`nlalpha-data` discovers the plugin through that entry point. The plugin reports availability from the `yfinance` import alone; it does not make a network request during discovery.

```python
from nlalpha_yfinance import YFinancePlugin

plugin = YFinancePlugin()
provider = plugin.get_provider()
bars = await provider.load_bars("AAPL", "1d", "2024-01-02", "2024-01-31")
```

## Capabilities

| Capability | Declaration |
|---|---|
| Asset classes | `stock`, `etf` |
| Daily intervals | `1d`, `d`, `day` |
| Price adjustment | `unadjusted`, `forward` |
| Backward adjustment | Unsupported |
| Reference data | None |
| Realism data | None |
| Calendars | `XNYS`, `XNAS` |
| Time semantics | `trading_date` |

Only daily bars are served. Requests for other intervals fail with an `unsupported_capability` error.

## Price adjustment semantics

An omitted `price_adjustment` means `unadjusted`.

| Request | Yahoo parameter | Semantics |
|---|---|---|
| `unadjusted` | `auto_adjust=False` | OHLC prices are split-adjusted but not dividend-adjusted. |
| `forward` | `auto_adjust=True` | OHLC prices are split- and dividend-adjusted, anchored at the last returned observation. |

Yahoo adjusts OHLC only. Volume is the share quantity reported by Yahoo and is not dividend-adjusted. `backward` adjustment is rejected because Yahoo does not provide a start-anchored series.

## Time contract

Each Yahoo daily row becomes a bar with `source_timestamp_semantics="trading_date"` and an explicit `session_date`. The canonical `datetime` is the exchange session close from the mapped NLAlpha calendar. The resolved `open_time` is the session open; both bounds come from the calendar session, so loaded bars satisfy NLAlpha's artifact delivery contract. The provider does not fabricate an intraday timestamp from the Yahoo index. The source timezone comes from Yahoo `exchangeTimezoneName` metadata, with `America/New_York` used only when that metadata is absent.

## Exchange mapping

| Yahoo exchange code | NLAlpha calendar |
|---|---|
| `NMS`, `NGM`, `NCM`, `NAS` | `XNAS` |
| `NYQ`, `NYS`, `PCX`, `ASE` | `XNYS` |

An unknown or missing exchange code fails with `unsupported_capability`; the provider never guesses a calendar.

## Limitations

The provider is daily only and best effort. It depends on Yahoo's public endpoints and may be rate-limited or blocked. There is no availability SLA and no cross-source reconciliation. `unadjusted` prices are split-adjusted rather than raw exchange prices. Minute bars, fundamentals, and backward adjustment are not supported.

## License

AGPL-3.0-or-later. See `LICENSE`.
