Black Scholes Merton
Introduced in 1973, in a paper entitled, “The Pricing of Options and Corporate Liabilities,” the professors put forth a derivatives pricing model that led to the Nobel Prize in Economics. This pricing formula gives a theoretical estimate of the price of European call and put options and makes many assumptions to achieve this. I am using this as a fair way to compare the three languages.
Rust is a systems programming language that runs blazingly fast, prevents almost all crashes and eliminates data races. It features pattern matching, closures and type inference while providing guaranteed memory safety and optional garbage collection. But most importantly… its blazingly fast.
Python has been increasingly gaining in popularity in Finance for the benefit of developers. Its got amazing statistics libraries and its nice to read. After testing 1M iterations of Rust, it handedly beat Python by 26.87% with each operation taking 3.57 seconds to calculate Black Scholes. If speed is your concern but you still want high level functionality, check out Rust!
Code is here