- 1 Introduction
- 2 What is ThetaML?
- 3 The Stochastic and the Structural Model
- 4 Language Features
- 5 Examples
- 6 Literature
One of the biggest modelling tasks faced by today's financial industry is presented by an inflation of new terminology describing innovative financial derivatives. Many expressions used by quantitative analysts are ambiguous and cause a significant friction in communication. It is hard to locate the difficulty in financial modelling. Payments or delivery of certain amounts are normally well known about. Sales people do have a clear idea of all the structural features of their traded products. But still they will not be able to quickly specify all of them in a precise manner.
As financial models, or in particular their structural part, grow above the complexity that is representable in a mathematical formula they tend to become difficult to maintain and to document precisely. Important details can often be found implicitly in the programming source code or in the legal documents defining the contracts with the customer. It should be clear, that the original goal of a financial model is to point to a unique mathematical problem for which solutions can be found numerically and or algebraically.
Currently there is no satisfactory standard for specifying the structural model. Therefore this document introduces a definition language that allows the specification of strategies in a way that is intuitive and precise. The language provides access to conditional statistical properties and some aspects of the sigma algebra, while still remaining simple and computable.
What is ThetaML?
ThetaML is the domain specific language which we propose for the structural features in financial engineering. Models in ThetaML can be represented graphically, in a ThetaML XML dialect or as a script file similar to a programming language.The ThetaML language is designed for derivatives pricing, risk management and optimisation of dynamic investment strategies.
A model written in ThetaML is independent of its algorithmic implementation. Whether an evaluation uses Monte-Carlo, PDE methods or even computer algebra does not affect the structural model.
The Stochastic and the Structural Model
The structure model captures the details of a financial model which graphically defines the interdependencies of parameters and stochastic variables. A stochastic model is required to supplement a structural model, whenever the latter references stochastic variables. It is defined in the notation of stochastic differential equations, which has proved to be useful and is widely used in the literature. The following stochastic model is used to provide numerical evaluations to all the ThetaML examples below. The variable S is the process for the discounted value of a stock with volatility 40%. The numeraire € models the discount factor drifting with a variable rate r: : dS = 0.4 dW1 S0 = 100 : d€ = −r dt €0 = 1 : dr = 0.1(0.04-r)dt + 0.2rdW2 r0 = 0.04 The use of a currency symbol allows the direct notation of cash amounts together with the appropriate discount curve. In larger models multiple currencies might occur.
All models describe a chronological order of operations. The order begins with an initial state, from which various connectors can originate. A model consists of operators and connectors. They may not be circular connections, but the final operator may connect back to the initial state if the graph should be closed.
Flow connectors can connect two operators. They indicate the chronological order of two operators in a model. The chronological order of operators may not be confused with their algorithmic order. Individual operators may have to evaluated in different order, or may even have to transformed into a differential equation before being evaluated as a whole and not as individual steps.
Theta connectors are special connectors that specify a chronological time span that passes before continuing with the next operator. The time length refers to simulated time, which is used to synchronize different operation sequences. The time length also causes the stochastic model to evolve over that time.
Assignments of variables work as known from computer programming languages. A variable of an assignable expression on the left hand side as assigned a value or a formula. I is important to realize that the assignment only accesses the current value of the right hand side expression. The value of the left hand side variable is never changed unless explicitly assigned a new expression.
A special feature of ThetaML is availability of functions that depend on the models chronological future.
X+ refers to the next value assigned to X, rather than the previous one
E(X) evaluates the conditional expected value of the value assigned to X, i.e.
the best guess based on parameters known at model time.
BETA(X,Y) evaluates the conditional beta between X, Y
Multi threading is initiated whenever multiple connectors originate from one operator or from one start node. Both threads are executed virtually parallel. Concurrent write operations are not allowed. If read and write occurs simultaneously, read always accesses the variable's new value, i.e. its value after the assignment operation.
Loops can be defined by iterating over a predefined numeric range or by iterating over all elements in the associated list. In the later case the iteration range is determined automatically.
Decision Operator is pretty much an equivalent of the corresponding element in flow charts. Its effect is known from computer programming languages as if-then-else constructions.
Calls represent references to other models, consisting of a start node and probably a sequence of operators. Module calls are determined by the name of the external model and by variables that are imported from and exported to the distant model. A locally defined variable or formula can be exported to the external model as indicated by a right pointing arrow. Importing variables that are defined by the external model is indicated by a left pointing arrow. Variable passing in both direction is done by reference but immutable. The external model can not change the value of the exported variable, but sees any changes performed by the calling model. Later is relevant in concurrent execution, where two threads can communicate by writing to these variables.
A Put Option gives the holder the right to sell an underlying asset at a certain date, known as the expiration date or maturity (T), for a certain price, known as the exercise price or strike price (K). The profit originating from the option is the strike price in EUR (K€ ) minus the actual price (S).
The model price process describes a process for an option price. After initialisation two connections leave the start point. The rounded rectangle calls our previous model and imports the value V . The section branch enters a loop in which the conditional expected value of V is repeatedly evaluated. The expected option value divided by the value of 1€ gives us its price in units of our chosen currency.
A Payment of an option can be hedged by a continuous trading strategy investing in δ stocks and B fixed income products. The final payment is replicated with low risk on a single value today. Instead of pricing the option as an expected value we also replicate it in a dynamic portfolio, a method which works also in incomplete markets with a real-world measure and without risk neutral probabilities. Π is the value of the replicating portfolio, B the number of bonds, δ the number of stocks and dt is the hedging interval.
- Stefan Dirnstorfer, Multiscale calculus with applications in quantitative finance, in Intelligent Finance, Melbourne, Dezember 2004, pp 131-143, 2004
- A. J. Grau, A Monte Carlo Method for Option Pricing in the Real World, working paper, Munich Technical University, 2006, email@example.com
- Paul Wilmott , Sam Howison and Jeff Dewynne, The Mathematics of Financial Derivatives