#include "OptionPricer.h"

OptionPricer::OptionPricer(double price_lb, double price_ub, const std::string& ub_error)
	:
	m_price_lb(price_lb),
	m_price_ub(price_ub),
	m_ub_error(ub_error),
	m_digital_option_price_inverter(std::unique_ptr<MonotonicFunctionInverter>(
		new MonotonicFunctionInverter([&](double k) { return this->digital_option_in_arrears_price(k); }, price_lb , price_ub)))
{}

double OptionPricer::digital_option_in_arrears_price_inverse(double price) const
{
	return m_digital_option_price_inverter->calculate_inverse(price, m_ub_error);
}
