Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

swap.commodity

Commodity Swap


Description

Solves for the fixed swap price, given the variable prices and interest rates (either as spot rates or zero coupon bond prices).

Usage

swap.commodity(prices, rates, type="spot_rate")

Arguments

prices

vector of variable prices

rates

vector of variable rates

type

rates defined as either "spot_rate" or "zcb_price"

Details

For spot rates: ∑_{k=1}^n\frac{prices_k}{(1+rates_k)^k}=∑_{k=1}^n\frac{X}{(1+rates_k)^k}

For zero coupon bond prices: ∑_{k=1}^nprices_k*rates_k=∑_{k=1}^nX*rates_k

Where X= fixed swap price.

Value

The fixed swap price.

Note

Length of the price vector and rate vector must be of the same length.

Author(s)

Kameron Penn and Jack Schmidt

See Also

Examples

swap.commodity(prices=c(103,106,108), rates=c(.04,.05,.06))

swap.commodity(prices=c(103,106,108), rates=c(.9615,.907,.8396),type="zcb_price")

swap.commodity(prices=c(105,105,105), rates=c(.85,.89,.80),type="zcb_price")

FinancialMath

Financial Mathematics for Actuaries

v0.1.1
GPL-2
Authors
Kameron Penn [aut, cre], Jack Schmidt [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.