HaroldRKingsberg / MLMC

Multi-level Monte Carlo simulation of option pricing
3 stars 3 forks source link

Double Check Stock Walk Price #7

Closed petercwill closed 7 years ago

petercwill commented 7 years ago

Hi Guys,

It's likely i'm just missing something. But could I get a double check on something. Line 52 of our stock.py file performs price updates as

price *= math.exp((risk_free - 0.5 * vol**2) * time_step + vol * pstep)

I'm concerned, because if we were preforming the Euler Marayuma step shouldn't it be something like

price += risk_free*price*time_step + vol*price*pstep

I only raise this, because the first formulation appears similar to the exact analytical solution for BS. See equation (4.6) page 9 of this pdf: http://complex.gmu.edu/www-phys/phys510/assignments/exam2/sde/saim_review.pdf

Could totally be off the mark here, just wanted to check my understanding. Thank you.

HaroldRKingsberg commented 7 years ago

The Euler-Maruyama formulation brought up in class uses ordinary Brownian motion. The problem with ordinary Brownian motion is that it can easily lead to random walks where the asset price suddenly goes negative. This doesn't make any sense in the case of the assets we're dealing with, so ordinary Brownian motion isn't great.

Instead, we deal with geometric Brownian motion. If you look that one up, you'll see the formulation matches what we're doing in stock.py

On 4/30/17, petercwill notifications@github.com wrote:

Hi Guys,

It's likely i'm just missing something. But could I get a double check on something. Line 52 of our stock.py file performs price updates as

price *= math.exp((risk_free - 0.5 * vol**2) * time_step + vol * pstep)

I'm concerned, because if we were preforming the Euler Marayuma step shouldn't it be something like

price += risk_free*price*time_step + vol*price*pstep

I only raise this, because the first formulation appears similar to the exact analytical solution for BS. See equation (4.6) page 9 of this pdf: http://complex.gmu.edu/www-phys/phys510/assignments/exam2/sde/saim_review.pdf

Could totally be off the mark here, just wanted to check my understanding. Thank you.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/HaroldRKingsberg/MLMC/issues/7

petercwill commented 7 years ago

I think I may have a conceptual problem, here.

My understanding is as follows: The technical definition for GBM is a process that satisfies the SDE given by

dX = risk_free*X*dt + vol*X*dW

Note, this is the equation describing the price walk for a constant drift and volatility stock. Thus, its solution IS GBM. We're attempting to approximate this solution with a certain numerical scheme (e.g. Euler-Maruyama). This scheme, uses BM as part of it's approximation to the true solution.

I'm concerned that, as coded, our walk_price method makes use of the analytical solution to the SDE. More specifically, 1) this is only a correct solution for constant price and vol stocks. 2) it's not the same as applying the EM method

HaroldRKingsberg commented 7 years ago

I can't find anything wrong in what you're saying, and I rather wish I hadn't read the Wikipedia article as quickly as I did.

@mtran2011 you were the one who originally made the change from S*(u dt + s dW) to what we currently have. Thoughts?

petercwill commented 7 years ago

Hey guys - just an FYI I'm a bit slammed with work. Think I will either be late or unable to make class. However if you guys want to talk afterwards I will be available

Sent from my iPhone

On May 1, 2017, at 3:52 PM, HaroldRKingsberg notifications@github.com wrote:

I can't find anything wrong in what you're saying, and I rather wish I hadn't read the Wikipedia article as quickly as I did.

@mtran2011 you were the one who originally made the change from S*(u dt + s dW) to what we currently have. Thoughts?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

HaroldRKingsberg commented 7 years ago

Due to @petercwill's remarks, I've reverted the logic to how it was prior to commit 630b21442a7dfab2ad2ace19a246cce2ed8a155e, since we are looking to implement Euler-Maruyama, and not the closed-form solution.

mtran2011 commented 7 years ago

Hello guys sorry late reply. The S += dS is vanilla Euler but we need the full truncation implementation of Euler here instead for Heston model. Reason is in Heston there's a chance variance becoming negative. Gonna provide specific page reference tomorrow

HaroldRKingsberg commented 7 years ago

So, after getting up early this morning to look at it once more:

The way we originally had it: S + dS The way we changed it to: log S + log dS

log S + log dS appears acceptable in the literature I've found on the matter, so I've gone with it. I have also merged the option_edits branch back in with the master. I would very much appreciate some help with Issue #8 and while I will not be able to work on this again until 2000 tonight, that should still give me roughly four or five hours tonight.

mtran2011 commented 7 years ago

I'm coming back with page refs. In the paper Efficient Simulation of the Heston Stochastic Volatility Model, page 3, eq.1-2 shows the SDE they want to simulate (note r=0 here), and pg 6, eq. 6-7 shows the full truncation method. V(t) is updated so that it can be negative, but only V+ = max(V,0) is used to update the stock price. But the stock is updated using log() formula. Please see pg 5 eq.3 which shows that S += dS is equivalent to the log() formula

Please close this item if this ref is satisfactory to you guys

I'm working on #8