Plotting payoff diagrams with FSharpCharts

In this section, we'll construct basic payoff diagrams for European call and put options. Payoff diagrams are useful to visualize the theoretical payoff given the price of the stock and the strike of the option.

The payoff function for a call option is defined as follows:

Plotting payoff diagrams with FSharpCharts

And the payoff function for a put option is defined as follows:

Plotting payoff diagrams with FSharpCharts

Let's look at how to do this in F#. We start by defining the payoff functions for calls and puts:

/// Payoff for European call option // s: stock price // k: strike price of option ...

Get F# for Quantitative Finance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.