Metadata-Version: 2.4
Name: qfwp
Version: 0.4.2
Summary: Companion package for 'Learning Quantitative Finance with Python' (CRC Press): real historical episodes (qfwp.data) and the Trone synthetic market (qfwp.synth).
Project-URL: Homepage, https://github.com/MarcosCarreira/qfwp
Author: Marcos Costa Santos Carreira
License: MIT
License-File: LICENSE
Keywords: market-data,quantitative-finance,synthetic-data,teaching,yield-curve
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.11
Requires-Dist: numpy>=2.0
Requires-Dist: pandas>=2.2
Requires-Dist: scipy>=1.14
Provides-Extra: plot
Requires-Dist: matplotlib>=3.9; extra == 'plot'
Provides-Extra: symbolic
Requires-Dist: sympy>=1.13; extra == 'symbolic'
Description-Content-Type: text/markdown

# qfwp — companion package

Companion code for *Learning Quantitative Finance with Python* (CRC Press).

```bash
uv add qfwp      # or: uv sync, to build .venv from pyproject.toml + uv.lock
```

```python
from qfwp import synth, data

mkt = synth.make_market(level=4)          # the full Trone market
mkt.prices.plot()                          # equities + TRN/USD
data.load("devaluation_1999")              # fetches BCB PTAX, caches locally
```

Two subpackages:

- `qfwp.data` — the real historical episodes (1994 Real Plan, 1999 devaluation,
  2008 GFC, 2011 EUR/SNB, 2014 elections). **Live**: loaders fetch on demand from
  official open-data services (BCB SGS, FRED, ECB) and cache to `$QFWP_CACHE`
  (default `~/.cache/qfwp`); set `QFWP_OFFLINE=1` to pin a build to the cache.
  No data is redistributed — each series rides under its source's terms, not the
  package's MIT licence. See `SOURCES.md`.
- `qfwp.synth` — the **Trone** synthetic market with a four-level complexity dial
  matching the book's four parts, **all four implemented**:
  - **1** (Basics) — one asset, Trone calendar, seven injectable data pathologies;
  - **2** (Derivatives) — rates curve + meetings, FX pair, vol surface with skew,
    option chains on the meeting cycle;
  - **3** (Statistics) — six-asset fat-tailed panel, calm/stress regime, t-copula
    tail dependence (correlations rise in stress);
  - **4** (Risk) — credit names with wrong-way spreads and a jump-to-default,
    liquidity (widening spreads, no-quote days), and the central-bank floor that
    holds for years then breaks.

  Levels are strict supersets and the dial design is in `SYNTH-DESIGN.md`.

`notebooks/discrete_hedging.ipynb` reproduces the Derman–Kamal discrete-hedging
result on the Trone market (see Chapter 8).

Everything is seeded and pinned (`uv.lock`), so the book's figures reproduce
exactly — same seed, same numbers, same chart, on any machine.
