Skip to content

Commit

Permalink
Merge pull request #268 from broadhed/267-bachelier-options-pricer-issue
Browse files Browse the repository at this point in the history
Fix for Modified Bachelier pricing. Closes #267
  • Loading branch information
avhz authored Oct 1, 2024
2 parents 352e42e + 31b18ad commit c6e7d7f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pricer/backends/bachelier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ impl ModifiedBachelier {
let n = Gaussian::default();

match self.option_type {
TypeFlag::Call => (S - K * (-r * T).exp()) * n.cdf(d1) + v * T.sqrt() * n.pdf(d1),
TypeFlag::Put => (K * (-r * T).exp() - S) * n.cdf(-d1) + v * T.sqrt() * n.pdf(-d1),
TypeFlag::Call => ((S - K) * (-r * T).exp()) * n.cdf(d1) + v * T.sqrt() * n.pdf(d1),
TypeFlag::Put => ((K - S) * (-r * T).exp()) * n.cdf(-d1) + v * T.sqrt() * n.pdf(-d1),
}
}
}
Expand Down Expand Up @@ -198,6 +198,6 @@ mod tests_bachelier {
today() + Duration::days(365),
TypeFlag::Call,
);
assert_approx_equal!(bachelier.price(), 2.513031723793472, 1e-2);
assert_approx_equal!(bachelier.price(), 0.07589, 1e-2);
}
}

0 comments on commit c6e7d7f

Please sign in to comment.