Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonymakarewicz committed Aug 16, 2024
1 parent 470f8b7 commit cb6b93b
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/solver/monte_carlo/base_mc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace OptionPricer {

virtual ~MCPricer();

[[nodiscard]] virtual double calculate_price(const unsigned long& N) const = 0;
[[nodiscard]] virtual double calculatePrice(const unsigned long& N) const = 0;

protected:
std::shared_ptr<IMarketData> marketData_;
Expand Down
2 changes: 1 addition & 1 deletion include/solver/monte_carlo/mc_american.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace OptionPricer {
std::shared_ptr<RegressionStrategy> regressionStrategy,
const unsigned int& steps);

double calculate_price(const unsigned long& N) const override;
double calculatePrice(const unsigned long& N) const override;
double standardPrice(const unsigned long& N, const double &dt, const double &discountFactor) const ;
double brownianBridgePrice(const unsigned long& N, const double &dt, const double &discountFactor) const ;

Expand Down
2 changes: 1 addition & 1 deletion include/solver/monte_carlo/mc_asian.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace OptionPricer {
std::shared_ptr<NumberGenerator> generator,
const unsigned int& steps);

[[nodiscard]] double calculate_price(const unsigned long& N) const override;
[[nodiscard]] double calculatePrice(const unsigned long& N) const override;

protected:
virtual double computeSumPrices(const double& S_t) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/solver/monte_carlo/mc_barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace OptionPricer {
std::shared_ptr<NumberGenerator> generator,
const unsigned int& steps);

[[nodiscard]] double calculate_price(const unsigned long& N) const override;
[[nodiscard]] double calculatePrice(const unsigned long& N) const override;

protected:
virtual bool checkHasCrossed(const double& S_t, bool& hasCrossed) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/solver/monte_carlo/mc_lookback.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace OptionPricer {
std::shared_ptr<NumberGenerator> generator,
const unsigned int& steps);

[[nodiscard]] double calculate_price(const unsigned long& N) const override;
[[nodiscard]] double calculatePrice(const unsigned long& N) const override;

protected:
virtual double computePayoff(const double& S_t, const double& S_min, const double& S_max) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/solver/monte_carlo/mc_single_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace OptionPricer {

~SinglePathMCPricer() override = default;

[[nodiscard]] double calculate_price(const unsigned long& N) const override;
[[nodiscard]] double calculatePrice(const unsigned long& N) const override;

private:
std::shared_ptr<SinglePathOption> option_;
Expand Down
2 changes: 1 addition & 1 deletion src/solver/monte_carlo/mc_american.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace OptionPricer {
basisFunctionStrategy_(std::move(basisFunctionStrategy)),
regressionStrategy_(std::move(regressionStrategy)) {}

double AmericanMCPricer::calculate_price(const unsigned long &N) const {
double AmericanMCPricer::calculatePrice(const unsigned long &N) const {
const double dt = option_->getT() / static_cast<double>(steps_);
const double discountFactor = exp(-marketData_->getR() * dt);

Expand Down
2 changes: 1 addition & 1 deletion src/solver/monte_carlo/mc_asian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace OptionPricer {
: PathDependentMCPricer(std::move(marketData),
std::move(stockModel), std::move(generator), steps), option_(std::move(option)) {}

double AsianMCPricer::calculate_price(const unsigned long& N) const {
double AsianMCPricer::calculatePrice(const unsigned long& N) const {
double sumPayoff = 0.0;
const double dt = option_->getT() / static_cast<double>(steps_);

Expand Down
2 changes: 1 addition & 1 deletion src/solver/monte_carlo/mc_barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace OptionPricer {
: PathDependentMCPricer(std::move(marketData),std::move(stockModel),
std::move(generator), steps), option_(std::move(option)) {}

double BarrierMCPricer::calculate_price(const unsigned long &N) const {
double BarrierMCPricer::calculatePrice(const unsigned long &N) const {
double sumPayoff = 0.0;
const double dt = option_->getT() / static_cast<double>(steps_);

Expand Down
2 changes: 1 addition & 1 deletion src/solver/monte_carlo/mc_lookback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace OptionPricer {
: PathDependentMCPricer(std::move(marketData),std::move(stockModel),
std::move(generator), steps), option_(std::move(option)) {}

double LookbackMCPricer::calculate_price(const unsigned long &N) const {
double LookbackMCPricer::calculatePrice(const unsigned long &N) const {
double sumPayoff = 0.0;
const double dt = option_->getT() / static_cast<double>(steps_);

Expand Down
2 changes: 1 addition & 1 deletion src/solver/monte_carlo/mc_single_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace OptionPricer {
}
}

double SinglePathMCPricer::calculate_price(const unsigned long& N) const {
double SinglePathMCPricer::calculatePrice(const unsigned long& N) const {
double sumPayoff = 0.0;

for (int i = 0; i < N; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/solver/monte_carlo/mc_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace OptionPricer {
if (!pricer_) {
throw std::logic_error("Pricer is not set for MonteCarloSolver.");
}
return pricer_->calculate_price(N_);
return pricer_->calculatePrice(N_);
}

void MCSolver::setN(const unsigned long& N) {
Expand Down

0 comments on commit cb6b93b

Please sign in to comment.