Monte Carlo That Converges
Monte Carlo problems are a fixture of quant developer assessments, usually as a pricing or probability question with a simulation attached. The code is short. What is being tested is whether you know how accurate the answer is, because a simulation without an error estimate is a number with no claim attached to it.
What Monte Carlo is
Monte Carlo estimates an expected value by sampling. Draw many random scenarios, compute the quantity in each one, and take the average. The law of large numbers says the average tends to the true expectation as the number of draws grows. An option price is the discounted expected payoff under the pricing model, so you simulate many price paths, compute the payoff on each path, and average the payoffs. A probability is the expectation of an indicator, so it is the fraction of draws in which the event happens.
The rest of this lesson is for subscribers
Unlock every lesson in Programming for Quantitative Developers, and every other premium course.
Subscribe to continueTest your knowledge
Keep reading Programming for Quantitative Developers
33 lessons in this course, and every other premium course, on one subscription.
- Every lesson in every course, with the worked examples and interactive simulators
- Graded questions on every lesson, with explanations for the wrong answers as well as the right one
- The trainers, timed assessments and brainteaser library that go with them