Metadata-Version: 2.4
Name: fin-eda
Version: 1.0.0
Summary: Comprehensive financial Exploratory Data Analysis for price series and tickers
License: MIT License
        
        Copyright (c) 2026 JR
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/yourname/fin-eda
Project-URL: Bug Tracker, https://github.com/yourname/fin-eda/issues
Keywords: finance,eda,stocks,risk,portfolio,yfinance
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.3.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: yfinance>=0.2.0
Requires-Dist: rich>=12.0.0
Dynamic: license-file

# fin-eda

Comprehensive financial Exploratory Data Analysis for any stock ticker or price series.
Produces a rich, colour-coded tearsheet covering returns, risk, drawdowns, benchmark comparison, volatility, liquidity, and more — all in one call.

## Installation

```bash
pip install fin-eda
```

## Quick Start

```python
from fin_eda import eda

# Fetch data automatically via yfinance
eda("AAPL")

# Custom date range
eda("MSFT", start="2020-01-01", end="2024-01-01")

# Custom period
eda("TSLA", period="5y")

# Different benchmark
eda("QQQ", benchmark_ticker="SPY")

# Include a risk-free rate
eda("AAPL", risk_free_rate=0.05)

# Pass your own price series
import pandas as pd
prices = pd.Series(...)
eda(prices, benchmark_ticker="SPY")

# Return results as a dict (no print)
results = eda("AAPL", return_results=True, quiet=True)
```

## Output

The tearsheet is rendered in the terminal using [Rich](https://github.com/Textualize/rich) with colour-coded values (green = positive/good, yellow = neutral, red = negative/risk).

A header panel shows the current trend snapshot, followed by one table per section.

## Metrics Covered

| Section | Key Metrics |
|---|---|
| **Core Return & Risk** | Cumulative return, arithmetic & geometric mean, median, std dev, annualized volatility & variance — across 1M, 3M, 6M, 1Y, 3Y, 5Y, 10Y, YTD |
| **Risk-Adjusted Performance** | Sharpe ratio, Sortino ratio, downside deviation, semi-variance, profit factor — from 6M+ |
| **Drawdown & Capital Destruction** | Max drawdown, average drawdown, time to recovery, max consecutive loss days — from 3M+ |
| **Trend Structure & Price Health** | 50/100/200D moving averages, price vs 200D MA, golden/death cross spread, trend persistence, 52W high distance |
| **Relative Performance vs Benchmark** | Excess return, information ratio — from 6M+ |
| **Beta, Correlation & Market Dependence** | Beta, correlation vs benchmark — from 3M+ |
| **Capture Ratios** | Up-market and down-market capture (annualized) — from 6M+ |
| **Return Distribution & Non-Normality** | Skewness, kurtosis, Jarque-Bera statistic — from 3M+ |
| **Tail Risk & Stress** | Historical VaR (95% & 99%), Expected Shortfall/CVaR, worst daily/weekly/monthly return, extreme loss frequency |
| **Regime & Time-Series Behavior** | Return autocorrelation at 1D, 5D, 21D lags |
| **Volatility Metrics** | Parkinson volatility (21D/63D/126D), rolling vol percentile, volatility of volatility, current vs 1Y vol ratio |
| **Liquidity Metrics** | Average daily volume (30D/90D), volume trend, Amihud illiquidity ratio (30D/90D/full) |

## Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `ticker_or_prices` | `str` or `pd.Series` | — | Yahoo Finance ticker or a Series of close prices |
| `benchmark_ticker` | `str` | `'SPY'` | Benchmark symbol. Pass `None` to skip |
| `risk_free_rate` | `float` | `0.0` | Annual risk-free rate (e.g. `0.05` for 5%) |
| `period` | `str` | `'10y'` | yfinance history period (ignored if `start`/`end` provided) |
| `start` | `str` | `None` | Start date `YYYY-MM-DD` |
| `end` | `str` | `None` | End date `YYYY-MM-DD` |
| `return_results` | `bool` | `False` | Return the metrics dict instead of printing |
| `quiet` | `bool` | `False` | Suppress all printed output |

## Dependencies

- [pandas](https://pandas.pydata.org/)
- [numpy](https://numpy.org/)
- [scipy](https://scipy.org/)
- [yfinance](https://github.com/ranaroussi/yfinance)
- [rich](https://github.com/Textualize/rich)

## License

MIT
