Interimreport1 January–31 March2024 Elo Mutual Pension Insurance Company
Analyzing the CDS market using CGP
1. Analyzing the Credit Default Swap Market Using
Cartesian Genetic Programming
based on the paper by L. Zangeneh and P. J. Bentley
from University College London
Karol Grzegorczyk
20-06-2013
2. Derivatives
A derivative is a financial instrument which derives its value from the value of
underlying entities
Classification by the relationship with underlying asset:
•
•
•
Options
Swaps
Forwards
Classification by the type of underlying asset:
•
•
•
Equity derivatives
Credit derivatives
Commodity derivatives
3. Credit Default Swap
Default means to fail to do something, such as pay a debt, that you legally have to do
There is a risk of default. The risk that debtor won't met their legal obligations
according to the contract
The lender can buy insurance in case of default. This insurance is called Credit
Default Swap.
In case of the event of default the buyer of the CDS (the loan lender) receives
compensation (usually the value of the loan)
CDS Spread is an amount of money that the buyer of the CDS regularly pays to the
seller
5. CDS trading
CDS contract can be treated as an investment instead of as an insurance!
Investors can buy CDS contracts referencing some debt without actually owning this
debt! It is called 'Naked CDS'.
The value of a contract fluctuates based on the increasing or decreasing probability
that a reference entity will have a credit event.
Increased probability of such an event would make the contract worth more for the buyer
of protection, and worth less for the seller. The opposite occurs if the probability of a
credit event decreases.
An investor with a negative view of some company's credit can buy protection for a
relatively small periodic fee and receive a big payoff if the company defaults on its
bonds or has some other credit event!
Arbitrage is the practice of taking advantage of a price difference between two or more
markets.
6. CDS pricing
To be able to invest in CDS it is needed to model corporate default risk
There are several approaches to modeling default risk. One of the approaches
is the Duffie model, a.k.a. no-arbitrage model. It is defined by a simple
equation:
CDSspread = RiskFreeRate - DebtReturn
RiskFreeRate - the interest that an investor would expect from an absolutely
risk-free investment over a given period of time
DebtReturn - measure of a company's performance based on the amount of
debt it borrowed (bond yield)
7. Problem statement
Duffie theory assumes that there is no risk free arbitrage.
In practice relationship presented on the previous slide does not hold exactly.
There is some possibility of an arbitrage. It is called arbitrage channel or
arbitrage gap.
Arbitrage gap is a problem. It would be desirable to to reduce it, to build the
CDS pricing model more close to reality.
What is the exact relationship between CDS spread, debt return and risk free
rate?
8. Stochastic optimization
Problem optimization is a search for the best solution among candidate solutions
based on the quality of the candidate solution.
To find optimal solution it is needed to do four things:
•
•
•
•
Provide one or more initial candidate solutions.
Assess the quality of a candidate solutions.
Make a copy of a candidate solution.
Tweak a candidate solution, which produces a randomly slightly different
candidate solution.
In order to invoke those functions on a single candidate solution it is needed to have
the representation of the candidate solution.
Often the representation is referred to as the data structure used to define the
candidate solution (a vector, a tree, etc.)
9. Evolutionary Computation dictionary
individual
a candidate solution
child and parent
a child is the Tweaked copy of a candidate solution (its parent)
population
set of candidate solutions
fitness
quality
fitness landscape
quality function
mutation
plain tweaking
recombination or
crossover
a special Tweak which takes two parents, swaps sections of them, and (usually)
produces two children. This is often thought as “sexual” breeding.
breeding
producing one or more children from a population of parents through an iterated
process of selection and Tweaking (typically mutation or recombination)
genotype or genome
an individual’s data structure, as used during breeding
chromosome
a genotype in the form of a fixed-length vector
gene
a particular slot position in a chromosome
phenotype
how the individual operates during fitness assessment
10. The representation of an individual
In order to tackle a problem using a EA, candidate solutions must be encoded
in a suitable form.
For example in the traditional GA solutions are represented by binary bit strings
('chromosomes').
Other form of representation can be:
•
•
•
•
•
•
a vector (e.g. a fixed-length vector of real-valued numbers)
an arbitrary-length list of objects
an unordered set or collection of objects
a tree
a forest (set of trees)
a graph
11. Genetic Programming
Evolutionary algorithm-based methodology using stochastic methods to search
for and optimize small computer programs or other computational devices.
In order to optimize a computer program, it needs to be evaluated as
suboptimal rather than simply right or wrong.
Computer programs are represented by trees or lists, that are formed from
basic functions or CPU operations
GP’s initialization and Tweaking operators are particularly concerned with
maintaining closure, that is, producing valid individuals from previous ones
The Lisp family of languages is particularly suitable for tree representation of
computer programs.
12. Evolutionary operations applied for GP
initialization - randomly build trees by selecting from a function set; function
define how many children they require.
fitness evaluation - run program and see how it do -> data is needed!
mutation - rarely used, e.g. pick a random subtree and replace it with a
randomly-generated subtree
crossover - Using subtree crossover. In each individual, select a random
subtree (which can possibly be the root). Then swap those two subtrees
13. Example
program:
sin(cos( x − sin x ) + x x )
in Lisp:
(sin
(+
(cos (−x (sin x)))
(∗ x (sqrt x))
)
)
graph representation
14. Cartesian Genetic Programming
Cartesian Genetic Programming (CGP) represents computational structures as
directed acyclic graphs which are represented as a two-dimensional grid of
computational nodes which are encoded in the form of a string of integers.
When representing graph as a grid some genes become 'non-coding' genes.
Integers represents the program primitives and how they are connected
together.
Program that results from the decoding of a genotype is called a phenotype.
Fitness report is the CGP output.
15. CGP encoding and decoding example
001 100 131 201 044 254 2573
0
1
2
3
+ Add the data presented to inputs
- Subtract the data presented to inputs
* Multiply data presented to inputs
/ Divide data presented to inputs (protected)
y2 = x0 + x1
y5 = x0 * x1
y7 = x0 * x1 * ((x0 - x0) - x1) = - x0x12
y3 = 0
16. Analyzing CDS market using CGP
Goal: find an algorithm/program/equation that calculate CDS spread
Only fundamental operators were selected as a function set:
add, subtract, multiplication, division, power, square root.
Data divided into training (400 data points) and test (1000 data points)
datasets.
Experiments were performed for different mutation rates and the number of
nodes
Fitness is calculated for each datapoint by defining the error rate
Error = | CGPoutput - Data|
18. Experiments Results
CGP has evolved completely different equation in each run, but some
components were repeated frequently:
•
•
x2 / x3
x2 - x3
Where:
x2 - buying price of bond
x3 - selling price of bond
In general created CDS pricing model is much more accurate compared to
the standard Duffi approach.
19. Bibliography
1. "Analyzing the Credit Default Swap Market Using Cartesian Genetic
Programming", L. Zangeneh, P.J. Bentley, Parallel Problem Solving from
Nature, PPSN XI, 2010
2. "Essentials of Metaheuristics, A Set of Undergraduate Lecture Notes", S.
Luke, Department of Computer Science, George Mason University, 2012
3. http://en.wikipedia.org/wiki/Credit_default_swap
4. http://www.investopedia.com/video/play/credit-default-swaps/
5. Book: "Cartesian genetic programming", J. F. Miller, Springer, 2011
6. Tutorial: "Cartesian Genetic Programming", J. F. Miller, S. L.
Harding, GECCO, 2012