Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
4

Try Quantlib https://www.quantlib.org, it comes with everything you need.


4

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 of what the option would pay off if it was not exercised) to the relevant exercise value/early redemption price. By construction, lattice and finite difference ...


4

Simplest explanation is Feynman-Kac theorem https://en.wikipedia.org/wiki/Feynman%E2%80%93Kac_formula Blackscholes is a parabolic PDE Solution can be written as a conditional expectation over an integration term. Conditional expectation means you need to simulate it using some distribution which leads to monte-carlo


3

Let's try a simple approach, ignoring the difference between sample and population variance, and assuming the process is just the standard brownian - with no drift and sigma term. Generalisation should be easy. We define a process Y as equal to standard brownian, but we are assuming finite sampling with difference between two observations equal to $\Delta t$...


3

There might be some differences in how we define things, but there should be only one set of assumptions (i.e., for each asset, there should be only one expected return and expected volatility). Your simulations, which generate potential realizations of returns, should conform to these expected returns and volatilities. It's also not necessary to run ...


2

If you are asking whether it is possible to price path-dependent American options in tree based models, the short answer is yes. You simply construct your tree/grid and evaluate the rules in each node (analogous to what you would do in your MC simulations). These rules can be arbitrarily complex. Note, however, that you can only evaluate them at a discrete ...


2

If you want to rely on historical values at all (as opposed to a forward curve and implied volatilities), then $\mu$ would be the annualized exponential growth rate measured over a period T, calculated as $\mu=\frac{ln(S_{T}/S_{0})}{T}$ (where T is measured in years), and $\sigma$ would be the annualized volatility, determined as the variance of log-returns ...


2

For the first case, you would directly sample $n$ random normals $x$ and compute: $$R^p_i = \mu_p + \sigma_p x_i, i \in [1,n]$$ For the second case, you can sample $n$ x $3$ independent normals, compute the Cholesky decomposition matrix $C$ of $V$, which is the matrix $C$ such that $V=C^t C$, and get $n$ samples of vectors $X$ of size 3. The return $R_i$ ...


2

The paper is reliable and the formula is correct. However as you mention yourself there is an error. $$ \frac{\log \left(\frac{e^{0.01}-1}{0.01}\right)}{0.01} = 0.500417 \neq 0.498 $$


2

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 each pricing. Also using quasi random sequences (e.g. Sobol) rather than pseudo random sequences improves convergence and thus accuracy quite a bit. Once you ...


2

You do not model $v(t)$ by Monte-Carlo! As your excerpt explains $\phi(t)$ is a deterministic function of the initial yield curve and accordingly $v(t)$ is deterministic as well. Two further remarks: (i) You should not base the model on $v(t)$ but on an integrated $v(t)$, since this only involves the first derivative of the forward rates. (ii) You should not ...


2

There are two mistakes in the code: 1) In the line vt[t] = np.abs(vt[t-1] + kappa*(theta-np.abs(vt[t-1]))*dt + xi*np.sqrt(np.abs(vt[t-1]))*W_v[t]) you forgot to multiply W_v[t] by np.sqrt(dt). This is the reason the volatility increases so much. 2) The line St[t] = St[t-1]*np.exp((mu - 0.5*vt[t])*dt + np.sqrt(vt[t]*dt)*W_S[t]) should be St[t] = St[t-...


2

The correlation certainly has an impact on the price of your portfolio (of two options). If you simulate the prices at time $t < T$ then you get samples prices $X_t$ and $Y_t$ and the return between time $0$ and time $t$ reflects the correlations. This means that if $\rho$ is positive then the $X_t-X_0$ and $Y_t-Y_0$ are likely to have the same sign. ...


2

It is happening because you're using the same (psuedo/quasi) random numbers for each time step. in your code here: def GBM(Ttm, TradingDaysInAYear, NoOfPaths, UnderlyingPrice, RiskFreeRate, Volatility): dt = float(Ttm) / TradingDaysInAYear paths = np.zeros((TradingDaysInAYear + 1, NoOfPaths), np.float64) paths[0] = UnderlyingPrice for t in ...


2

You can directly use pandas-montecarlo to perform a Monte-Carlo simulation. Code for the same: # Import data import pandas_montecarlo from pandas_datareader import data data = data.get_data_yahoo('AAPL', '2017-01-01', '2018-01-01') # Calculate Returns data['return'] = data.Close.pct_change() # Perform Monte-Carlo Simulation data['return'].montecarlo(sims=...


2

1) Antithetical sampling reduces the variance in that for each path generated by random numbers in the interval [0,1] (representing probabilities), it generates another path that is correlated to that path (for example by taking the 1 - random number from the first path). As such, by construction, it forces there to be another correlated path in the ...


