QF Workshop 2026
Current location: Home > Workshops > QF Workshop 2026

QF Workshop #1 - Introduction to Computational Finance

Posted:2026-10-29 08:37:24 Click:166

 

 

QF Workshop #1: Introduction to Computational Finance

Duration: ~1 hour  |  Instructor: Dr. Raymond Lee

This self-contained session covers the core foundations of computational finance: securities, interest calculations, stocks, options basics, and a short Python lab. No PPT needed.

1. Financial Securities Overview (8 min)

Securities are negotiable financial instruments representing value. Three main categories:

  • Debt – Risk-free instruments such as government bonds, commercial notes, and bank deposits.
  • Equity – Shares of a company (common stock gives voting rights; preferred stock has priority on dividends but usually no vote).
  • Derivatives – Instruments whose value depends on an underlying asset (futures, options, forwards).

Most securities trade on organised exchanges (NYSE, Nasdaq, HKSE, LSE, SSE, Euronext, etc.).

2. Bonds and Compound Interest (15 min)

Bonds are long-term loan contracts. The issuer (borrower) receives principal and pays interest (coupons) until maturity. The holder (lender) receives the principal back plus interest.

Discrete Compounding

For principal P0, annual rate r, n years:

Discrete Compound Interest

With m compounding periods per year:

Discrete with m periods Discrete Compound Interest Growth

Continuous Compounding

Taking the limit as m → infinity:

Continuous Compounding

Example: P0 = 100, r = 0.1, τ = 1 year → P1 ≈ 110.52

Relationship between discrete rate R and continuous rate r:

Continuous rate from discrete Python Compound Interest Growth
Profit for a bond (no fees, risk-free): Profit_τ = P_τ − P0

3. Stocks: Trading Orders and Payoff (10 min)

  • Market Order – Execute immediately at the current market price.
  • Limit Order – Execute only at a specified price or better.
  • Stop Order – Becomes a market order once the stop price is reached (used for stop-loss and stop-gain).

Market capitalisation = shares outstanding × price per share.

Risk-adjusted profit of one share (continuous compounding, no dividends/costs):

Risk-adjusted stock profit

Including dividends D_τ and transaction costs C:

Profit = S_T + D_τ − C − S0 × e^(r × τ)

4. Options and Derivatives Basics (8 min)

An option gives the right (but not the obligation) to buy (Call) or sell (Put) an asset at a fixed strike price K by (or on) the expiration date.

  • European – Exercise only at expiration.
  • American – Exercise any trading day on or before expiration.
  • Other styles (Bermudan, Asian, Barrier) exist but are exotic.

Option premium is quoted per share; one contract usually covers 100 shares. Call payoff at expiration: max(S_T − K, 0). Profit = payoff − premium paid.

5. Mini Python Lab (10 min)

pip install yfinance pandas numpy matplotlib

import numpy as np
import yfinance as yf

# Continuous compounding
P0, r, tau = 100, 0.1, 1
print("Continuous value:", P0 * np.exp(r * tau))

# Fetch stock data (example: Apple)
data = yf.download("AAPL", start="2024-01-01", end="2024-12-31", progress=False)
print(data["Close"].tail())
print("Mean close:", data["Close"].mean())

Workshop Exercise 

  1. Write a Python function discrete_compound(P0, r, m, n) that returns P_n = P0 × (1 + r/m)^(n × m). Test it with P0=1000, r=0.06, m=4, n=5.
  2. Using NumPy, compute the continuous compounding value of $500 at 5% for 3 years. Also compute the equivalent discrete rate for monthly compounding.
  3. Using yfinance, download the last 1 year of daily data for a stock of your choice (e.g. TSLA, 0700.HK, or AAPL). Print the first and last 5 rows of the Close column and the mean, max, and min close prices.
  4. In 2–3 sentences each, explain the difference between a Limit Order and a Stop Order, and when a trader might prefer one over the other.
  5. A call option has strike K=150 and premium = 8. Calculate the payoff and profit per share if S_T = 165. What is the payoff and profit if S_T = 140? Comment on the limited downside of the option versus owning the stock.

Submit your Python code (as a .py or Jupyter notebook) + written answers.

QF Workshop #1 – Computational Finance | Dr. Raymond Lee

到价提醒[关闭]