**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.

# Separation of Concerns

## Contents

# Separation of Concerns (SoC)

ThetaML follows the "separation of concerns" design principle so that functions can be optimized independently of other functions. This allows us to work on a specific aspect of an application without having significant impact on other parts of the application. This "separation of concerns" aspect of ThetaML is achieved through modularity of programming and encapsulation, which makes it easier to understand, maintain and extend.

[|Theta Suite] is architected upon the payoff language ThetaML. It is a generic Monte Carlo engine. Through ThetaML, Theta Suite prices an arbitrary derivative independently from the underlying model implementations. Its Theta Orchestrator component allows one to build dynamics models by pulling together a market model that models the economic state variables, a payoff model that describes option payoffs and an exercise model that computes exercise strategies or option prices. This is smart for creating new products and easy for maintaining systems. Better still, Theta Suite parses scripted payoffs within the limits of a backend language such as Matlab.

Theta Suite has a built-in result analyzer with Matlab graphing capabilities. It can also present simulation results in Excel and Matlab for further analyses.

# The separation of concerns in an option pricing example

This section demonstrates the "Separation of Concerns" principle of ThetaML through the pricing of an American put. The market model simulates the state variables - the underlying stock and the numeraire - which are imported as processes into the payoff description model. The payoff description model describes the American put option payoff and exports the exercise values. The exercise values are imported as a process into an exercise model that computes the exercise strategy and returns the American put option price.

## Payoff Description

The American put option payoff is described through the model `AmericanPut` in Payoff Description Language. The model imports the numeraire and the stock prices simulated in the market model and computes the exercise values `ExerciseValue_CUR`.

## Exercise Model

The Exercise Model imports the exercise values `ExerciseValue_CUR` and computes the exercise strategy and American put option price. The exercise model can be a simple risk neutral exercise `RiskNeutralExerciserCash` or a variance optimal hedged `RiskNeutralExerciserCashHedged`.

## Numerical Tricks

The early exercise strategies in the American put option is evaluated with the ThetaML `E` function. The `E` function computes the conditional expected values based on the current information, it uses the least squares Monte Carlo regression method combined with the sparse grid basis functions.

The model `RiskNeutralExerciserCashHedged` uses a variance optimal hedge computed by the ThetaML `Beta` function to improve the accuracy of the option price.

## Market Model

The market model for pricing the American put consists of the computation of a numeraire under a Constant Interest Rate and the simulation of a Stock Price Process for the underlying.

## Combining the Models

Putting together the market model, the payoff description model, and the exercise model, the American put option is priced with each functionality a separate process independent from the others.