13 votes
Accepted

Least Squares Monte Carlo

To compute the price of an American option or a callable instrument in general, at each potential exercise date, one is required to compare its continuation value (discounted risk-neutral expectation ...
Quantuple's user avatar
  • 14.5k
11 votes
Accepted

Hyperbolic and Elliptic PDEs in Quant Finance

PDE Classification (Background) Linear second-order PDEs can be classified as either elliptic, parabolic or hyperbolic. A general PDE in two dimensions for $u=u(x,y)$ would look like $$Au_{xx}+2Bu_{xy}...
Kevin's user avatar
  • 15.3k
10 votes
Accepted

Anyone has detailed explanation on how to use epstein-zin preferences in asset pricing models

Recursive Utility The traditional approach to consumption-based asset pricing includes time separable (additive) expected utility functions, $$U(C_t,C_{t+1})=u(C_t)+\beta \mathbb{E}_t[u(C_{t+1})],$$ ...
Kevin's user avatar
  • 15.3k
8 votes

Fastest way to calculate YTM from bond price

I faced this problem trying to price bund yields from Bloomberg ticks. I found the fastest method was to price three static yields from three static prices and determine a quadratic function for those ...
Attack68's user avatar
  • 9,215
8 votes
Accepted

In Carr-Madans option pricing method, why do they use FFT?

Indeed, the FFT was a notable improvement in computational option pricing in 1999, but further investigation has shown that it can be easily optimized both in terms of speed and accuracy. For instance,...
sets's user avatar
  • 1,451
7 votes

Heston Model Integration Oscillations

There has been a huge amount of work on this. Generally a Fourier transform approach is used. First, be careful to use the form of the characteristic function that does not wind about zero in order ...
Mark Joshi's user avatar
  • 6,873
7 votes

Is there a good closed-form approximation for Black-Scholes implied volatility?

Let's Be Rational uses exactly two iterations to give full machine accuracy for all inputs. It can be viewed as a three-stage analytical formula if you like. The code is free to download at www....
Peter Jaeckel's user avatar
7 votes
Accepted

Are asset return means difficult to predict because they have no lower bound?

To answer, the assertion that volatility is easier to predict than expected return requires clarification. The phrase "easier to predict" is particularly ambiguous. To me this means that the ...
RRL's user avatar
  • 3,595
6 votes
Accepted

Brennan-Schwartz algorithm for pricing American options

Ikonen and Toivanen don't say that the LCP is solved exactly, they simply say that the modified back-substitution is a valid algorithm to solve the LCP. A numerical error may arise around the ...
jherek's user avatar
  • 1,369
6 votes
Accepted

Produce the random variable for an asset from a uniformly distributed random varible

The question requires you to provide a method which uses uniform random variables and transforms them to generate realizations of the described asset values. To give a bit more general answer: this ...
Oskar's user avatar
  • 76
6 votes
Accepted

Simulation of Geometric Brownian Motion in R

The issue is that you do not plot one sample path but for each time point $t$, you simply plot one possible realisation of the random variable $S_t(\omega)$. Thus, you don't get a connected path. (...
Kevin's user avatar
  • 15.3k
6 votes
Accepted

Improve Finite Difference Scheme

Don't solve the Black-Scholes PDE, solve the heat equation One of the major results of mathematical finance is showing that the Black-Scholes PDE can be mapped to the heat equation. The heat equation ...
oliversm's user avatar
  • 1,389
5 votes

Is there a good closed-form approximation for Black-Scholes implied volatility?

There are some other references: Li and Lee (2009) [download] An adaptive successive over-relaxation method for computing the Black–Scholes implied volatility Stefanica and Radoicic (2017) An ...
jChoi's user avatar
  • 1,143
5 votes
Accepted

QuantLib returns slightly different bondYield when backtested

I would start by saying that yes, this is an acceptable precision. However, the reason you are not getting the same result is because, by default, QuantLib has ...
David Duarte's user avatar
  • 5,705
5 votes

Improve Finite Difference Scheme

Some of the standard tricks are mentioned in this paper, Finite Difference Schemes with Exact Recovery of Vanilla Option Prices https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3530561 which also ...
Peter A's user avatar
  • 494
5 votes
Accepted

Asymptotics of Call Option as $S\to0$

This is more of a math question than a quant question. Under Black Scholes dynamics (assuming $r=0$ for simplicity), as everyone knows we have $$C=SN(d_1)-KN(d_2)$$. In this case, we are interested ...
dm63's user avatar
  • 16.6k
4 votes

Heston Model Integration Oscillations

I'd use FFT or similar rather than direct integration. Here is an old paper with Heston example: Option pricing using fractional FFT
Kiwiakos's user avatar
  • 4,307
4 votes

How should I develop my coding ability in order to set myself up for a quant role?

To test your programming skills, try QuantLib. Can you do interest-rate modelling with QuantLib? Can you debug the 10-level C++ template? Do you know how to use day count? Do you know how to use ...
SmallChess's user avatar
  • 2,255
4 votes

Architecture of a global pricing library with immutable payoffs

That's the best question that nearly no one asks. I'm with you on Quantlib and Strata, haven't really seen a very good design around but I've seen quite a few bad ones. It is definitely doable and has ...
user47501's user avatar
4 votes

What are the industry standards and rules of thumb when it comes to numerical methods?

1> Analytical - Black Scholes formula for Vanilla European options, Digitals. These valuations are just an "interpolation" of traded options. We interpolate the implied volatility from the traded ...
bhutes's user avatar
  • 986
4 votes

Fastest way to calculate YTM from bond price

In my old pricing library I used NR to calculate YTM. That was the fastest that I could find. But, "Alex C" is correct, you can pre-cache. Remember, BT quotes in 64's, so you can easily build up a ...
JoshK's user avatar
  • 2,588
4 votes

C++ code Thomas algorithm for solving a pentadiagonal Ax=b

You are looking to solve a linear system with a band diagonal system matrix $A$ of dimensions $N \times N$ and having the property $m_1 = 2, \, m_2 = 2$, respectively the number of sub-diagonals under ...
Giogre's user avatar
  • 346
4 votes
Accepted

Maximum norm stability for implicit Black-Scholes equation

Note that \begin{align*} U_j^{(n)} &= \frac{U_j^{(n+1)} - a_jU_{j-1}^{(n)} - c_jU_{j+1}^{(n)}}{b_j}\\ &\le \frac{\max_j|U_j^{(n+1)}| - a_j\max_j|U_j^{(n)}| - c_j\max_j|U_j^{(n)}|}{b_j}. \end{...
Gordon's user avatar
  • 21k
3 votes
Accepted

4-point Trapezium rule for numerical integration

This has nothing to do with the trapezium rule. The derivative pays $cos(S_1)$ if $1<=S_1<=2$. Solve $e^{(r-0.5\sigma^2)T+\sigma\sqrt{T}z)}=1$ and $e^{(r-0.5\sigma^2)T+\sigma\sqrt{T}z)}=2$ to ...
Andrew's user avatar
  • 609
