Rabelais


Total Posts: 12 
Joined: Sep 2020 


I have 200 monthly spot prices of a commodity (oil) and I have to model the prices using the Schwartz mean reverting SDE:
where W is the standard Brownian motion, mu is the drift, sigma the volatility, alpha the strength of mean reversion (these parameters are estimated from data). This commodity is the underlying asset of the Forward contract with price at delivery F(S,T), where S is the spot price at time 0 and T is the expiry time. Such a contract is equivalent to having an option with , where K=F(S,T) is the strike price.
Letting be the time to expiry, the formula for the price of the forward contract is (1) and the value of the equivalent option is .
Knowing this information, how to run (I'm using matlab but other languages are fine too) a Monte Carlo simulation to price this particular option? Usually, these are the steps to follow * generate a large number of random price paths for the underlying asset * for each path compute the payoff of the option * compute the average of all payoffs * discount the average to today
however, I'm having some problems with this framework. This is what I tried so far
I wrote the (matlab) code (download below) which computes what I think (can you confirm?) is the exact solution for option pricing (V_exact in the attached code) and then computes the approximating solution by means of Monte Carlo simulation (V_Monte_Carlo in the code). The MC simulation uses the first spot price (real data) and the estimated parameters to 'randomly' compute the next spot prices. To compute the spot prices, instead of using the equation for dS that I wrote above it's easier to use this one which is obtained from dS by letting X=log S:
(2)
where and .
These are the steps for the Monte Carlo simulation:
1. The first price F of the forward contract  and so of the option V too  is set to 0 since there is no cost to enter a forward contract. Compute the first value of X by taking the logarithm of the first spot price 2. compute the next value of X using the formula (2) 3. compute the next value of the spot price by taking the exponential of X 4. compute the next price F of the forward contract using formula (1) 5. compute the next price V of the option using 6. compute the average V_Monte_Carlo of the option prices 7. repeat steps 26 until all values are computed
However, as you can see from the image below, the curve of the option prices obtained with the MC simulation is smooth, while what I was expecting was a curve similar to the one of the exact solution. So I made some mistakes somewhere
Attached File: testMC.rar (if you prefer I can write here the code)





ronin


Total Posts: 601 
Joined: May 2006 


Formulas (1) and (2) can't be right.
S has to multiply all terms of F, i.e. X_0 has to multiply all terms of X_t.

"There is a SIX am?"  Arthur 


Rabelais


Total Posts: 12 
Joined: Sep 2020 


I see your point, maybe it is more clear to rewrite eq (2) as
with and 




ronin


Total Posts: 601 
Joined: May 2006 


So if alpha = sigma = 0, then log S = mu?

"There is a SIX am?"  Arthur 


Rabelais


Total Posts: 12 
Joined: Sep 2020 


By using Ito lemma on X = log S, with S following , we arrive to .
Then  if we assume we get , with c constant of integration  if we assume we get eq (2)
Moreover, the model assumes alpha > 0.
More info in the original paper by Schwartz 




ronin


Total Posts: 601 
Joined: May 2006 


Sorry, I read it too fast. If alpha = sigma = 0, then log S is indeed mu.
Will have a look at your code over the weekend. 
"There is a SIX am?"  Arthur 


Rabelais


Total Posts: 12 
Joined: Sep 2020 


Where do you get log S = mu from? alpha cannot be 0 since the hypothesis of the model is alpha>0. If sigma and alpha would be 0 then dS = 0 and there would be nothing to talk about since there would be no model for price evolution 




gaj


Total Posts: 113 
Joined: Apr 2018 


You miss the forest for the trees. Your question can be summarized as: why is V_Monte_Carlo smooth?
V_Monte_Carlo should depend on S. But you reassigned the variable S in line 32. Also line 41 doesn't make sense: X(:,k) = X(k1)*... + ...*randn(N,1). You want to generate random paths from the current price S, not from the previous column.
So just change two things:
 Back up S before line 32 (or change the variable name): S_true = S  Replace X(k1) with log(S_true(k)) in line 41: X(:,k) = log(S_true(k))*...




Rabelais


Total Posts: 12 
Joined: Sep 2020 


Thank you very much gaj for the time you took to reply. I'm new to monte carlo methods, so I trust you, but may I ask some further questions to better understand? I read some papers and what I understood was that the monte carlo method consists of randomly building price paths taking as starting point the first real price, compute their payoffs, and then averaging them all. In particular, to build one path, I thought that I had to take the first price (22.93) and then randomly generate all the next 199 values using equation (2) as written in my reply to ronin's first comment, and then to repeat this process thousands of times. So basically, at line 32 I create a 0 matrix and I put 22.93 in the first column, so that each row of the matrix X is a price path starting from 22.93 and the next value in a row is generated by "adding noise" to the previous value of X (as written in eq (2)). I thought this was the procedure of the monte carlo method. If I'm understanding correctly what you do is instead to add noise to each value log S, ie you use all the real data in S instead of starting from the first, right? This is very different from what I read, may I ask if you have some reference books or articles where this procedure is reported? Thank you very much 



