R: Re: QuantLib Python - pricing a ForwardRateAgreement

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

R: Re: QuantLib Python - pricing a ForwardRateAgreement

tarpanelli@libero.it
got it
thx
P


>----Messaggio originale----
>Da: "giambologna" <[hidden email]>
>Data: 29/03/2017 21.02
>A: <[hidden email]>
>Ogg: Re: [Quantlib-users] QuantLib Python - pricing a ForwardRateAgreement
>
>Try this:
>
>import QuantLib
>nowdate=QuantLib.Date(23,QuantLib.March,2017)
>QuantLib.Settings.instance().evaluationDate = nowdate
>print "evaluation date:
>{0}".format(QuantLib.Settings.instance().evaluationDate)
>
>basis=QuantLib.Actual360()
>calendar=QuantLib.TARGET()
>r = 0.02
>rate = QuantLib.SimpleQuote(r)
>rate_handle = QuantLib.QuoteHandle(rate)
>dc = QuantLib.Actual365Fixed()
>flatcurve=QuantLib.FlatForward(nowdate, rate_handle, dc)
>curvehandle = QuantLib.RelinkableYieldTermStructureHandle()
>curvehandle.linkTo(flatcurve)
>
>maturitydate=QuantLib.Date(3,QuantLib.July,2017)
>expirydate=QuantLib.Date(3,QuantLib.October,2017)
>euribor3m=QuantLib.Euribor3M(curvehandle)
>euribor3m.addFixing(QuantLib.Date(21,QuantLib.March,2017),0.02)
>
>instr=QuantLib.ForwardRateAgreement(maturitydate,expirydate,QuantLib.Position.
Long,0.023,1000000.0,euribor3m,curvehandle)

>
>print "is expired?  {0}".format(instr.isExpired())
>
>#the following two lines might be redundant
>dse = QuantLib.DiscountingSwapEngine(curvehandle)
>instr.setPricingEngine(dse)
>
>qlpv=instr.NPV()
>fwd = instr.forwardRate()
>
>print(qlpv)
>
>
>
>--
>View this message in context: http://quantlib.10058.n7.nabble.com/QuantLib-
Python-pricing-a-ForwardRateAgreement-tp18154p18159.html
>Sent from the quantlib-users mailing list archive at Nabble.com.
>

>------------------------------------------------------------------------------
>Check out the vibrant tech community on one of the world's most
>engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>_______________________________________________
>QuantLib-users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Loading...