# Pricing a Forward Rate Agreement using QuantLib Python

A 3x6 forward rate agreement, with a notional of \$100,000, the FRA rate being 6%, The FRA settlement date is after 3 months (90 days) and the settlement is based on a 90-day USDLIBOR.

My valuation date is 30 June 2020.

This is my attempt:

import QuantLib as ql

startDate = ql.Date(30, 6, 2020)
ql.Settings.instance().evaluationDate = startDate

spotDates = [ql.Date(30, 6, 2020), ql.Date(31, 12, 2020), ql.Date(30, 6, 2021)]
spotRates = [0.05, 0.05, 0.05]

dayConvention = ql.Thirty360()
calendar = ql.UnitedStates()

compounding = ql.Simple
compoundingFrequency = ql.Annual

spotCurve = ql.ZeroCurve(spotDates, spotRates, dayConvention, calendar, ql.Linear(), compounding, compoundingFrequency)
spotCurve.enableExtrapolation()
spotCurveHandle = ql.YieldTermStructureHandle(spotCurve)

index = ql.USDLibor(ql.Period('3M'), spotCurveHandle)
notional = 100000
rate = 0.06

fra = ql.ForwardRateAgreement(startDate, maturityDate, ql.Position.Long, rate, notional, index, spotCurveHandle)
print('NPV:', fra.NPV())


And this is the answer that I get:

NPV: 0.0

The answer that I'm getting is not correct.

For a 3x6 FRA, you probably want to write something like:

today = ql.Date(30, 6, 2020)
ql.Settings.instance().evaluationDate = today


• Thank you Luigi! QuantLib is returning an NPV of -288.3302632825472, however, from my manual computation, I'm obtaining -288.8029442214667 by doing the following operation: (100000 * (fra.forwardRate().rate() - 0.06) * 0.25)/(1 + (fra.forwardRate().rate() * 0.25)). Why does this slight difference arise? Sep 7, 2021 at 20:14
• This is what I obtain when I use the ACT/360 day count convention: -291.97315350604094 Sep 8, 2021 at 5:24