ynouri/pysabr ? reverse-engineered prompt
Reverse engineered prompt
Build me a small Python package for the SABR volatility smile model, based on Hagan’s 2002 formulas.
I want the library to let me work with both shifted lognormal and normal vols, calibrate the main SABR parameters from market inputs, and compute basic Black style option prices too. It should be easy to use from Python with a clean high level interface, and also expose the lower level formulas directly for people who want them.
Please include a few examples or notebooks that show how to use it, especially a simple comparison between lognormal and normal SABR, and add tests so I can verify the calculations. If it makes sense, also include a tiny web API that can return a vol for given inputs and another endpoint that calibrates alpha from an ATM vol. Look up current docs online if you need to.
Are you gonna build this?
make sure you review the code using coderabbit