📄 black_scholes_put_div.cc
字号:
#include <cmath> // mathematical library#include "fin_recipes.h" // define the black scholes price #include <vector> double option_price_european_put_dividends( double S, // spot price double X, // Strike (exercise) price, double r, // interest rate double sigma, double time_to_maturity, vector<double>& dividend_times, vector<double>& dividend_amounts ) {// reduce the current stock price by the amount of dividends. for (unsigned int i=0;i<dividend_times.size();i++) { if (dividend_times[i]<=time_to_maturity){ S -= dividend_amounts[i] * exp(-r*dividend_times[i]); }; }; return option_price_put_black_scholes(S,X,r,sigma,time_to_maturity);};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -