Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This post explains how to price a FX forward. We assume that 1) USD is the foreign currency and KRW the domestic one, 2) USD IRS zero curve and KRW FX implied zero curve are given. Before making a R code, we use Excel spreadsheet for the clear understanding of the calculation process.

In this post, we consider two solutions using Excel and R. In particular, Excel solution uses the same linear interpolation as that of the following post.

### FX Forward Pricing

FX forward is a contractual agreement between two parties to exchange a pair of currencies at a specific time in the future. Given discount factors for domestic and foreign currencies, FX forward price is easily calculated. For example, let’s take an example of the USD KRW FX forward contract as follows.

The difference between present values of two nominal amount is the price of FX forward. Of course, it can be represented by either domestic or foreign currencies.

As of 2021/06/30, let’s investigate the calculation process of FX forward contract of the detailed example above.

### Understanding using Excel

We need the each currency’s discount factor of maturity date, which is needed to be interpolated. We use the LINEST Excel function for this purpose. This interpolation procedure is simple and useful in that we only generate regression coefficients for the corresponding maturity ranges. From Excel spreadsheet calculation, we can learn how to price a FX forward. The important thing is to calculate present values of each nominal amounts using each discount factor and get their difference under the same currency.

Here, notations used in the above Excel spreadsheet are defined in the following way.

• Zero(T) : zero rate at maturity
• DF(T) : discount factor at maturity
• FA : notional amount of foreign currency
• DA : notional amount of domestic currency
• PV(FA) in F : present value of FA denominated in Foreign currency
• PV(DA) in D : present value of DA denominated in Domestic currency
• PV(FA) in D : present value of FA denominated in Domestic currency
• PV(DA) in F : present value of DA denominated in Foreign currency
• Price in D : KRW (domestic currency) price of FX forward
• Price in F : USD (foreign currency) price of FX forward

### R code

We can use R code to get the same results from Excel calculation.

 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 #=========================================================================## Financial Econometrics & Derivatives, ML/DL using R, Python, Tensorflow  # by Sang-Heon Lee ## https://kiandlee.blogspot.com#————————————————————————-## FX Forward Pricing#=========================================================================# graphics.off()  # clear all graphsrm(list = ls()) # remove all files from your workspace #————————————————————————–# 1. Market Information#————————————————————————–        #——————————–    # Zero curves as of 2021-06-30    #——————————–    lt.mt <– list(        spot_date = 44377,   # spot date                KRWUSD.FX.Spot = 1129.945, # FX Spot Rate                KRW_CRS.zero = data.frame(                        # Excel numeric date            date = c(44378, 44379, 44386, 44410,                      44441, 44474, 44564, 44747),             rate = c(0.00629994563073550,                     0.00629994563073550,                     0.00463177425055339,                     0.00329405202619836,                     0.00292249195639071,                     0.00273429173667466,                     0.00331796879551685,                     0.00397939937284654)        ),                USD_IRS.zero  = data.frame(                        # Excel numeric date            date = c(44378, 44386, 44410, 44441,                     44473, 44564, 44655, 44747),             rate = c(0.000842844860217754,                     0.000908701294845472,                     0.001006361388394810,                     0.001238311778397180,                     0.001455778457003310,                     0.001533135923937390,                     0.001716219715472820,                     0.001848263900368730)        )    )        #——————————–    # Interpolation of zero curve    #——————————–     # USD IRS    v.date   <– lt.mt$USD_IRS.zero$date    v.zero   <– lt.mt$USD_IRS.zero$rate    func_linear_USD_IRS.zero <– approxfun(v.date, v.zero,                                           method=“linear”)    # KRW CRS    v.date   <– lt.mt$KRW_CRS.zero$date    v.zero   <– lt.mt$KRW_CRS.zero$rate    func_linear_KRW_CRS.zero <– approxfun(v.date, v.zero,                                           method=“linear”)#————————————————————————–# 2. FX Forward Trade Information#————————————————————————–     fAmt <– 10000      # Foreign notional amount    dAmt <– 10948600   # Domestic notional amount    fPosition <– 1     # 1 if Foreign is a buy position, -1 if sell    mat_date  <– 44561 # maturity date of FX Forward contract #————————————————————————–# 3. FX Forward Pricing#————————————————————————–        #——————————–    # 1) Foreign    #——————————–        # zero rate for discounting    fzero <– func_linear_USD_IRS.zero(mat_date)    # discount factor    fDF <– exp(–fzero*(mat_date–lt.mt$spot_date)/365) # discounted foreign amount denominated in foreign currency pv_fAmt_in_f <– fAmt*fDF # discounted foreign amount denominated in domestic currency pv_fAmt_in_d <– pv_fAmt_in_f*lt.mt$KRWUSD.FX.Spot        #——————————–    # 2) Domestic    #——————————–        # zero rate for discounting    dzero <– func_linear_KRW_CRS.zero(mat_date)    # discount factor    dDF <– exp(–dzero*(mat_date–lt.mt$spot_date)/365) # discounted domestic amount denominated in foreign currency pv_dAmt_in_d <– dAmt*dDF # discounted domestic amount denominated in domestic currency pv_dAmt_in_f <– pv_dAmt_in_d/lt.mt$KRWUSD.FX.Spot        # 3) Price    #——————————–    price_in_f <– fPosition*(pv_fAmt_in_f – pv_dAmt_in_f)    price_in_d <– fPosition*(pv_fAmt_in_d – pv_dAmt_in_d)        print(paste0(“FX Forward Price ($) = “, round(price_in_f,2))) print(paste0(“FX Forward Price (w) = “, round(price_in_d,2))) Colored by Color Scripter cs ### Results The following results show FX forward prices denominated in both USD dollar and KRW won. The price of this example is$318.89 or ₩360,325.24. These results are the same as those obtained using Excel.

 123456 >     print(paste0(“FX Forward Price ($) = “, round(price_in_f,2))) “FX Forward Price ($) = 318.89”>     print(paste0(“FX Forward Price (w) = “, round(price_in_d,2))) “FX Forward Price (w) = 360325.24” Colored by Color Scripter cs

From this post, we can calculate the price of FX forward using Excel and R. For simplicity, CRS or FX implied zero curve is assumed away in this work, we will discuss it later. $$\blacksquare$$