Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Simulate a simple geometric Brownian motion for stock price evolution.
open System
open MathNet.Numerics.Distributions
let simulateStockPath S0 mu sigma T steps =
let dt = T / float steps
let rnd = Normal(0.0,1.0)
let rec loop S n acc =
if n > steps then List.rev acc
else let Snext = S * exp((mu - 0.5 * sigma*sigma)*dt + sigma*sqrt(dt)*rnd.Sample())
loop Snext (n+1) (Snext::acc)
loop S0 1 [S0]
let path = simulateStockPath 100.0 0.05 0.2 1.0 10
printfn "%A" pathF# is a functional-first programming language on the .NET platform, widely used in finance for quantitative modeling, risk analysis, and algorithmic trading due to its strong type system, immutability, and functional programming paradigms.
Origin & Creator
Developed by Microsoft Research in 2005, evolving from OCaml to provide functional-first programming on .NET for both academic and industry applications.
Industrial Note
Extensively used in investment banks, hedge funds, and fintech for quantitative analytics, derivatives pricing, portfolio optimization, and real-time risk management.