2

what you are doing is not really an application of the central limit theorem (CLT) but rather an application of the law of large numbers. If I understood your problem correctly you start with the following information: The future discounting rate has a uniform distribution: $r \sim U(1\%, 20\%)$. The future capital has a uniform distribution: $k \sim U(500, ...


1

I believe this may be referring to a procedure whereby one uses the ‘future’ Monte Carlo paths to determine optimal exercise. For example, consider an exercise decision at $T_1$ within a path dependent option that expires at $T_2>T_1$. Then to determine whether to exercise at $T_1$, examine each path in [$T_1,T_2$] to decide if continuation value > ...


1

Let the risk-neutral dynamics under your LV model be given by $$ \frac{d S_t }{S_t } = \mu_t dt + \sigma(t,S_t) dW_t $$ Let's drop the drift contribution (not relevant here) and apply Itô's lemma to obtain: $$ d \ln(S_t) = -\frac{1}{2}\sigma^2(t,S_t) dt + \sigma(t,S_t) dW_t $$ In order to simulate from this SDE, you need to choose a particular discretisation ...


1

If the $(F^i_T)_i$ are lognormal, I'd choose their geometric average $\left(\prod_{i=1}^N F^i_T\right)^{\frac{1}{N}}$ because it's lognormal as well and hence the expectation is easy to compute. If they are normal, I'd choose the arithmetic average $\frac{1}{N}\sum_{i=1}^N F^i_T$, since it's gaussian as well.


1

As you may know, XVA and CCR computations are complex and involve a huge Monte Carlo with a multi-asset diffusion, netting of trades, etc. Simplicity and better (computational) performance On the one hand, using a single-factor model means more simplicity and a better performance, this can be very important for example if one has real-time limits on the ...


1

Much of your question is already answered. What can be stated about the accuracy of this Euler Monte Carlo discretization with respect to the number of paths $N$? As you said, the central limit theorem says that our estimate formed from the empirical mean is a normal random variable, centred at the correct answer, and with a variance decaying with the ...


1

This is a common occurrence in monte carlo models. I suggest you look into Cholesky decomposition. The basic idea is that if you have a covariance matrix M that describes the relationship between your data, the cholesky decomposition will produce a lower triangular matrix L such that M = L * L' Now if you generate a vector X of random normals you can take L ...


1

The problem should go away if you simulate $r_t$. Ho Lee should work for the function of the form you assumed: $P(0,T)=e^{-aT^2-bT}=e^{-(aT+b)T}$ The problem with your simulation is that the forward rate, as you correctly derived, is as follows: $f(0,T)=2aT+b$ So when you take the derivative to calculate $\theta$, you lose b. But remember the short rate ...


1

Here's my $1/50. Please be free to raise any suggestions. Don't regress the split cashflows respectively as in TF, just regress the whole continuation value instead. When the bond is in the callable period, we'll have to use all paths; Otherwise, when in the convertible period, only consider the paths where conversion value > straight bond value (or should ...


1

As a heads up, if you're using low discrepancy points, then you should be randomising these before transforming them to the normal distribution. There are many ways to do this, but for coding simplicity I have used a uniform translation (% 1 in Python). As an example this would look like import numpy as np from scipy.stats import norm import sobol_seq as ss ...


1

Here is an excellent example of a code walkthrough of a Brownian Motion Monte Carlo Simulation. (Even if you're not coding this in Python - its just really nicely spelled out here step by step.) In the article you will see that in addition to Mean and Standard Deviation you will also need Variance in order to calculate Drift. Also, there are some other ...


1

Please let me know if you have any questions.


1

The correlation will impact the random numbers generated for the simulation. Use Cholesky Decomposition on the original correlation matrix to recalculate what the correlated random normal numbers will be and use those in the simulated path(s). If you're using Matlab or another canned scripting language, they usually have the function pre-coded. In matlab: R ...


1

The usual approach to deal with path dependency in finite differences/lattices solvers is to capture the path dependency trough one or more auxiliary variable(s) that make the problem non path dependent in the augmented space, and to discretize along these auxiliary variable(s). For instance that's easily done for asian options where the path dependency is ...


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