You are on page 1of 10

FX Concept Reboot

All IR or FX derivatives are derived from an underlying random variable, which is called an index, such as USDLIBOR3M, USDJPY
spot. A contingent claim must specify a payoff, it is a function dependent on the random variable, a fixing day and a settlement day
(or a list of fixing and settlement days for structured product). Fixing and settlement steps are decoupled and independent. Pricing
of a contingent claim involves solving for the distribution of the index as of today (the index is stochastic as of today, it will become
deterministic on fixing day). For linear product like forward contract, only expectation of the distribution matters, hence there is no
need to solve for the whole density function, for nonlinear product like option, volatility kicks in.

Once we have defined the index or underlying random variable, we can then describe the random process of the index with a SDE.
In case of analytic pricer, the SDE is not involved in engine implementation, because we must either (1) derive a BSPDE or a Heston
PDE from the SDE, and solve for the price analytically using contingent claim’s payoff as boundary conditions, or (2) derive the pdf
of index on fixing day given market data today, and perform risk neutral pricing. However for Monte Carlo simulation or binomial
tree, SDE must be involved in the implementation of pricing engine, hence we need to define clearly how the dynamics in the SDE
work, for FX in particular. However, before that, we need to clarify our notations.

0 = reference time of curve / date corresponding to available market data


t,s, = time index in SDE, it is moving, starts from today, propagates towards maturity, helps to define dynamics
T = contract maturity date / fixing date of index / determination of payoff amount (but not yet paid)
T +nfd = payment date / settlement date

Apart from t, s and , all other variables remain constant as time proceeds. On approaching maturity, timepoint T is fixed, while the
time-to-maturity T- t decreases.

R0,t,T = forward zero rate from time t to maturity T as of today 0


R0,T = R0,0,T = current zero rate from time 0 to maturity T
r0,t = R0,t,t+dt = instantaneous rate at time t as of today 0, SDE normally describes its random process

Similarly, we can define term volatility and instantaneous volatility.

0,t,T = forward term volatility from time t to maturity T as of today 0


0,T = 0,0,T = current term volatility from time 0 to maturity T
0,t = 0,t,t+dt = instantaneous volatility at time t as of today 0, SDE normally describes its random process

We have their correspondence in QuantLib :

R0,t,T = YieldTermStructure::forwardRate(t,T)
R0,T = YieldTermStructure::zeroRate(T)
r0,t = YieldTermStructure::forwardRate(t,t+dt)
0,t,T = BlackVolTermStructure::blackForwardVol(t,T,strike)
t,T = BlackVolTermStructure::blackVol(T,strike)
0,t = BlackVolTermStructure::blackForwardVol(t,t+dt,strike)

Sometimes we use variance instead of volatility, variance is the time integral of volatility square.

20,t,T (T-t) = BlackVolTermStructure::blackForwardVariance(t,T,strike)


20,T T = BlackVolTermStructure::blackVariance(T,strike)
20,tdt = BlackVolTermStructure::blackForwardVariance(t,t+dt,strike)

Zero rate and term volatility can be regarded as time average of their instantaneous counterparts.

