Skip to content

Commit

Permalink
Sync with library changes in r15771
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Feb 24, 2009
1 parent bde5f21 commit ac9aa81
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 0 additions & 4 deletions CSharp/examples/EquityOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ static void Main(string[] args)
int timeStepsPerYear = int.MaxValue;
bool brownianBridge = false;
bool antitheticVariate = false;
bool controlVariate = false;
int requiredSamples = int.MaxValue;
double requiredTolerance = 0.02;
int maxSamples = int.MaxValue;
Expand All @@ -341,7 +340,6 @@ static void Main(string[] args)
timeStepsPerYear,
brownianBridge,
antitheticVariate,
controlVariate,
requiredSamples,
requiredTolerance,
maxSamples, seed));
Expand All @@ -358,7 +356,6 @@ static void Main(string[] args)
int timeStepsPerYear = int.MaxValue;
bool brownianBridge = false;
bool antitheticVariate = false;
bool controlVariate = false;
int requiredSamples = 32768; // 2^15
double requiredTolerance = double.MaxValue;
int maxSamples = int.MaxValue;
Expand All @@ -369,7 +366,6 @@ static void Main(string[] args)
timeStepsPerYear,
brownianBridge,
antitheticVariate,
controlVariate,
requiredSamples,
requiredTolerance, maxSamples, seed));
ReportResults("MC (Sobol)", europeanOption.NPV(), null, null);
Expand Down
4 changes: 2 additions & 2 deletions Guile/examples/european-option.scm
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@
; method: Monte Carlo
(with-pricing-engine (option (new-MCEuropeanEngine process
"pseudorandom" 1 #f #f
#f #f #f 0.02 #f 42))
#f #f 0.02 #f 42))
(report "MC (crude)"
(Instrument-NPV option) (Instrument-error-estimate option)))

(with-pricing-engine (option (new-MCEuropeanEngine process
"lowdiscrepancy" 1 #f #f
"lowdiscrepancy" 1 #f
#f #f 32768))
(report "MC (Sobol)" (Instrument-NPV option) "n/a"))
11 changes: 7 additions & 4 deletions Java/examples/EquityOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package examples;

import org.quantlib.QuantLib;
import org.quantlib.Actual365Fixed;
import org.quantlib.AmericanExercise;
import org.quantlib.AnalyticEuropeanEngine;
Expand Down Expand Up @@ -314,8 +315,9 @@ public static void main(String[] args) throws Exception {
method = "MC (crude)";
europeanOption.setPricingEngine(
new MCEuropeanEngine(stochasticProcess,
"PseudoRandom", timeSteps, 252,
false, false, false,
"PseudoRandom", timeSteps,
QuantLib.nullInt(),
false, false,
nSamples, 0.02, maxSamples, mcSeed));
System.out.printf(fmt, new Object[] { method,
europeanOption.NPV(),
Expand All @@ -325,8 +327,9 @@ public static void main(String[] args) throws Exception {
method = "MC (Sobol)";
europeanOption.setPricingEngine(
new MCEuropeanEngine(stochasticProcess,
"LowDiscrepancy", timeSteps, 252,
false, false, false,
"LowDiscrepancy", timeSteps,
QuantLib.nullInt(),
false, false,
nSamples, 0.02, maxSamples, mcSeed));
System.out.printf(fmt, new Object[] { method,
europeanOption.NPV(),
Expand Down
4 changes: 2 additions & 2 deletions MzScheme/examples/european-option.scm
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@
; method: Monte Carlo
(with-pricing-engine (option (new-MCEuropeanEngine process
"pseudorandom" 1 #f #f
#f #f #f 0.02 #f 42))
#f #f 0.02 #f 42))
(report "MC (crude)"
(Instrument-NPV option) (Instrument-error-estimate option)))

(with-pricing-engine (option (new-MCEuropeanEngine process
"lowdiscrepancy" 1 #f #f
"lowdiscrepancy" 1 #f
#f #f 32768))
(report "MC (Sobol)" (Instrument-NPV option) "n/a"))
4 changes: 2 additions & 2 deletions Ruby/examples/european-option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def report(method, x, dx = nil)
# method: Monte Carlo
option.pricingEngine = MCEuropeanEngine.new(process,'pseudorandom',
1, nil, false,
false, false, nil, 0.02, nil, 42)
false, nil, 0.02, nil, 42)
report('MC (crude)', option.NPV, option.errorEstimate)

option.pricingEngine = MCEuropeanEngine.new(process,'lowdiscrepancy',
1, nil, false, false, false, 32768)
1, nil, false, false, 32768)
report('MC (Sobol)', option.NPV)

0 comments on commit ac9aa81

Please sign in to comment.