PyFENG: [Py]thon [F]inancial [ENG]ineering
PyFENG provides an implementation of the standard financial engineering models for derivative pricing.
Implemented Models
- Black-Scholes-Merton (BSM) and displaced BSM models:
- Analytic option price, Greeks, and implied volatility.
- Bachelier (Normal) model
- Analytic option price, Greeks, and implied volatility.
- Constant-elasticity-of-variance (CEV) model
- Analytic option price, Greeks, and implied volatility.
- Stochastic-alpha-beta-rho (SABR) model
- Hagan's BSM vol approximation.
- Choi & Wu's CEV vol approximation.
- Analytic integral for the normal SABR.
- Closed-form MC simulation for the normal SABR.
- Hyperbolic normal stochastic volatility (NSVh) model
- Analytic option pricing.
- Heston model
- FFT option pricing.
- Almost exact MC simulation by Glasserman & Kim and Choi & Kwok.
- Schobel-Zhu (OUSV) model
- FFT option pricing.
- Almost exact MC simulation by Choi
- Rough volatility models
- Rough Heston MC by Ma & Wu
About the Package
- Uses
numpyarrays as basic datatype so computations are naturally vectorized. - Purely Python without C/C++ extensisons.
- Implemented with Python class.
- Intended for academic use. By providing reference models, it saves researchers' time. See PyFENG for Papers in Related Projects below.
Installation
pip install pyfeng
For upgrade,
pip install pyfeng --upgrade
Code Snippets
In [1]:
import numpy as np
import pyfeng as pf
m = pf.Bsm(sigma=0.2, intr=0.05, divr=0.1)
m.price(strike=np.arange(80, 121, 10), spot=100, texp=1.2)
Out [1]:
array([15.71361973, 9.69250803, 5.52948546, 2.94558338, 1.48139131])
In [2]:
sigma = np.array([[0.2], [0.5]])
m = pf.Bsm(sigma, intr=0.05, divr=0.1) # sigma in axis=0
m.price(strike=np.array([90, 95, 100]), spot=100, texp=1.2, cp=np.array([-1,1,1]))
Out [2]:
array([[ 5.75927238, 7.38869609, 5.52948546],
[16.812035 , 18.83878533, 17.10541288]])
Author
- Prof. Jaehyuk Choi (Columbia University MAFN Program Director). Email: pyfe@eml.cc
Related Projects
- Commercial versions (implemented and optimized in C/C++) for some models are available. Email the author at pyfe@eml.cc.
- PyFENG for Papers is a collection of Jupyter notebooks that reproduce the results of financial engineering research papers using PyFENG.
- FER: Financial Engineering in R developed by the same author.
Not all models in
PyFENGare implemented inFER.FERis a subset ofPyFENG.
Metadata
Release files for pyfeng 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfeng-0.5.0.tar.gz | 301.7 kB | With provenance | Details for pyfeng-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfeng-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for pyfeng-0.5.0-py3-none-any.whl |
Total release size: 588.1 kB
Release files / pyfeng-0.5.0.tar.gz
| Download URL | pyfeng-0.5.0.tar.gz |
|---|---|
| Size | 301.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
867fc44a89a78fe5dfa8103bfcb519adab9d5c37fd466b6752bf8262a306333a
|
|
BLAKE2b-256 checksum How to use checksums |
92e9434a3c5c5b895706f9d8a1ddf456d6a413cc955caee8597f79fa9fb627da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logRelease files / pyfeng-0.5.0-py3-none-any.whl
| Download URL | pyfeng-0.5.0-py3-none-any.whl |
|---|---|
| Size | 286.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aba8055a9667c2e306560ec0d1ccce794c7a9aa8e65fd4271cdcb5521c7613c7
|
|
BLAKE2b-256 checksum How to use checksums |
9bab6c2f0d93a22acf168cbf9a0f2bd100c4caba554dcead963564e1dfa891f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logSecurity for pyfeng 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyfeng-0.5.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.