1 T 0,t,T = 1 T 2
R0,t ,T =  r0, s ds
T t t
and   0, s ds
T t t
1 T  0,T 1 T 2
R0,T =  r0, s ds
T 0
and =   0, s ds
T 0
r0,t =  t (tR0,t ) = R0,t  ( t R0,t )  t and  0,t = 2  t)
 t ( 0,t =
2  (  2 )  t
0,t t 0,t

1
Forward zero rate can be deduced by comparing long term zero rate and short term zero rate.

T t T
0 r0, sds = 0 r0, sds  t r0, sds
R0,T  T = R0,t  t  R0,t ,T  (T  t )
R0,t ,T = ( R0,T  T  R0,t  t ) /(T  t ) both forward zero rate and zero rate are deterministic

Given information today 0, instantaneous rate instantaneous volatility, zero and forward rates, term and forward volatilities are all
deterministic, since zero rate and term volatility are directly available from market data, forward rate and volatility can be deduced
from short term and long term zero rates and volatilities, whereas instantaneous counterparts are first order derivatives of zero rate
and term volatility. Therefore, variables are deterministic if the first subscript is zero, and stochastic otherwise.

R0,t,T 0,t,T are deterministic as of time 0 no abbreviation, keep all 3 subscripts for clarity
R0,T = RT 0,T = T are deterministic as of time 0 abbreviated as RT and T
r0,t = rt 0,t = t are deterministic as of time 0 abbreviated as rt and t, normally used as variable in SDE
Rs,t,T s,t,T are stochastic as of time 0 for s > 0 as we don’t know the market data at time s
Rs,T s,T are stochastic as of time 0 for s > 0
rs,t s,t are stochastic as of time 0 for s > 0

Therefore the underlying stochastic index, such as USD LIBOR should be :

Rt,t+2,t+3M+2 = USD LIBOR 3M


Rt,t+2,t+6M+2 = USD LIBOR 6M

These indices become deterministic as of time t, i.e. fixing at time t. We can model the stochastic indices using Black Scholes or Hull
White. Lets move forward to foreign exchange. We need to specify FX spot rate St and FX cash rate Xt. Given market at time 0, both
S0 and X0 are fixed, as S0 is given as spot quote, while X0 is related to S0 via foreign and domestic yield curve :

2
X0 = S0 exp(  0 (rd ,  r f , ) d ) S0 and X0 are fixed together at time 0.

As of time 0, spot rate and cash rate in the future (i.e. St and Xt) are stochastic, but they are still related in a deterministic way :

t 2
Xt = St exp( t ( rd ,  r f , ) d ) (eq1) St and Xt are random variables, both fixed at t,
hence no expectation
t 2
Xt  St exp( t ( rd ,t ,  r f ,t , ) d ) integrand is random, which is not true

Equation 1 implies that spot rate and cash rate (the stochastic rates themselves, NOT their expectations) are related in deterministic way.
The forward price with maturity T is the expectation of FX spot fixing at time T given market data at time 0, thus in particular for
FX, forward implies forward spot.

F0,T = E[ S T | I 0 ] called forward, which is deterministic as of time 0

Forward price given forward market data at time t is called forward-forward. Again spot rate and forward-forward rate are related
by a deterministic drift, which can be explaint by the tower property.

Ft ,T = E[ S T | I t ] called forward-forward, which is stochastic as of time 0


= E[ E[ ST | St ] | I 0 ] tower property
T 2
= St exp( t  2 (rd ,  r f , ) d ) (eq2)

In short, as of time 0, S0, X0 and F0,T are deterministic, while St, Xt and Ft,T stochastic. Spot rate and cash rate are related by equation 1,
spot rate and forward-forward rate are related by equation 2, whereas cash rate dynamic is governed by the underlying model, such
as Black Scholes. Deterministic instantaneous rates are used in both drift term and diffusion term of Black Scholes SDE, otherwise if
stochastic rates rf,t,t and rd,t,t are used, we are in fact introducing multiple risk factors into the model.

dX t = ( rd ,t  r f ,t ) X t dt   t X t dzt given market data at time 0, rt and t are


deterministic
2
dX t  ( rd ,t ,t  r f ,t ,t ) X t dt   t ,t X t dzt which is multi-factor model, need extra equations
for drift, diffusion

Given equation 1, 2 and Black Scholes, we can find the SDE for St and Ft,T using Ito’s lemma (beware alignment in time domain).

M
      t    
(1) St = t 2
X t exp( (rd ,  r f , ) d )
t
dSt = ( t M t ) X t dt  M t dX t using Ito’s lemma
t 2
 t M t = M t  t ( t ( rd ,  r f , ) d ) using  x exp( f )  exp( f ) x f

= M t ((rd ,t  2  r f ,t  2 )  ( rd ,t  r f ,t ))

 dSt = M t (( rd ,t  2  r f ,t  2 )  ( rd ,t  r f ,t )) X t dt  M t dX t

= M t ((rd ,t  2  r f ,t  2 )  ( rd ,t  r f ,t )) X t dt  M t ((rd ,t  r f ,t ) X t dt   t X t dzt )

= ( rd ,t  2  r f ,t  2 ) M t X t dt   t M t X t dzt

= ( rd ,t  2  r f ,t  2 ) St dt   t St dzt

Therefore t is the instantaneous volatility for both cash rate and spot rate. Using the same approach, we have :

L
      t     
(2) Ft ,T = T 2
St exp(  t  2 ( rd ,  r f , ) d )
dFt ,T = (t Lt ) St dt  Lt dSt
=  Lt ( rd ,t T  r f ,t T ) St dt  Lt dSt

=  Lt ( rd ,t T  r f ,t T ) St dt  Lt ((rd ,t  2  r f ,t  2 ) St dt   t St dzt )

=  t Lt St dzt
=  t Ft dzt

With above underlying spot model in (1), we solve for the spot rate on maturity.

E[ S | I ] exp(v / 2  v )
ST =   T  0
F0,T

We can then solve for the analytic solutions of FX forward and FX option.

T 2
F0,T = S0 exp(2 (rd ,  r f , )d ) forward price with maturity T

exp(( Rd ,T  2  R f ,T  2 )  (T  2))
= S0
exp(( Rd ,2  R f ,2 )  2)
C0,T  Rd ,T  2 (T  2)
= ( F0,T  N (d1)  KN ( d 2 ))e call option price with maturity T (payment T+2)
d1, 2 = (ln( F0,T / K )  v / 2) / v where fwd = E[ST|I0], variable F is reserved for FX
cash
T 2
where v = 0  t dt where t is instantaneous vol of spot rate or cash rate
2
= 0,T  T

In short, the term “spot” is confusing and misleading, it can be made simpler if we think in the following perspective. It is simply a
random variable, to be fixed at time T, yet its payment will occur later at time T+2, the critical point is the alignment of St with yield
curve in time domain, there is a 2 days shift, i.e. we integrate the drift term from time 2 to T+2 to find forward, beyond that, we can
use Black Scholes like equity : FTN(d1)-KN(d2), but final discounting is done from T+2 to today 0. Therefore a Black calculator which
decouples forward, optionality and discounting is necessary.

Simulation using cash rate, spot rate and forward rate


Analytic pricing engine of forward and option contract using either Black Scholes or Heston underlying model can be implemented
without involving the underlying SDE. However, for monte carlo pricing engine, we need to implement the SDE, hence, we need to
3
ensure the right random process is used, time alignment between random process and yield term structures must be precise. There
are 3 possible SDEs, cash rate, spot rate and forward rate, all of them can be used to simulate forward price, but only the 2nd and the
3rd one can be used to simulate option price. Why don’t we simulate cash rate for option? Consider an option matures at T, we need
to randomly generate the underlying random variable, with optionality starts from 0 and ends at T, which is inconsistent with time
range if we simulate cash rate.

simulate forward price at T+2 option payoff at T


FX cash SDE dX t ( r
= d ,t  r f ,t ) X t dt   X dz
t t t from 2 to T+2 shouldn’t simulate beyond
option maturity
FX spot SDE dSt = ( rd ,t  2  r f ,t  2 ) St dt   t St dzt from 0 to T from 0 to T
FX fwd SDE dFt ,T =  t Ft dzt from 0 to T from 0 to T
Someone may prefer to simulate forward SDE for Monte Carlo simulations, as it is simpler without drift term. However, for pricing
path dependent exotic products, like a TARF with 4 periods, we need to simulate random path for Ft,1M, Ft2M, Ft.,3M and Ft,4M. Suppose
we simulate 10K paths, each has 120 nodes, i.e. 10 nodes per month, how can we ensure the following, and as a result, it is easier to
simulate FX spot for exotic for Monte Carlo.

Ft=0,1M = Ft=0,2M = Ft=0,3M = Ft=0,4M = …


Ft=1,1M = Ft=1,2M = Ft=1,3M = Ft=1,4M = …

Ft=9,1M = Ft=9,2M = Ft=9,3M = Ft=9,4M = …
Ft=10,2M = Ft=10,3M = Ft=10,4M = …
Ft=11,2M = Ft=11,3M = Ft=11,4M = …

Ft=19,2M = Ft=19,3M = Ft=19,4M = …

Pricng FX forward contract and mixed currencies


Forward contract is different from forward price, the former is a claim, with payoff defined as difference between realized forward
price and a predefined strike, usually ATM strike in trade time. Given an existing forward contract, traded last month, matures at T,
with strike K in domestic currency, notional L in foreign currency, the forward contract can be priced in two different methods : net
payoff discounting approach and cashflow discounting approach (both are non-official names). The former discounts expected net
payoff, while the latter discounts cashflows of different currencies separately.

(1) PVd = L  E[ payoffd | I 0 ]  DFd


= L  E[ ST  K | I 0 ]  DFd
= L  ( E[ ST | I 0 ]  K )  DFd
= L  ( F0,T  K )  DFd method 1a’s implementation (F0,T is available in market
data)

or PV f = L  E[ payoff f | I 0 ]  DF f

= L  E[( ST  K ) / F0,T | I 0 ]  DF f

= L  ( E[ ST | I 0 ]  K ) / F0,T  DF f

= L  ( F0,T  K ) / F0,T  DF f method 1b’s implementation (Ada’s approach in excel


demo)

Are method 1a and 1b consistent? Lets check :

PV f = L  ( F0,T  K ) / F0,T  DF f

L  (F  K )  DF / S0
=    0,T      d since F0,T  S0  DF f / DFd
PVd

 PV f = PVd / S0 hence method 1a and 1b are consistent

The latter approach regards the forward contract as an exchange of currencies at T, buyer of the contract will receive L units foreign
currency at the expense of LK units domestic currency, cash inflow and cash outflow are discounted by corresponding curves, main
difference from the former method is that the former involves only 1 curve, while this method involves 2 curves.

(2) PV d# = (incash f  DF f )  S0  (outcashd  DFd )

4
= ( L  DF f )  S0  ( LK  DFd ) method 2’s implementation

Are method 1 and 2 consistent? Lets check :

PV d# = ( L  DF f )  S0  ( LK  DFd )

= ( L  F0,T  DFd )  ( LK  DFd ) since F0,T  S0  DF f / DFd


= L  ( F0,T  K )  DFd

= PVd hence method 1 and 2 are consistent

There is no differences using either method 1a, 1b or 2 for a single deal, but when there is a portfolio of mixed currencies, we cannot
simply add the PVs together, as they come with different units. We can either convert all deals to the same reporting currency via 2
routines i.e. method 1a or b, according to collateral currencies (use method 1a for collateral in domestic currency, use method 1b for
collateral in foreign currency) or report each currency separately using method 2 without summing them up. Consider one porfolio
with USDJPY and EURJPY positions, with spot rate S0 S1 and one-year forward rate F0 F1 respectively, here is the illustration :

5
Example : collateral in USD
USD JPY EUR USD
time T payoff x/F1 method 1b x y method 1a yF2

time 0 PV in USD x/F1DFUSD yF2DFUSD


Example : reporting as an portfolio, i.e. total USD = x, total EUR = y, total JPY = z, forming a histogram.

Complication with forward delta


Here is the DAG for FX system. Therefore forward-delta can be found by shocking swap point, reimplying JPY curve, repricing the
derivatives, finding forward-delta as ratio of difference in PV to difference in swap point.

USD OIS curve


USDJPY spot St JPY implied curve FX derivatives
USDJPY swap point

Delta calculation is more complicated than PV, as nominator and denominator can be either be foreign or domestic, thus there are 4
combinations, among which, we prefer to use the same currency for both nominator and denominator. Deltad/d in domestic currency
is easier to understand, yet it requires re-implication of domestic curve from shocked swap points, while Deltaf/f in foreign currency
doesn’t require re-implication, but it needs multiplication with forward at the end (it is less understandable) which converts  from
domestic currency to foreign currency. Suppose f is contingent claim’s payoff :

Lf ( S0 , F0,1M  , OISUSD , vol )  DFdreimply  Lf ( S0 , F0,1M , OISUSD , vol )  DFd


1Mdeltad / d =

in domestic/domestic unit
Lf ( S0 , F0,1M  , OISUSD , vol) Lf ( S0 , F0,1M , OISUSD , vol )
 DF f   DF f
1Mdelta f / f F0,1M   F0,1M
=  F0,1M
 
F0,1M   ??
in foreign/foreign unit
  Lf ( S0 , F0,1M , OISUSD , vol ) 
=   DF f   F0,1M equation
F0,1M  F0,1M 
A

If you don’t understand the latter equation, try breaking it down :

  PV
   shocked  in 
 foreign
    
shocked cashflowin  foreign
            
1Mdelta f / d = Lf ( S0 , F0,1M  , OISUSD , vol ) Lf ( S0 , F0,1M , OISUSD , vol )
 DF f   DF f
F0,1M   F0,1M
  shocking  in  domestic

The following is an illustration of method1b for delta calculation, this method is prefered for finding delta of USDJPY forward, as it
involves USD curve only, thus there is no need to re-imply JPY curve from swap point after shocking market data.

  cashflowUS
    D 
PVUSD = cashflowJPY
     
L  ( F0,T  K ) / F0,T  DF f
PV 'USD = L  (( F0,T  FJPY )  K ) /( F0,T  FJPY )  DF f
delta f / d = ( PV 'USD  PVUSD ) / FJPY unit USD/JPY change in PV (in USD) per infinitesimal change
in F0,T in JPY
delta f / f = ( PV 'USD  PVUSD ) / FJPY  F0,T unit USD/USD change in PV (in USD) per infinitesimal
change in F0,T in USD
( PV 'USD  PVUSD ) /( FJPY / F0,T )
=     
FUSD

6
Simplify equation A for 1M USDJPY forward :

  L( F0,1M  K ) 
1Mdelta f / f =   DFUSD,1M   F0,1M
F0,1M  F0,1M 

=

F0,1M
 
L (1  K / F0,1M )  DFUSD,1M  F0,1M

= [ L ( K / F02,1M )  DFUSD,1M ]  F0,1M

= [ L ( K / F0,1M )  DFUSD,1M ]

7
Review of TDMS-IR
The following instruments are supported in TDMS :

 IRS
 swaption (European or Bermudan)
 callable swaption (ordinary swap or zero callable)

Zero callable means a callable swap with a normal floating leg, but no coupon in the fixed leg, instead the coupon in the fixed leg is
reinvested into the swap, hence increasing the notional. Therefore, zero callable can be regarded as IR swap with a time dependent
notional, which jumps on the original coupon payment dates, having jump size equivalent to coupon size, the notional of a callable
swap does look like a staircase.

QuantLib offers at least two swap classes, a generic swap which contains multiple paying-legs and receiving-legs, and vanilla swap
which has exactly one paying-leg and one receiving-leg, among which, one is fixed and the other must be floating, besides notional
of vanilla swap is constant in time, and equivalent between both legs. The generic swap is too generic for TDMS, yet the vanilla one
cannot handle zero callable, therefore we create cathay-swap to accommodate this requirement, this class differs from the vanilla in
the following inputs, which are supported in cathay-swap but not in QuantLib’s vanilla swap :

 std::vector<notional> for fixed leg


 std::vector<notional> for floating leg
 std::vector<swap_rate> for fixed leg
th
 std::vector<swap_spread> for floating leg, vec[n] denotes new notional after the n coupon payment date

TDMS is segmented into 3 major parts : market data, deal term or term sheet and quant. Market data in TDMS includes QuantLib ’s
term structure (for yield and volatility), rate helper and calibration helper, while helper is simply an abstraction of one market data
point (rate helper contains a data point on yield curve for boostrapping, while calibration helper contains a point on vol-surface for
model calibration, bootstrapping is implicit, i.e. it is triggered when instruments NPV is called, calibration is explicit, i.e. user needs
to call model.calibrate(vec_helpers,levmar,criteria) before the model can be used for pricing). Deal term in TDMS is equivalent to
instrument in QuantLib, while quant in TDMS is equivalent to random process, model and pricing engine in QuantLib. Recall that
the communication between instrument and in engine QuantLib is done through ARG and RES, when instrument::NPV is called, setup
argument and fetch result will be triggered, besides instrument has a pointer to engine, which is updated inside setPricingEngine.

TDMS’s market data section rf,rd,vol rf,rd calibration helper (encap vol)

model::calibrate

BS process HT process calibration helper contains a


TDMS’s quant section setPricingEngine pointer to instrument, so that it
constructed from HT model can offer a model price

constructed from
BS analytic engine for vanilla
BS finite diff engine for vanilla
BS monte carlo engine for vanilla
HT analytic engine for vanilla
HT finite diff engine for vanilla setPricingEngine
HT monte carlo engine for vanilla instrument
TDMS’s deal term section

Cathay-swap can be regarded as an abstraction between vanilla swap and generic swap. The market data section and quant section
for swap in QuantLib can be reused, there is no need to implement cathay’s version market data and quant-for-swap. We then goto
swaption, it is simply combo of cathay-swap plus an option, the latter is consisted of an exercise and a payoff. Risk neutral pricing
states that the price of a contingent claim is the expected value of payoff f, according to underling X :

price = ˆ [ f ( x )]
DF  E
= ˆ [ ax  b]
DF  E if f is linear, example f = ax+b, like forward
= ˆ [ x ]  b)
DF  ( aE then only the expected value of X’s pdf is needed (which is risk free rate), no vol is
needed

However, when payoff f is nonlinear, such as an option, volatility then kicks in. Major challenge in IR swaption is that, market data
of volatility is quoted as log-normal vol, i.e. assuming Black Scholes model for IR process, yet TDMS uses normal vol, i.e. assuming
Hull White model for IR process, therefore a cathay-convertor is implemented to convert log-normal vol into normal vol. Using this
vol-surface, we can price other IR derivatives of the same currency, including cap and floor etc. Finally for the last product, callable
swaption, as pricing part is done by Dr Yan’s code, which is called BR3, the main task for the cathay library is to do data conversion
from QuantLib’s term structure and instrument into C++’s primitive types.
8
9
Design of TDMS-FX
FX synthetic forward is a combination of long position in ITM call plus short position in OTM put with the same strike but different
notionals (or long position in ITM put plus short position in OTM call). Consider a US company running a business in HK, it wants
to protect its HK revenue from downside FX market risk (i.e. a rise in USDHKD), then it longs a synthetic forward, from which it is
compensated in case of HKD depreciation. In fact, it can simply enter a USDHKD call option, yet ITM call option may be
expensive, whereas OTM call option involves premium fee without a guaranteed future cash inflow. Therefore, synthetic forward
is offered to suit this need, as the notional (in USD) of the short side is greater than (usually double) that of the long side, initial
premium can be reduced, initial cash may also be received by the client company.

TARF is a sequence of (usually 12 or 24) monthly synthetic forwards. Clients prefer to be more ITM which comes along with higher
premium, hence knock out feature is added (to protect the bank and to reduce the premium), which allows the contract to be called
by the bank when target profit is made by the client, as it is equivalent to selling a call option to the bank, premium is then reduced.
Target redemption is triggered when :

iN1( Si  K )  Tar , where Tar is the target in total number of pips

or iN11Si  K  M , where M is the target number of positive intrinsic value

If the nth payment triggers the redemption, the nth payment is defined as the following according to different TARF options :

 Sn  K full  redemption
nth payment =  n  if in1(Si  K )  Tar
Tar  i 1( Si  K ) partial  redemption

Please note that only positive intrinsic values are added in the above summation. Similarly, TARF may have a cap-loss which limits
the maximum loss from the short side, unlike target redemption there is no full cap loss or partial cap loss, cap loss is a hard
bound. Finally, clients may want a margin in the short side, they dont want to lose money as fixing is lower than strike, an
European knock in feature is added to the short side option, this feature increases TARF ’s premium. In general, the notional, strike
and EKI can vary payment by payment, while target redemption and cap loss is per deal.

TARF payoff TARF payoff with EKI


spot rate spot rate
payoff payoff

strike K STn EKI K Sn


upside limited by A and downside
leveraged by m

Discrete knock out DKO is another FX exotic that is very similar to TARF, the only difference is the knocked out criteria :

Si  K for long forward


Si  K for short forward

In general, there is no EKI for DKO. Besides, it is possible for a DKO to have no payment on the first few fixings (there are KO
only). Finally, we have double no touch, which is a double barrier exotic product. For example, a double no touch which pays 4%
coupon quarterly when USDCNH lies within 6.75 and 6.85 in the whole 3M period, pays nothing otherwise, it matures in 2Y (i.e. 8
periods). There is no knock out conditions, the FX rate range can be different per period. This is a digitial contract, hence it isn’t
continuously differentiable, i.e. it cannot be dynamically hedged with vanilla products.

10

You might also like