From b7f398d8d0864da95651f3ad62d6a78c24bcca5b Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 16 Sep 2017 17:37:52 -0400 Subject: [PATCH] Cleanup and function simplification --- models.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/models.go b/models.go index f14e440..12932a5 100644 --- a/models.go +++ b/models.go @@ -7,7 +7,6 @@ import ( ) // Option struct that holds all the details of an option -// Option details type Option struct { OptType int64 Strike float64 @@ -39,11 +38,9 @@ func gbmSimulation(spot float64, rfr float64, vol float64, tte float64, randNum return spot * math.Exp(drift+stoch) } -// runSimulations is the main function that runs Monte Carlo simulations -// for an option. Note that it runs normal Geometric Brownian Motion -// to calculate the future spot levels -func runSimulations(opt *Option) { - +// PriceMonteCarlo is the exported method to run the simulations and value +// a vanilla option using Monte Carlo methods +func (opt *Option) PriceMonteCarlo() { var i int64 var level float64 @@ -89,8 +86,3 @@ func runSimulations(opt *Option) { opt.Rho = (opt.Rho/float64(opt.Sims)*math.Exp(-(opt.Rfr+0.01)*tte) - opt.FV) } -// PriceMonteCarlo is the exported method to run the simulations and value -// a vanilla option using Monte Carlo methods -func (opt *Option) PriceMonteCarlo() { - runSimulations(opt) -}