In finite differences for the black scholes method, you move backwards in time, since of course you know the prices at time $t = T$, and then you iterate until you get to time $t = 0$.

However, why then in this code does the time move forwards? Here, cur_t is current time, and as you can see, he iterates and each time moves cut_r forwards by dt. enter image description here

Entire code can be found here: https://www.quantstart.com/articles/C-Explicit-Euler-Finite-Difference-Method-for-Black-Scholes

Is this a mistake in the code?


They have written the equation to be solved as $$ -\frac{\partial C}{\partial t} + r S \frac{\partial C}{\partial S} + ... = 0 $$ instead of the more usual $$ \frac{\partial C}{\partial t} + r S \frac{\partial C}{\partial S} + ... = 0 $$ This means that in their setup $t$ represents the time to maturity, that is $t = T - \text{time}$. So they start from $t = 0$ where the option value is equal to its payoff, and they move forward in time to maturity until reaching $t = T$ which corresponds to $\text{time} = 0$ .

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.