0% found this document useful (0 votes)
6 views5 pages

CSC204 Study Notes

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

CSC204 Study Notes

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 · What is Computational Finance?

A field that combines Computer Science + Math + Statistics + Finance to solve financial problems using
algorithms and models.

Key Application Areas


Area What it does Example

Risk Management Assess potential losses Bank checks if a customer can repay a loan

Algorithmic Trading Automated buying/selling Bot buys low, sells high automatically

Portfolio Optimization Best investment mix Advisor picks best stocks/bonds combo

Derivatives Pricing Value complex contracts Pricing an oil futures option

Market Simulations Forecast price movements Hedge fund tests economic scenarios

2 · Why Computational Finance Matters


Traditional finance used manual calculations. Modern markets need speed and accuracy due to big data
and high-frequency trading.

Computational Finance enables:

• Fewer errors in financial calculations


• Processing massive datasets at high speed
• Real-time automated decision-making

3 · Components of Computational Finance


A · Mathematical Foundations
Branch Purpose Example

Probability & Stats Predict risk & uncertainty Chance a borrower defaults on a loan

Linear Algebra Manage large datasets Track stock connections in a portfolio

Calculus / Diff. Equations Track price changes over time How interest rates affect mortgage payments

Stochastic Processes Model random events Predict Bitcoin price swings


B · Computer Science & Programming
• Data Structures & Algorithms — Organise and sort financial data fast
• Programming (Python, R, C++, MATLAB) — Automate trading models and financial calculations
• Machine Learning & AI — Detect fraud, predict market trends

C · Financial Models
• Modern Portfolio Theory (MPT) — Diversify investments to reduce risk
• Black-Scholes Model — Calculate fair price of stock options

4 · Computing Asset Returns


An asset return = the profit or loss from an investment, expressed as a percentage.

A · Simple Return
Measures how much an asset's price changed relative to its previous price.

R = (Pt − Pt−1) ÷ Pt−1

Where: Pt = current price | Pt−1 = previous price

■ Example — Stock Return


Buy a stock at ■100. It rises to ■120.
R = (120 − 100) ÷ 100 = 20 ÷ 100 = 0.20 → 20%

■ Example — Dangote Stock


Buy at ■150, price rises to ■180.
R = (180 − 150) ÷ 150 = 30 ÷ 150 = 0.20 → 20%

■ Example — Bitcoin
Bitcoin: ■30,000 yesterday → ■31,500 today.
R = (31,500 − 30,000) ÷ 30,000 = 1,500 ÷ 30,000 = 0.05 → 5%

B · Logarithmic (Log) Return


Uses natural logarithm (ln). Useful when comparing returns over multiple periods — log returns can be
added together.

Rlog = ln ( Pt ÷ Pt−1 )

■ Example — Bitcoin Drop


Bitcoin: ■50,000 → ■48,000.
R_log = ln(48,000 ÷ 50,000) = ln(0.96) ≈ −0.0408 → −4.08%
Interpretation: Bitcoin lost about 4.08% of its value.
■ Simple return is easier to calculate. Log return is better for multi-period analysis.

5 · Random Variables & Distributions


A univariate random variable has a single value or outcome. Its distribution shows the probability of
different values.

Type Description Examples

Discrete Countable values (0, 1, 2 …) Bernoulli, Binomial, Poisson

Continuous Any value in an interval Uniform, Normal, Exponential

6 · Discrete Distributions
A · Bernoulli Distribution
Only 2 outcomes: Success (1) or Failure (0). Has a single parameter p = probability of success.

P(X = 1) = p P(X = 0) = 1 − p

E[X] = p Var(X) = p(1 − p)

■ Example — Fair Coin Flip (p = 0.5)


P(heads) = 0.5 P(tails) = 0.5
E[X] = 0.5 Var(X) = 0.5 × 0.5 = 0.25

B · Binomial Distribution
Repeats a Bernoulli trial n times. Asks: "What is the probability of exactly k successes?"

Conditions for Binomial

✔ Each trial has only 2 outcomes (success / failure)

✔ Probability of success p stays the same each trial

✔ Trials are independent

P(X = k) = C(n, k) × pk × (1−p)n−k

E[X] = n × p Var(X) = n × p × (1−p)

■ Example 1 — 3 coin flips, P(exactly 2 heads)


n = 3, p = 0.5, k = 2
P(X=2) = C(3,2) × (0.5)² × (0.5)¹ = 3 × 0.25 × 0.5 = 0.375 → 37.5%
E[X] = 3 × 0.5 = 1.5 | Var(X) = 3 × 0.5 × 0.5 = 0.75
■ Example 2 — 5 sensors, defect rate 10%, P(exactly 2 defective)
n = 5, p = 0.10, k = 2
P(X=2) = C(5,2) × (0.1)² × (0.9)³ = 10 × 0.01 × 0.729 = 0.0729 → 7.29%

C · Poisson Distribution
Models rare events occurring independently over time or space. Only needs the average rate λ — no
fixed number of trials.

P(X = k) = (λk × e−λ) ÷ k!

E[X] = λ Var(X) = λ

Note: e ≈ 2.718 and k! means k factorial (e.g. 3! = 3×2×1 = 6)

■ Example 1 — Bus arrivals (λ = 2 per hour, k = 3)


P(X=3) = (2³ × e■²) ÷ 3! = (8 × 0.1353) ÷ 6 = 1.0824 ÷ 6 ≈ 0.180 → 18%

■ Example 2 — Hospital patients (λ = 3 per hour, k = 2)


e■³ = 0.0498 3² = 9 2! = 2
P(X=2) = (0.0498 × 9) ÷ 2 = 0.4482 ÷ 2 = 0.2241 → 22.41%

7 · Continuous Distributions
Uniform Distribution
The simplest continuous distribution. Every value in the interval [a, b] has the same probability. Outside
[a, b], probability = 0.

f(x) = 1 ÷ (b − a) for a ≤ x ≤ b

■ Example — Uniform on [0, 5]


(a) Lower bound a = 0, Upper bound b = 5
(b) f(x) = 1 ÷ (5 − 0) = 1/5 = 0.2
(c) PDF defined for 0 ≤ x ≤ 5 ; outside this range f(x) = 0

8 · Likely Exam Questions


■ Focus on formulas + calculations — lecturers love numerical questions.

1
. Define Computational Finance. State three areas where it is applied.
2
. Calculate the simple return of a stock bought at ■200 and sold at ■250.

3
. Calculate the log return of an asset that moved from ■5,000 to ■4,600.

4
. What is the difference between simple return and log return?

5
. A coin is tossed 4 times. Find the probability of getting exactly 3 heads. (Binomial)

6
. A factory has a 5% defect rate. If 10 items are tested, find P(exactly 1 defective).

7
. On average, 4 calls come per minute. Find P(exactly 2 calls). (Poisson)

8
. State the PMF for Bernoulli and Binomial distributions. Write E[X] and Var(X) for each.

9
. What is a Uniform Distribution? Write its PDF and give a numerical example.

1
0 State the difference between Discrete and Continuous random variables. Give one
. distribution example of each.

1
1 List the four mathematical branches used in Computational Finance and what each
. does.

1
2
. Explain the Black-Scholes Model and Modern Portfolio Theory in your own words.

CSC 204 · Introduction to Computational Finance · Godfrey Okoye University · Slides 1–41

You might also like