Hello,
I want to measure of the risk of loss on a specific portfolio containing only one product using montecarlo model. I have the prices for the last 31 days. 2008.10.01 = 1200.0 USD 2008.10.02 = 1170.1 USD 2008.10.03 = 1270.3 USD ... 2008.10.30 = 1150.2 USD 2008.10.31 = 1223.1 USD and today is 2008.11.01 I want to evaluate the VaR in the horizon of ONE DAY. My product has no discount, it has no options. My steps are: 1) evaluation the statistic of all the prices I have the statistics object filled with my prices and I can get the standard deviation, mean, min, max ... sigma = 186 mean = 1213 2) creation of the GaussianRandomSequenceGenerator I suppose that nTimeSteps = 20 and maturity = 1/252 (252 working day in one year) rsg = new GaussianRandomSequenceGenerator(new UniformRandomSequenceGenerator( nTimeSteps, new UniformRandomGenerator((int) Math.random()))); 3) creation of the stochastic process: double initialValue = valueOfTheLastPrice; double mue = statistics.mean(); double sigma = statistics.standardDeviation(); GeometricBrownianMotionProcess stochasticProcess = new GeometricBrownianMotionProcess(initialValue, mue, sigma); I chose the initialValue as the last price of my product. It seems a fine decision. Isn't it? 4) creation of the pathGenerator and the pathPricer GaussianPathGenerator myPathGenerator = new GaussianPathGenerator( stochasticProcess, maturity, nTimeSteps, rsg, false); JPathPricer myPathPricer = new PathPricer(); The implementation of the pathPricer is very simple: public double price(Path path){ long n = path.length() - 1; return path.value(n); } n is equals to nTimeSteps (20). It's mean that the stochatic process evolves for 20 times. 5) evaluation of the montecarlo model MonteCarloModel mcSimulation = new MonteCarloModel(myPathGenerator, myPathPricer); mcSimulation.addSamples(numberOfSamples); 6) check results From the mcSimulation I get a RiskStatistic object, so I get the result as riskStatistic.valueAtRisk(0.95); My expectation is a value such different to the output ( 1.8E12 instead of 3.3E3 ). I see that the output depends too much to the initialValue of the stochastic process. I have doubts in: a) the values of the maturity and nTimeSteps b) the initial value of the initial process c) the implementation of my pathPricer what is wrong? is my algorithm fine? thanks in advance ciao Nicola ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |