Financial Modeling
Financial Modeling Basic
to resolve the what if questions or make
projections
to represent in mathematical
terms for the
relationships among variables (dependent and
independent variables) of financial problems
2
Financial Modeling Pr

Bond
Overview
Capital Market instrument
Longer-term securities
Lending directly from investors to
borrowers
High creditworthiness borrowers
More cheaply than from bank
Fixed coupon paid at regular intervals
2
Bond Type
Domestic bonds
Issuer sells the bond

Curve Construction
Yield Curve
Market rate of interest for
Theoretical zero coupon instruments that
Matures at any future date
Derived from
Prices of real financial instruments that
Trade in a liquid market
2
Input points
Liquid market instruments do not

Financial Concepts
Review
Interest
5% is the nominal interest rate quoted for
a 1-year deposit when the interest is
paid all at maturity. What is the
quarterly equivalent?
2
Continuous Compounding
Equivalent rate with continuous compounding
for an annual

Security Price Model
Example Security Price
2
Wiener Process
Property 1
time changes, the value of z changes
The change z over a small period of time t is
z t
where is a random drawing from a standardized normal
distribution. + or - is possible
Property 2

Boost Shared Pointer
Problems with pointers
Forget to delete memory allocated on the heap
reassign the pointer to some other object and
cause a memory leak since the reference to the
original object is lost
exceptions can cause a failure to reach the
dele

The University of Hong Kong
FACULTY OF ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE
COMP 7802 Introduction to financial computing
Date: December 19, 2015
Time allowed
Time: 2:30pm-4:30pm
2 hours
Student I.D.
Only approved calculators as announced by the Exa

C+ Class
Review
1
Class Definitions
Defines a New Type
Class Members
data, functions or type definitions
Multiple public, private and protected Sections
public
accessible to all code that uses the type
private
accessible to other class members
pro

Quantlib
Date, Calendar, DayCounter,
Schedule
Date Class
QuantLib-docs-1.4-html/annotated.html
Data Member
private:
BigInteger serialNumber_;
TimeUnit
enum TimeUnit cfw_Days,Weeks,Months,Year
Period
Period(Integer n, TimeUnit units)
How to make 2*Months P

Interest Rate Swaps (IRS) - Review
Definitions
A swap is a derivative in which two counterparties
agree to exchange one stream of cash flows against
another stream.
These streams are called the legs of the swap.
An interest rate swap is a derivative in wh

Pattern - Bridge
Example Task
Drawing Shapes
Draw Rectangles
Using 2 Draw Programs (DP1 and DP2)
2
Not to Worry about DP1/DP2
except during initiation
3
More Requirement Support another shape
4
Class Explosion
What if we add another Drawing
Program?
How m

Box Muller
Generating Random Samples
of Distribution FY(y)
X is a random variable with uniform distribution
Generate samples of Y with distribution FY(y)
Y FY1 ( X )
FY1 ( x)
P(Y y )
P( X FY ( y )
FY ( y ) X is uniform distribute d
y
F ( y)
2
Box Muller

Quantlib
Observer/Observable, LazyObject
Observer & Observable
Observer Pattern
Change of an observable-state is updated
automatically in all observers
2
registerWith
Observer:registerWith(const boost:shared_ptr<Observable>& h)
cfw_
if (h) cfw_
h->registe