[Review Notes] Introduction to Financial Computing

来源:互联网 发布:java https请求带证书 编辑:程序博客网 时间:2024/05/29 12:30

Basic Financial Arithmetic

Simple and Compound Interest

  • Simple Interest : TotalProceed=Principal×(1+interestratedaysyear)
  • Compound Interest : TotalProceed=Principal×(1+interestratedaysyear)N
  • Interest Rate:
    • The period for which the investment/loan will last
    • The absolute period to which the quoted interest rate applies
    • The frequency with which interest is paid

Nominal and Effective Rates

1+effectrate=(1+nominalraten)n
- effectiverate=(1+nominalraten)n1
- nominalrate=[(1+effectrate)1n1]×n

Daily Compounding
- Dailyequivalent=[(1+effectrate)13651]×365

Continuous Compounding
- 1+effectiverate=limx(1+rcn)n=erc
Continuously compounded rate : r=ln(1+i)
Nominal rate for a year : i=er1

Time Value of Money

Items Short-Term Investment Long-Term Investment Future Value
FV=PV×(1+i×daysyear)
FV=PV×(1+i×daysyear)N
Present Value
PV=FV1+i×daysyear
PV=FV(1+i×daysyear)N
yield
yield=(FVPV1)×yeardays
yield=(FVPV)1N1
effective yield
effectiveyield=(1+yield×daysyear)yeardays1
effectiveyield=(FVPV)365days1

for simple invest : yield=i
for compound invest : yield=i×daysyear

- PV=FV×DiscoutFactor

Simple Compound Continuous Compounding
FV=PV×(1+i×daysyear)
FV=PV×(1+i×daysyear)N
FV=PV×(ei×daysyear)
DF=11+i×daysyear
DF=(11+i×daysyear)N
DF=ei×daysyear


- IRR Internal Rate of Return
IRR : The one single interest rate used when discounting a series of future value to achieve a given net present value.
Example:
Example for IRR


Basic Financial Modeling

Modeling


Money Market

Terminology Explanation Eurodoller U.S. dollar-denominated deposits at banks outside of the U.S. Coupon Interest rate stated on an instrument when it is issued Discount Instrument An instrument which does not carry a coupon is a “discount” instrument. Discount equals the difference between the price paid for a security and security’s par value. Bearer / registered A “bearer” security is one where the issuer pays the principal (and coupon if there is one) to whoever is holding the security at maturity. Fixed Income Security Money market instrument whose future cash flows have been contractually defined and can be determined in advance. Yield to Maturity YTM is the rate of return that you would achieve on a fixed income security, if you bought it at a given price and held it to maturity LIBOR, HIBOR Interbank offered rate – interest rate at which one bank offers money to another bank. Eurodeposit Round-the-clock business spanning Singapore and Hong Kong, Bahrain, Frankfurt, Paris, London and New York
  • Eurodeposit

    • LIBOR
      The rate dealers charge for lending money (they offer funds)
    • LIBID
      The rate dealers pay for taking a deposit (they bid for funds)
    • In London, quote (offered rate – bid rate), Other places, quote (bid rate – offered rate)
    • Rule: pay the higher rate for a loan, receive the lower for a deposit
  • DAY/YEAR Conventions

    • Interestpaid=interestratequoted×daysinperioddaysinyear
    • Most money markets use ACT/360
      Interest rate on 360-day basis = Interest rate on 360-day basis ×360365
    • Exceptions using ACT/365:
      Interest rate on 365-day basis = Interest rate on 365-day basis ×365360
      • International and domestic:
        Sterling, Hong Kong dollar, Singapore dollar, Malaysian ringgit, Taiwan dollar, Thai baht, South African rand.
      • Domestic (but not international):
        Japanese yen, Canadian dollar, Australian dollar, New Zealand dollar

Money Market Instruments

Compare

