Day 251 — The pricer, tested against two independent implementations

Wednesday, 14 April 2027 · Week 36 of 52 · Derivatives · Study day · 60 min

A pricer you wrote and only checked against itself is a pricer with an undiscovered sign error, and the libraries exist precisely so you do not have to trust your own algebra.

What you should be able to do tonight

  • Implement a Black-Scholes pricer with dividends and rates handled explicitly, and agree with py_vollib and QuantLib to a stated tolerance.
  • Implement implied volatility by root-finding and state where it fails.

Tasks 60 min

30 min Write qlib/derivatives/black_scholes.py with the call and put prices, handling a continuous dividend yield and a rate explicitly rather than defaulting them to zero. Test against py_vollib across a grid of strikes, maturities and volatilities, and assert agreement to a tolerance you state.

30 min Implement implied volatility by Newton’s method with a bisection fallback, and find where it fails: deep out-of-the-money options where vega is nearly zero, and prices that violate the no-arbitrage bounds. Handle both explicitly rather than returning a wrong number.

The running strategy

qlib/derivatives/black_scholes.py is the pricing layer for the rest of the phase, tested against an independent implementation and with implied volatility inversion that fails loudly rather than silently.

Resources

Deliverable

A tested Black-Scholes pricer agreeing with py_vollib across a parameter grid, plus a robust implied volatility inversion.

Checkpoint

Where does Newton’s method fail when inverting for implied volatility, and what does your code do about it?

Prepare for tomorrow

Ten minutes tonight so Day 252, Thursday, 15 April 2027 starts clean. This is what the evening email sends you.

Reread your PDE derivation and try to reproduce it from a blank page in ten minutes.

Note where you stalled.

Check the arithmetic drill times.