knitr::opts_chunk$set( comment = "#>", error = FALSE, tidy = FALSE)
Currencies, currency pairs and interest rate indices are key building blocks to a coherent financial mathematics library. As currencies are the basis for transactions, they bring together different conventions in a unique manner. Currency pairs are required to define the terms of FX transactions while interest rate indices define the payoffs of the largest over-the-counter derivatives asset class.
fmbasics package supplies implementations of the following key currencies:
USD. The 2006 ISDA definitions map these currencies to financial centres for the purposes of determining whether banks and FX markets settle payments on a given date.
library("fmbasics") (aud <- AUD()) aud$iso aud$calendar
You can create other currencies by calling
Currency(). However, you will need to define the currency's associated
fmdates::Calendar first (along with its associated
It is also possible to create currency pairs and calculate value dates:
(audusd <- AUDUSD()) dates <- as.Date(c("2014-04-16", "2014-04-19")) to_fx_value(dates, 'today', audusd) to_fx_value(dates, 'spot', audusd) to_fx_value(dates, 'spot_next', audusd) to_fx_value(dates, 'tomorrow', audusd) to_fx_value(dates, months(3), audusd)
You can create other currency pairs by calling
library("fmdates") CurrencyPair(USD(), AUD(), c(USNYCalendar(), AUSYCalendar()))
Interest rate indices are key to defining the payoffs on interest rate derivatives such as interest rate swaps, swaptions, etc. The
fmbasics package provides implementations of the most important indices for the currencies that it supports including "xIBOR" and "xONIA" indices such as
library("lubridate") AONIA() FedFunds() AUDBBSW(months(3)) USDLIBOR(months(3))
You can use determine key dates associated with these indices relative to supplied dates such as the reset dates, value date and maturity date:
to_reset(ymd(20170105) + days(0:2), USDLIBOR(months(3))) to_value(ymd(20170105) + days(0:2), USDLIBOR(months(3))) to_maturity(ymd(20170105) + days(0:2), USDLIBOR(months(3)))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.