Instrument Term Interest Quotation Currency Settlement Registration negotiable Issuers Time deposit / loan 1 day to several years, but usually less than 1 year usually all paid on maturity as an interest rate any domestic or international currency generally same day for domestic, 2 working days for international no no Certificate of deposit (CD) generally up to one year usually pay a coupon as a yield any domestic or international currency generally same day for domestic, 2 working days for international usually in bearer form yes Bank Treasury Bill (T-bill) generally 13, 26 or 52 weeks mostly non-coupon bearing, issued at a discount US and UK a “discount rate” basis; most places on a true yield basis usually the currency of the country bearer security yes Government Commercial Paper (CP) for US, from 1 to 270 days; usually very short-term for ECP, from 2 to 365 days; usually 30 to 180 days non-interest bearing; issued at a discount for US, on a “discount rate” basis for ECP, as a yield for US, domestic US dollar;for ECP, any Eurocurrency but largely US dollar for US, same day;for ECP, 2 working days in bearer form yes Corporation Bill of exchange / Banker’s acceptance From 1 week to 1 year but usually < 6 months non-interest bearing; issued at a discount for US and UK, quoted on a “discount rate” basis elsewhere on a yield basis mostly domestic available for discount immediately on being drawn none yes Repurchase agreement (repo) usually for very short-term difference between purchase and repurchase prices as a yield any currency Generally cash against delivery of the security n/a no Government / Bank
  • CD - Pricing
    Price=presentvalue
    maturityproceeds=facevalue×(1+couponrate×couponperiod(days)year
    Price=facevalue×(1+couponrate×couponperiod(days)year)1+interestrate×dayspurchasetomaturityyear
  • CD - Return
    yield=(FVPV1)×yeardays
    yield=(salepricepurchaseprice1)×yeardaysheld
    yield=((1+interestratepurchase×dayspurchasetomaturityyear)(1+interestratesale×dayssaletomaturityyear)1)×yeardaysheld
  • Discount rate quote
    Price=FaceValue×(1DiscountRate×daystomaturityyear)
    Price=FaceValue1+yield×daystomaturitysyear
    yield=discountrate1discoutrate×daystomaturityyear
    discountrate=yield1+yield×daystomaturitysyear

Forward Rate Agreements (FRAs)

Forward-forward

  1. A cash borrowing or deposit which starts on one forward date and ends on another forward.
  2. The term, amount and interest rate are all fixed in advance.
    forwardforwardrate=[(1+iL×dLyear)(1+iS×dSyear)1]×yeardLdS

    L and S stand for longer and shorter period respectively

Forward Rate Agreements

  1. off-balance sheet instrument
  2. fix a future interest rate
  3. on the agreed date (fixing date), receives or pays the difference between the reference rate and the FRA rate on the agreed notional principal amount
  4. Principal is not exchanged
  5. Settles at the beginning of the period

Hedging with FRA
His flow will therefore be : - LIBOR
+ LIBOR
- FRA rate
————–
net cost : - FRA rate

EXAMPLE
Usually two days before the settlement date, the FRA rate is compared to the agreed reference rate (LIBOR).

Settlement Paid

settlementpaid=interestamountdiscountrate

- Period < 1year
Buyerpaid=notional×(FRARateLIBOR)×daysyear1+LIBOR×daysyear
- Period > 1year
FRAsettlement=Principal×(fL)×d1year1+×d1year+(fL)×d2year(1+×d1year)×(1+×d2year)
如果参照利率(e.g., LIBOR)比协议利率为高(>), 卖方需支付给买方合约差额;
反之,如果参照利率比协议利率为低(<),买方需支付给卖方合约差额。

Constructing a strip

The interest rate for a longer period up to one year =

[(1+i×d1year)×(1+i×d2year)×(1+i×d3year)×...1]×yeartotaldays


Futures Contract

Futures

  • A contract in which the commodity being bought or sold is considered as being delivered (may not physically occur) at some future date
  • Exchange traded (vs OTC in “forward”)
  • Contract standardized by exchange
  • Pricing depends on underlying commodity

Quotation

Futuresprice=100(impliedforwardinterestrate×100)
Futures & FRAs are in opposite directions :

Dealing

  • Open outcry
    buyer and seller deal face to face in public in the exchange’s “trading pit”
  • Screen trading
    designed to simulate the transparency of open outcry

Clearing

Following the confirmation of a transaction, the clearing house substitutes itself as a counterparty to each user and becomes

  • the seller to every buyer and
  • the buyer to every seller

Margin Requirements

  • Initial Margin
    • Collateral for each deal transacted
    • Protect clearing house for the short period until position can be revalued
  • Variation (Maintenance) Margin
    • Marking to market
    • Paid daily based on adverse price movements
      

Profit and Loss

Profit/los s on long position in a 3-month contract :
Profit/loss=numberofcontract×contractamount×pricemovement100×14

Hedging FRA with Futures

  • Settlement for FRA = Profit or loss on sold futures
  • Hedge required is the combination of the hedges for each leg
e.g.,• Sell 3x6 FRA + Sell 6x9 FRA, hence hedged by• Sell 10 June futures + Sell 10 Sept futures

Imperfect FRA Hedging with Futures

  1. Future contracts are for standardized amount
  2. Futures P&L are based on 90-day period rather than 91 or 92 days as in FRA
  3. FRA settlements are discounted but futures settlements are not.
  4. Future price when the Sept contract is closed out in June may not exactly match the theoretical forward- forward rate at that time
  5. Slight discrepancy in dates.

Open Interest : number of purchases of contract not yet been reversed or “close out”
Volume : total number of contracts traded during the day
3v8 FRA: 3v6+(3v93v6)×daysin3v8daysin3v6daysin3v9daysin3v6
5v10 FRA:3v8+(6v113v8)×daysinfixing5v10daysinfixing3v8daysinfixing6v11daysinfixing3v8
这里写图片描述

Arbitrage

Any must win strategy?
buy-buy / sell-sell


Interest Rate Swaps (IRS)

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 which one party exchanges a stream of interest payments for another party’s stream of cash flows.

Hedging with FRA
Hedging with FAR
Hedging with IRS
Hedging with IRS

Characteristics of IRS

  • Similar to FRA
    • No exchange of principal
    • Only interest flows are exchanged and netted
  • Different from FRA
    • Settlement amount paid at the end of relevant period

Motivation: win-win

Type of Swap

  • Coupon Swap
    Party A pay fixed interest rate and receive floating interest rate from party B
  • Basis Swap
    Floating vs floating but on different rate basis
    e.g.,
    basis swap
  • Index Swap
    The flow in one / other direction are based on index
    e.g.,
    index Swap

Valuation of Swap

Swap

  • Long Swap = + Long a Fixed rate bond - Floating rate borrowing
  • Swap Value = + PV of Fixed leg cashflow - PV of floating leg cashflow
  • Swap = NPV of Fixed leg cashflow
  • At inception, NPV = 0

NPV=P+ni=1CiDi+PDn
NPV=0

Dn=(1rn1i=1tiDi)1+rtn;
r=1Dnni=1tiDi
where:
P = hypothetical principal notional
ti = day count fraction of each interest payment period i
Ci = cashflow at time period i=P×r×ti
Di = discount factor at time i
Dn = discount factor at time n. (e.g., at maturity)
r = swap par rate (fixed leg)


Construction of Yield Curve

Definitions

  • The relationship of interest rate for different maturity
  • Market rate of interest for:
    • theoretical zero coupon instrument
    • matures at any future date
  • Derived from
    • prices of real financial instrument
    • trade in a liquid market

Type

  • Curve Shape
    • positive
    • negative
    • flat
  • Curve Categories
    • Par Yied Curves
    • Zero Coupon Yield Curve
    • Forward Rate Yield Curve

Example

Example
forward rate = (100D2100D11)×yearperiod=(D1D21)×yearperiod
Therefore, D2=D11+forwardrate×periodyear
Base on that and construct further, and this formula use again & again to construct the yield curve.

Quick Recap

Over night

ontn
DON=11+RON(1365)

DTN=DON1+DTN(1365)

Money Market

YM of money market
D=11+r×t

r=[1D1]×1t

e.g., DF3M=11+r3M×t3M

FRA

YM of FRA
r=DSDEDE×t

DE=DS1+rt
where,
DS: Discount factor on forward start date
DE: Discount factor on forward maturity date
t : period of FRA
r : FRA forward rate

SWAP Valuation

YM of SWAP
NPV=P+ni=1CiDi+PDn
NPV=0
Dn=(1rn1i=1tiDi)1+rtn;

r=1Dnni=1tiDi

(点与点之间可以通过一次函数求解)

Zero Coupon Rate

YM of ZC
Dt=1(1+ZCt)days/year
ZCt=(1Dt)1days/year1


Options

Options Basic

  • Options:
    gives the buyer the right to buy or sell a specified quantity of an underlying asset at a specific price (premium) within a specified period of time.

  • Terminology

Terminology Explanation Strike price / Exercise price Price at which the option buyer has the right to buy or sell the underlying Expiration Date on which the holder / buyer of the option loses the right to buy or sell Premium The amount paid by the option buyer to the option writer for the right Exercise Process of deciding and advising option seller of intention to exercise the right under the option In the money It is likely that the option will be exercised based on current underlying market price (e.g.,65 –>68) Out of money It is unlikely that the option will be exercised based on current underlying market price(e.g.,65 –>62) At the money The strike price of option is equal to the current underlying market price Call option Option buyer has the right to buy the underlying (prise rise) Put option Option buy has the right to sell the underlying (pride fall)
  • Feature of Option
    • Exercise style
      • European option : An option that can only be exercised on the day of expiry
      • American option: An option that can be exercised at anytime from the date of purchase until it expires (More expensive)
    • Option Exercise Settlement
      • Physical Settlement : the option is actually delivered with the underlying. The option seller of the option must deliver to the buyer of the option with the pre- defined amount of underlying
      • Cash Settlement : cash is settled for the difference between the underlying market price and the option strike price
    • OTC vs Exchange
      • OTC:(over the counter)
        customized contacts between 2 counterparties
      • Exchange Trade Contract
        The standardized contracts listed in Exchange
        Margin call system with daily mark-to-market
        Exchanges include: SIMEX, LIFFE, CBOT, CME , etc

Option Price

Popt=Pstock×Prob(P)X ; where x = Strike

Option Price = Intrinsic Value + Time value

  • Intrinsic Value
    • Call option : Intrinsic value = Underlying price – Strike price
    • Put option : Intrinsic value = Strike price – Underlying price
  • Time Value
    • Time value = option price – Intrinsic value
    • The risk that the option will move in the money before expiry
State Call Put Remarks In-the-money X < S X > S Intrinsic Value > 0 At-the-money X = S X = S Strike price = Underlying security price Out-of-the-money X > S X < S Intrinsic Value = 0 (Have the right to exist) Intrinsic Value Max (0, S – X) Max (0, X – S)

where
X = Strike / Exercise price;
S = Underlying asset price
put call

  • Complex Strategy
    • Straddles
      Long Straddles: buying a call and put at the same strike
      Straddles
    • Strangles
      Long Strangles: buying a call and put at different strike (call strike > = put strike)
      Strangles

Option Pricing

Put Call Parity Relationship

The arbitrage relationship which links European options markets to cash markets.
C = Call premium
P = Put premium
X = Option strike price
T = Time to maturity
ST = Stock price at maturity (or forward price)
1. Alternative 1: C + long Bond PV(X)
Buy 1 Call (C) with strike X and long Bond at PV of strike X.

ST < X ST > X Long Call 0 STX PV(X) X X Total Payoff at T X ST

2. Alternative 2 : P+ S0
Long Put (P) with strike X and long Physical Stock at S0

ST < X ST > X Long Put XST 0 PV(X) ST ST Total Payoff at T X ST

Both alternatives have same payoff at T
Therefore, to avoid arbitrage at T0,
C+BorrowingPV(X)=P+S0
or CP=S0BorrowingPV(X)
or CP=S0XerT
or C=P+S0XerT
Put-Call Parity

Binomial Model

  • Assumption
    • The stock price follows a random walk
    • In each time step, it has a certain probability of moving up or down by a certain amount
    • Arbitrage opportunities do not exist
    • In the riskless portfolio, the return it earns must equal the risk-free interest rate
  • Binomial Model Parameter
    • Input parameter
      S = Current Stock Price
      X = Stock Call Option Strike/Exercise Price
      T = Option life expiration in year
      σ = Volatility
      r = Risk free interest rate
      n = no. of steps in bonomial tree
    • Intermediate calculated parameter
      p = Risk neutral probability of up jump size
      u = Up jump size (e.g.ΔS = 10%, u = 1.10)
      d = Down jump size
      ∆t = period interval in each binomial nodes = T/n
    • To estimate
      f=Currentoptionprice

Generalization

– Current Up at T Down at T Stock Price S Su Sd Derivative Price f fu fd

generalization
where ∆ is Hedge Ratio

Then, Derivative Price
r = risk-free interest rate
PV of portfolio = (SuΔfu)erT
Thus, SuΔf=(SuΔfu)erT
f=erT[pfu+(1p)fd]
where p=erTdud
Thus, SerΔt=pSu+(1p)Sd
u=1d condition by CRR
At last,
p=erΔtdud ; u=eσΔt ; d=eσΔt

Black Sholes Model

  • Recall Ito’s Lemma
    dx=a(x,t)dt+b(x,t)dz
    If G(x,t) is some function of x and t,
    dG=(Gxa+Gt+122Gx2b2)dt+Gxbdz
  • Black Sholes Model
    dS=μSdt+Sdz
    With a=μS, b=S, applying to Ito’s Lemma, taking G=C=max(STX,0)
    we have dC=(CSμS+Cpartialt+12σ2S22CS2)dt+CSσSdt
    Black Sholes Model

Option Greeks

  1. Delta
  2. Gamma
  3. Vega
  4. Theta
  5. Rho

Risk Management

There is no return without risk
- Market Risk
- Credit Risk
- Liquidity Risk
- Operational Risk
- Model Risk
- Settlement Risk
- Regulatory Risk
- Legal Risk
- Tax Risk
- Accounting Risk
- Sovereign and Political Risk

0 0
原创粉丝点击