LessonThis is a lesson restated in new words. Any figure in it is an example from the source, not this desk's record.
Monte Carlo pricing values a derivative by simulating many future paths of the underlying price, scoring the contract on each path, averaging those scores, and discounting the average to today. For a European call, which the lesson treats as exercisable only at expiration, the score is the positive difference between the ending price and the strike, or zero when that difference is negative. A worked example with 1,000 paths prints 160.75, beside a listed quote of 154.46 for the same kind of contract.
Why it matters
A closed form such as the Black-Scholes model, the formula that prices a European call or put from spot, strike, volatility, time, and the riskless rate, is available for a plain call. The listed market already has a price for that plain contract, set by trading. Monte Carlo earns its place when the payoff is unusual and no matching listed contract tells you the value. A barrier is the lesson's example: the call can be knocked out if the price crosses a level. You can write that rule into the same loop that scores a plain call. The plain call is the rehearsal.
The idea in plain words
The underlying is assumed to follow geometric Brownian motion, the random price model whose steps scale with the current price. Each simulated contract gets its own path from today out to expiration. At the end of the path the call payoff is the ending price minus the strike when that quantity is positive, and zero otherwise. A call is a right to buy, so the holder walks away when the ending price is at or below the strike. The simulated value is the average of those payoffs, multiplied by a continuous discount factor, e to the power of minus the riskless rate times the time left. Using a drift of zero is the lesson's choice for a risk-neutral price.
How to use it
A small call object only needs the strike, because the strike is what the payoff subtracts. A simulation object takes that call, the number of paths, the starting price, the drift, the time step, the volatility, the time to expiration, and the riskless rate. It builds one geometric-Brownian-motion path per contract. For each path it sets a clock to the time remaining and steps forward, subtracting one step each time, until the clock is exhausted.
The payoff loop reads the last price on each path, subtracts the strike, and keeps the result only when it is positive. NumPy's average of that list, times the exponential discount, is the printed price. The lesson's inputs are a strike of 130, 1,000 paths, a starting price of 195.24, a drift of zero, daily steps of 1/365, a volatility of 1.0625, a life of 36/365 of a year, and a riskless rate of 8 percent. The run prints 160.75. The quote the lesson copied for comparison is 154.46.
A barrier variant adds one test. Pass a barrier level into the call. If a price along the path crosses it, set that path's payoff to zero. The rest of the average-and-discount step stays the same. That is the lesson's sketch of an up-and-out style payoff, offered as the reason to learn the loop.
What usually goes wrong
The simulated 160.75 and the quoted 154.46 differ. The lesson treats the gap as ordinary for a finite sample and a chosen volatility. The method is aimed at payoffs a quote sheet does not list.
A drift other than zero leaves the risk-neutral setup. Scoring the call before the final price answers a question this session does not ask. Paths that finish out of the money contribute zero even if they were above the strike earlier. The 8 percent rate and the volatility of 1.0625 are inputs, and other inputs produce another present value. More paths shrink the jitter between runs. They do not repair a volatility that was only a rough guess.
Questions people ask
Why discount the average payoff?
The payoffs are scored at expiration. Multiplying the average by e to the minus rate times time converts that future average into a present value. The lesson uses continuous discounting.
What did the worked example print?
With the inputs above, the simulation prints 160.75. The listed comparison quote is 154.46. The lesson presents both and does not treat them as the same number.
When is the loop more useful than a closed form?
When the payoff has an extra rule, such as a barrier that sets the payoff to zero after a crossing. The path already exists, so the extra rule is another test in the scoring loop.