Rs
Module 11GBM SimulationLesson 3 of 720 min

Multi-Step Paths

Build a full path vector for path-dependent payoffs later.

Update

S_{t+dt} = S_t exp((r-½σ²)dt + σ√dt Z)

Storage

Vec with_capacity(steps+1); push each step including S0.

Challenge

Asian-style: average of path and max(avg-K,0) for one path.

Tips
  • with_capacity
  • Include S0
  • Average path for Asians

Try it live

Multi-Step PathsRust 2021
Loading editor…
Output
Press Run to compile and execute.