3 votes
Accepted

Extreme cases of normal random numbers and NaN

The problem is not with your code but with the SDE itself. The process \begin{equation} \mathrm{d}S_t = \sigma S^\beta \mathrm{d}W_t \end{equation} is a non-negative local martingale. For $\beta \...
LocalVolatility's user avatar
3 votes
Accepted

Solve Black scholes PDE without using any transformation

Yes it can be done. However, bear in mind that a naive explicit FD scheme is not unconditionally stable (see CFL stability condition). As far as your initial/boundary conditions issue is concerned: [...
Quantuple's user avatar
  • 14.5k
3 votes
Accepted

Implied volatility in Monte Carlo models

To start with make sure that each Monte Carlo price is computed with the same random numbers sequence, so as to avoid unnecessary numerical noise that would result from using different sequences for ...
Antoine Conze's user avatar
3 votes

Fastest way to calculate YTM from bond price

Brent's method may converge a little faster than NR for price-yield. Before electronic computers, a "yield book" was a massive paper book where one could find nearest dirty price, days to ...
Dimitri Vulis's user avatar
3 votes

Produce the random variable for an asset from a uniformly distributed random varible

Say your asset can take the discrete values {1,2,3,4} with probabilities {0.4, 0.1, 0.2, 0.3}. The question is to derive a sampling procedure that returns either {1,2,3,4} with the right ...
Attack68's user avatar
  • 9,215

Only top scored, non community-wiki answers of a minimum length are eligible