#include "HullWhiteOptionPricer.h"

HullWhiteOptionPricer::HullWhiteOptionPricer(const std::string& ub_error, double lb, double ub, double beta, const std::function<double(double)>& strike_transform, double mux_price, double muy_price, double Cxx_price, double Cyy_price, double Cxy_price)
	:
	m_strike_transform(strike_transform),
	OptionPricer(lb, ub, ub_error),
	m_gauss_price(std::unique_ptr<Gaussian2d>(new Gaussian2d( mux_price, muy_price, Cxx_price, Cyy_price, Cxy_price)))
{
	m_gauss_price->fix_beta(beta);
}

double HullWhiteOptionPricer::digital_option_in_arrears_price(double k) const
{
	return m_gauss_price->e_beta_expectation(std::log(m_strike_transform(k)));
}
