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
25 lines
679 B
C++
25 lines
679 B
C++
/**
|
||
* @file BlackScholesProcess.cpp
|
||
* @brief Black–Scholes 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);
|
||
}
|
||
|
||
|