**Welcome to THETAWIKI**. If you like to create or edit a page please make sure to login or register an account. All registered users please make sure to provide a valid email address.

# Payoff Description Language

## Contents

# ThetaML Payoff Description Language

ThetaML payoff description language describes the complete structure of financial products independently from the underlying stochastic processes that may be applied to them. The specifications are used in pricing, simulations, risk managements, and other processing environments, with the guarantee that behaviors across these environments are consistent. Product specifications represent operator objects that ThetaML models can analyze and translate into equivalent definitions.

ThetaML payoff language explicitly incorporates the passage of time. Path dependencies, settlements, reinvestments and early exercises are all appropriately addressed. ThetaML presents a number of extended advantages:

- Procedural extension for time stepping.

ThetaML overcomes the limitations for "time travel" facing other payoff languages. ThetaML operates on a virtual timing model. The `Theta` command describes the time-determined behavior of financial derivatives and allows time to pass.

- Virtual multi-threading.

ThetaML can model simultaneous processes and enable cross-dependencies among the stochastic variables.

- Simplified vector notation for state variables

ThetaML implicitly handles scenario- and time- indices. Variables defined in ThetaML represent a stochastic process. They do not require explicit scenario- or time- indices.

- Flexibility to change models, numerical methods and contract execution rules.

ThetaML treats the structure of financial products as operator objects that are compositional and can be combined. This feature leads to customized pricing algorithms in model definitions. It also facilitates the concurrent deployment of simple models, for pricing, risk management and other operational purposes.

- Efficient pricing.

ThetaML generates pricing code dynamically for transitions of state variables.

- Resolved market conventions and trade rules.

With ThetaML, quants do not have to deal with market conventions and trade rules, they can focus on the mathematics of valuation models.

## Separation of Concerns

The goal of ThetaML as a Payoff Description Language is the Separation of Concerns, which means the payoff description should be universally used in different pricing algorithms.

## Using Interfaces

Interfaces are a simple way to ensure that different payoff descriptions can be used with the same pricing models.

The following is a ThetaML interface model to ensure that all the subsequent payoff description models export their exercise values in the name `ExcerciseValue_CUR `.

interface IExercisableOption export ExcerciseValue_CUR "Excercise value" end

# Payoff description examples

The options contracts in the following examples have different payoff profiles, and their exercise values are described by `ExcerciseValue_CUR `.

The `ExcerciseValue_CUR ` can be subsequently imported into an exerciser model to compute exercise strategies. Depending on the valuation context, the imported `ExcerciseValue_CUR ` can be from a `EuropeanPut`, `AmericanPut`, or `BermudanPut`.

In all the option payoff examples, the economic state variables are described by the underlying stock process `S` and the numeraire `CUR`, where `S` and `CUR` are simulated by some stochastic models and are subsequently imported as processes into the payoff description models.

## European Option

Now, it is easy to describe a European option just by its exercise values: The exercise value `ExcerciseValue_CUR ` in currency `CUR` is zero until maturity. Then, at time `T`, the exercise value in currency `CUR` is `max(K - S, 0) * CUR ` and immediately after maturity (`Theta @dt`), the value is zero again.

model EuropeanPut implements IExercisableOption %This model implements the interface IExercisableOption %it returns the exercise values ExcerciseValue_CUR for a European put import S "Stock prices" import CUR "Numeraire values" import K "Strike price" import T "Option Maturity" export ExcerciseValue_CUR "Excercise value" %time 0 exercise value ExcerciseValue_CUR = 0 %Theta advances time by T time units Theta T %at maturity T, assign the exercise values; %the exercise values are discounted to time 0 by the numeraire CUR ExcerciseValue_CUR = max(K - S, 0) * CUR % rigtht after Maturity, exercise value is 0 again %Theta passes time by @dt to the next model time Theta @dt ExcerciseValue_CUR = 0 end

## American Option

In this setting, an American Option is also easy to define: The exercise value `ExcerciseValue_CUR` is defined as `max(K - S, 0) * CUR` at each possible time until maturity. After maturity, the exercise value is zero:

model AmericanPut implements IExercisableOption %This model implements the interface IExercisableOption %it returns the exercise values ExcerciseValue_CUR for an American put import S "Stock prices" import CUR "Numeraire values" import K "Strike price" import T "Option maturity" export ExcerciseValue_CUR "Excercise value" %immediate exercise value ExcerciseValue_CUR = max(K - S, 0) * CUR %an infinite loop, its loop length extends automatically to the lifetime of a pricing application loop inf %Theta @dt passes time to the next model time Theta @dt %@time extracts the model time that has passed so far if @time <= roundt(T) ExcerciseValue_CUR = max(K - S, 0) * CUR else ExcerciseValue_CUR = 0 end end end

## Bermudan Option

A hybrid of European Options and American Options is the Bermudan Option. It allows the exercise of the option at discrete times. In this ThetaML example, we simply import a time grid `TimeGrid` which defines the possible exercise dates. Just after each exercise date (`Theta @dt`) the exercise value `ExerciseValue_CUR` is zero again:

model BermudanPut implements IExercisableOption %This model implements the interface IExercisableOption %it returns the exercise values ExcerciseValue_CUR for a Bermudan put import S "Stock prices" import CUR "Numeraire value" import K "Strike price" import T "Option maturity" import TimeGrid "Excercise times" export ExcerciseValue_CUR "Excercise value" %time 0 exercise value ExcerciseValue_CUR = 0 %loop through the exercise times loop t:TimeGrid % theta t-@time advances time to the next exercise time theta t-@time %exercise values at this exercise time ExcerciseValue_CUR = max(K-S,0) * CUR % rigtht after each exercise time, exercise value is 0 again Theta @dt ExcerciseValue_CUR = 0 end end