powered by
swap.commodity(prices, rates, type="spot_rate")
For zero coupon bond prices: $\sum_{k=1}^nprices_k*rates_k=\sum_{k=1}^nX*rates_k$
Where $X=$ fixed swap price.
swap.rate
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")
Run the code above in your browser using DataLab