blsprice — Compute Black-Scholes European call and put option prices.
blsprice(Price,Strike,Rate,Time,Volatility) computes European call and put option prices using the Black-Scholes model. An optional Yield argument defaults to zero.
Syntax
blsprice(Price,Strike,Rate,Time,Volatility)How blsprice works
- Returns the call price as the single-output value and
[Call, Put]under two-output semantics. - Each input may be scalar or an array. Inputs use MATLAB implicit expansion, so compatible nonscalar dimensions expand elementwise.
- The optional
Yieldargument represents a continuously compounded dividend or foreign risk-free yield; an emptyYielduses the default zero yield. - Invalid financial domains and
NaNinputs produce elementwiseNaNoutputs rather than aborting the full call.
Examples
European stock option
[Call, Put] = blsprice(100, 95, 0.10, 0.25, 0.50)Expected output:
Call = 13.6953, Put = 6.3497Stock index option with yield
[Call, Put] = blsprice(910, 980, 0.02, 0.25, 0.25, 0.025)Expected output:
Call = 19.6863, Put = 90.4683Using blsprice with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how blsprice changes the result.
Run a small blsprice example, explain the result, then change one input and compare the output.
Related Finance functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how blsprice is executed, line by line, in Rust.
- View the source for blsprice in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.