Files
pricing/cpp/BlackScholesProcess.cpp
David Doebel 087a2f0d74 Restructure C++ core into cpp module and package bindings.
Move the pricing engine sources out of src/ into cpp/, add the closed-form engine and pybind wiring, and align tests/build targets with the new project layout.

Made-with: Cursor
2026-04-02 16:30:33 +02:00

25 lines
679 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @file BlackScholesProcess.cpp
* @brief BlackScholes GBM drift, diffusion, and step.
*/
#include "BlackScholesProcess.hpp"
double BlackScholesProcess::drift(double t, double s) {
double r = this->data().yield_curve().zeroRate(t);
return r * s;
}
double BlackScholesProcess::diffusion(double t, double s) {
double sigma = this->data().volatility_surface().sigma(s,t);
return sigma*s;
}
double BlackScholesProcess::step(double t, double s, double dt, double dW) {
double r = this->data().yield_curve().zeroRate(t);
double sigma = this->data().volatility_surface().sigma(s,t);
return s*exp((r-0.5*sigma*sigma)*dt + sigma*sqrt(dt)*dW);
}