Metadata-Version: 2.4
Name: cedardev-equity-derivatives
Version: 0.5.0
Summary: Equity derivatives analytics in Python (FST solver, Heston, vol surfaces).
Project-URL: Homepage, https://github.com/cedardev-capital/cedardev-equity-derivatives
Project-URL: Repository, https://github.com/cedardev-capital/cedardev-equity-derivatives
Project-URL: Issues, https://github.com/cedardev-capital/cedardev-equity-derivatives/issues
Author: CedarDev Capital Management LLC
License: MIT
License-File: LICENSE
Keywords: derivatives,finance,fourier,fst,levy,options
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs; extra == 'docs'
Requires-Dist: mkdocs-material; extra == 'docs'
Provides-Extra: fft
Requires-Dist: pyfftw>=0.13; extra == 'fft'
Description-Content-Type: text/markdown

# cedardev-equity-derivatives

Equity derivatives analytics in Python.

**v0.5.0** — Track A buildout: Black-Scholes, Heston, Carr-Madan FFT pricer, analytic & numerical Greeks, implied vol, SVI smile calibration, market curves.
**v0.4.0** — Track B: Fourier Space Time-stepping (FST) solver — six Lévy models with European, American, and barrier pricers.

## Status

Companion to [`cedardev-fixed-income`](https://pypi.org/project/cedardev-fixed-income/).

| Track | Module | What's inside |
|------|--------|--------------|
| A | `cedardev.equity.models` | `BlackScholes`, `Heston` (with `char_function`) |
| A | `cedardev.equity.pricers` | `VanillaOption`, `CarrMadanPricer` |
| A | `cedardev.equity.greeks` | `bsm_greeks` (analytic), `numerical_greeks` (FD) |
| A | `cedardev.equity.vol` | `implied_vol`, `VolSurface`, `SVIParams` |
| A | `cedardev.equity.calibration` | `fit_svi_slice` |
| A | `cedardev.equity.market` | `DiscountCurve`, `DividendCurve`, `forward` |
| B | `cedardev.equity.solvers.fst` | 6 Lévy models, `FSTEuropean`, `FSTAmerican`, `FSTBarrier` |

## Installation

```bash
pip install cedardev-equity-derivatives
```

Optional extras:

```bash
pip install "cedardev-equity-derivatives[fft]"   # adds pyfftw
pip install "cedardev-equity-derivatives[dev]"   # pytest, ruff, mypy, build, twine
pip install "cedardev-equity-derivatives[docs]"  # mkdocs + mkdocs-material
```

## Quick start — Track A

### Black-Scholes with Greeks

```python
from cedardev.equity.models import BlackScholes
from cedardev.equity.pricers import VanillaOption
from cedardev.equity.greeks import bsm_greeks

m = BlackScholes(spot=100, r=0.03, q=0.01, sigma=0.20)
opt = VanillaOption(strike=100, expiry=1.0, option_type="call")
print(opt.price(m))                              # 8.8273
print(bsm_greeks(m, K=100, T=1.0, option_type="call"))
```

### Heston with Carr-Madan FFT

```python
from cedardev.equity.models import Heston
from cedardev.equity.pricers import VanillaOption

heston = Heston(spot=100, r=0.03, q=0.01,
                v0=0.04, kappa=2.0, theta=0.04, sigma_v=0.5, rho=-0.7)
print(VanillaOption(100, 1.0, "call").price(heston))   # 8.2535
print(heston.feller_satisfied())                       # False -> watch v
```

### Implied vol

```python
from cedardev.equity.vol import implied_vol

iv = implied_vol(market_price=12.50, spot=100, K=95,
                 r=0.03, q=0.01, T=1.0, option_type="call")
```

### SVI smile calibration

```python
import numpy as np
from cedardev.equity.calibration import fit_svi_slice
from cedardev.equity.vol import svi_implied_vol
from cedardev.equity.market import DiscountCurve, DividendCurve, forward

F = forward(100, 1.0, DiscountCurve(0.03), DividendCurve(0.01))
K  = np.array([60, 80, 100, 120, 140])
iv = np.array([0.32, 0.26, 0.22, 0.21, 0.23])

fit = fit_svi_slice(K, iv, T=1.0, forward=F)
fit_iv = svi_implied_vol(fit, np.log(K / F), T=1.0)
```

## Quick start — Track B (FST)

### European under Variance Gamma

```python
from cedardev.equity.solvers.fst import VarianceGamma, FSTEuropean

m = VarianceGamma(spot=100, r=0.03, q=0.01, sigma=0.2, nu=0.2, theta=-0.1)
print(FSTEuropean(m).price(100, 1.0, "call"))
```

### American put under Merton jump diffusion

```python
from cedardev.equity.solvers.fst import MertonJD, FSTAmerican

m = MertonJD(spot=100, r=0.05, q=0.0,
             sigma=0.15, lam=0.3, mu_j=-0.1, sigma_j=0.2)
am_put = FSTAmerican(m, n_grid=2 ** 13, n_time=300).price(100, 1.0, "put")
```

### Up-and-out call under Kou (continuously monitored)

```python
from cedardev.equity.solvers.fst import Kou, FSTBarrier

m = Kou(spot=100, r=0.03, q=0.01, sigma=0.15,
        lam=1.0, p=0.4, eta1=10.0, eta2=5.0)
uo = FSTBarrier(m, n_grid=2 ** 13, n_time=400) \
        .price(K=100, T=1.0, option_type="call",
               barrier=130, barrier_type="UO", monitoring="continuous")
```

## Lévy catalog (Track B)

| Model | Class | Parameters |
|------|-------|-----------|
| Black-Scholes-Merton | `BSMLevy` | `sigma` |
| Merton (1976) jump-diffusion | `MertonJD` | `sigma, lam, mu_j, sigma_j` |
| Kou (2002) double-exponential | `Kou` | `sigma, lam, p, eta1, eta2` |
| Variance Gamma | `VarianceGamma` | `sigma, nu, theta` |
| Normal Inverse Gaussian | `NIG` | `alpha, beta, delta` |
| CGMY | `CGMY` | `C, G, M, Y` |

All satisfy the risk-neutral martingale condition `psi(-i) = r - q`.

## Repository layout

```
cedardev-equity-derivatives/
├── cedardev/
│   └── equity/
│       ├── models/          # BlackScholes, Heston       (Track A)
│       ├── pricers/         # VanillaOption, CarrMadan   (Track A)
│       ├── vol/             # implied vol, surface, SVI  (Track A)
│       ├── calibration/     # SVI slice fit              (Track A)
│       ├── greeks/          # analytic + numerical       (Track A)
│       ├── market/          # DiscountCurve, etc.        (Track A)
│       ├── utils/           # BSM helper formulas        (Track A)
│       ├── risk/            # placeholder for future
│       └── solvers/
│           └── fst/         # FST + 6 Levy models        (Track B)
├── tests/
├── pyproject.toml
├── README.md
├── LICENSE
└── CHANGELOG.md
```

## Development

```bash
git clone https://github.com/cedardev-capital/cedardev-equity-derivatives.git
cd cedardev-equity-derivatives
pip install -e ".[dev]"
pytest                          # 98 tests
ruff check .
mypy cedardev
```

## Citation

```bibtex
@software{cedardev_equity_derivatives,
  author  = {CedarDev Capital Management LLC},
  title   = {cedardev-equity-derivatives: Equity Derivatives Analytics in Python},
  year    = {2026},
  url     = {https://github.com/cedardev-capital/cedardev-equity-derivatives}
}
```

## References

- Black, F., & Scholes, M. (1973). The Pricing of Options and Corporate Liabilities. JPE.
- Heston, S. (1993). A Closed-Form Solution for Options with Stochastic Volatility... RFS.
- Carr, P., & Madan, D. (1999). Option Valuation Using the Fast Fourier Transform. JCF.
- Albrecher, H., et al. (2007). The Little Heston Trap. Wilmott.
- Gatheral, J. (2004). A parsimonious arbitrage-free implied volatility parameterization (SVI).
- Surkov, V. (2009). *Option Pricing using Fourier Space Time-stepping Framework.* PhD thesis, U. Toronto. SSRN 1479738.

## License

MIT — see [LICENSE](LICENSE).

## Disclaimer

This library is provided for research, education, and infrastructure prototyping. It is **not** a production trading system and carries no warranty. Use at your own risk.
