Metadata-Version: 2.1
Name: stockcheck-valuation
Version: 0.1.0
Summary: Lightweight, dependency-free tools for computing historical valuation percentiles (PE, PB, PS, dividend yield, ...) from a series of past values.
Author-email: StockCheck <hello@getstockcheck.com>
License: MIT
Project-URL: Homepage, https://www.getstockcheck.com
Project-URL: Documentation, https://www.getstockcheck.com
Keywords: valuation,pe-ratio,percentile,quant,investing,stock-screener
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# stockcheck-valuation

Small, dependency-free tools for answering one question:

> "Is this valuation metric (PE, PB, PS, dividend yield, ...) currently
> cheap or expensive **relative to its own history**?"

This is the same historical-percentile calculation behind most valuation
screeners and "cheap vs. its own history" dashboards, extracted into a
tiny standalone utility so you don't have to re-derive it every time you
want a quick answer.

Built by the team behind [StockCheck](https://www.getstockcheck.com),
a valuation and quant-factor screener for stocks across the A-share, HK,
and US markets.

## Install

```bash
pip install stockcheck-valuation
```

## Usage

### As a library

```python
from stockcheck_valuation import historical_percentile, rolling_percentile

# Where does a PE of 15 sit versus 5 years of trailing daily PE values?
pct = historical_percentile(current=15, history=historical_pe_values)
print(f"Current PE percentile: {pct:.1f}")

# Build a full time series of rolling percentiles for charting.
percentile_series = rolling_percentile(historical_pe_values, window=252 * 3)
```

### From the command line

```bash
stockcheck-valuation 15 --history "12,13,14,15,16,20,22,9,10"
# Current value 15.0 is at the 66.7th percentile of 9 historical observations.

stockcheck-valuation 15 --history-file pe_history.csv
```

## Why percentile instead of raw ratio?

A PE of 15 means very different things for a utility company and a growth
tech stock. Comparing today's ratio to the *same company's own trading
history* (or to its industry / market peers) gives a much more useful
signal than comparing raw ratios across unrelated businesses.

## License

MIT
