Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 40 million developers. The most notable changes are included below.
A detailed list of changes is available in ChangeLog. Eugene Aumson and Francois Botha for smaller fixes, enhancements, and bug reports.
It fixes an error that would occur during initialization of the test suite when using the newly released Boost 1. Thanks to Klaus Spanderen for the prompt fix.
Skip to content. Dismiss Be notified of new releases Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 40 million developers. Sign up.
Releases Tags. Latest release.
Chapter 3, part 2 of n: Yield term structures
This tag was signed with a verified signature. Choose a tag to compare. Search for a tag. Changes for QuantLib 1. Build Cmake now installs headers with the correct folder hierarchy thanks to Cheng Li. The --enable-unity-build flag passed to configure now also causes the test suite to be built as a single source file.
It allows to produce curves close to Bloomberg's. It is now possible to pass explicit minimum and maximum values to the IterativeBootstrap class. The accuracy parameter was also moved to the same class; passing it to the curve constructor is now deprecated. Instruments It is now possible to build fixed-rate bonds with an arbitrary schedule, even without a regular tenor thanks to Steven Van Haren. Models It is now possible to use normal volatilities to calibrate a short-rate model over caps.In this post, we switch gears and discuss Swap Curve construction.
Building a swap curve is so fundamental to interest rate derivatives pricing that it is probably one of most closely guarded proprietary information on the trading desk. Pricing an interest rate swap involves bootstrapping a blended curve of different instruments based on their maturities and market liquidity.
Usually cash deposits, Eurodollar futures are used at the short end and market swap rates are used at the long end. At the long end, however, we have only a subset of market swap rates available and bootstrapping requires all the missing rates to be interpolated from known rates. This makes interpolation methodology a critical part of curve building. Also, since forward rates are a gradient of the discount rates, any misalignment in the latter is magnified in the former.
We also add a smoothness constraint to the minimization procedure so that overall gradient of the curve is minimized.
I will use QuantLib to generate swap schedules and to deal with business day conventions. My objective was to match Spreadsheet 3. If you are on windows, you can just install the whl package and get started. Function evaluations: 20, initial cost: 1. Scipy optimization took Your email address will not be published.
Date 4, ql. JointCalendar ql. UnitedStatesql. UnitedKingdom ql. Date 4ql. February Thirty ql. A utility function to recursively calculate a series of discount factors from year fractions.
It only takes a minute to sign up. I'm using Python 2. I'm trying to price fixed bonds. I understand how to create a bond object. How to get the "right" discounting curve is kind of a problem. Assuming a non-flat term structure, I have seen the ql. ZeroCurve function:. I assume the inputs are the maturities and yields of zeros with the same "risk" as the bond, we are looking at. How can I specify the discount curve directly, e. You can use the DiscountCurve class, that takes a list of dates and a list of corresponding discount factors.
The one exported by default in the Python module uses a log-linear interpolation between the given discounts; using a different interpolation would require adding a line in the corresponding SWIG interface and recompiling the module. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Asked 3 years, 4 months ago.
Active 3 years, 4 months ago. Viewed 3k times. Thanks in advance. Daniel Daniel 51 1 1 silver badge 4 4 bronze badges. Active Oldest Votes. Luigi Ballabio Luigi Ballabio 4, 13 13 silver badges 25 25 bronze badges. Date 15, 1,ql. DiscountCurve discDates, discRates, dayCount I would expect a NPV of NPV function gives me 90,2. Is my expectation not correct or am I coding it wrong?
how to construct yield curve in quantlib [ quantlib yield curve example ]
What evaluation date did you set? How did you initialize the bond? Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.DiscountCurve constructs the spot term structure of interest rates based on input market data including the settlement date, deposit rates, futures prices, FRA rates, or swap rates, in various combinations.
It returns the corresponding discount factors, zero rates, and forward rates for a vector of times that is specified as input. Market quotes used to construct the spot term structure of interest rates. If flat is specified it must be the first and only item in the list. The eight futures correspond to the first eight IMM dates.
Oh no! Some styles failed to load. 😵
The maturity dates of the instruments specified need not be ordered, but they must be distinct. A vector of times at which to return the discount factors, forward rates, and zero rates. Times must be specified such that the largest time plus dt does not exceed the longest maturity of the instruments used for calibration no extrapolation.
A list specifying the dayCounter the day count convention for the fixed leg default is Thirtyand fixFreqfixed coupon frequecny defualt is AnnualfloatFreqfloating leg reset frequency default is Semiannual. This function is based on QuantLib Version 0. It introduces support for fixed-income instruments in RQuantLib. The first part of the message contains technical information about the precise location of the problem in the QuantLib code.
Scroll to the end to find information that is meaningful to the R user. Brigo, D. Created by DataCamp. Returns the discount curve with zero rates and forwards given times DiscountCurve constructs the spot term structure of interest rates based on input market data including the settlement date, deposit rates, futures prices, FRA rates, or swap rates, in various combinations.
Community examples Looks like there are no examples yet. Post a new example: Submit your example. API documentation. Put your R skills to the test Start Now.You can build yield curve without using any external libraries.
For this you have to build discount rates from market traded instruments likeLibor rates, futures prices and Swap rates. This is a nice post explaining term structure in QuantLib. Have you every tried deriving spots from the treasury yields? I have not tried that using Quantlib. But I think it would be trivial exercise as we need to solve for a Fixed rate bond. Yield Curve is fundamental building block in the pricing of Interest rate Derivative products.
An Yield Curve constructed using US government issued Treasury securities is termed as Treasury Yield curve, if it is constructed using corporate bonds then it is called Corporate Bond Curve and so on.
Yield curve construction starts with identifying instruments needed to build and then applying appropriate bootstrapping technique. This is because, each of these products are liquid at particular time to maturity in the market Cash Deposit products : LIBOR cash deposit markets is very active in overnight, 1week, 1M, 3m and 6M maturities.
These deposits are quoted in the market as cash rate earned for a particular maturity. Typically they are traded on the market with March, June, September and December expiration dates along with serial months on the front end. These contracts are being traded as far as 10 years from now.
A typical contract for instance, Jun 14 symbol: EDM4 will imply a 3m rate starting on June as of today. These contracts are very useful in risk management of trading book with interest rate swaps.
Future contracts are traded on the exchange and are subject to initial and variation margin. Due to this when comparing futures rates with Over the counter traded markets, players incorporate Convexity adjustment Here we will not cover that In our yield curve construction, we are going to use 8 future contracts for a period of 2 years. Different Banks have different requirements and hence this will vary from 8 to 16 future contracts.
Now let is move on to Interest rate swaps Dollar Interest rate swaps are traded with in over the counter market. Recent Dodd Frank regulation has enjoined moving these products onto exchanges. Consequently, you are seeing movement of these products onto Swap Execution Facilities run by variety of players.
Even to mitigate counterparty risk, these swaps are now moving on Clearing houses where they will become more like futures. We will use these quoted swap rates from 3y onwards to 30y in our yield curve construction.
We utilize liquid, Deposits till 6M maturity, from there 8 future contracts and then from 3y onward till 30y swap rates are considered and blended together to construct discount curve and then Forward curve.
We will also use Piece wise flat curve interpolation methodology implemented by Quantlib in building our discount factors. Essentially this will serve the purpose of generating a smooth discount curve that can imply a smooth forward curve which is very important in pricing any kind of exotic derivatives. See the license for more details.
Labels: Derivatives Valuations-Risk. Unknown September 19, at AM. Gouthaman Balaraman April 2, at AM. Newer Post Older Post Home.
Subscribe to: Post Comments Atom.You seem to have CSS turned off. Please don't fill out this field. Please provide the ad click URL, if possible:. Help Create Join Login. Operations Management. IT Management. Project Management. Services Business VoIP. Resources Blog Articles Deals. Menu Help Create Join Login.
QuantLib Brought to you by: ericehlerslballabionando. Re: [Quantlib-users] Building a discounting curve from a swap index. Oh no! Some styles failed to load. Sign Up No, Thank you. Thanks for helping keep SourceForge clean. X You seem to have CSS turned off. Briefly describe the problem required :. Upload screenshot of ad required :. In fact, to calculate the delivery settlement price, there's no need to build a curve, as you know the ICE Swap fixings for dates which correspond to the coupons of the bond, so it's possible to work out the discount factors directly.
However, if you want to price a future before it expires which is kind of usefulyou need to forecast the fixings so that you can work out the discount factors. You can do this using a normal swap curve, pulling out rates for the appropriate forward-starting swaps.
A YieldTermStructure implies the existence of a continuous discount factor over time, but the swapnote calculation rule only defines discrete discount factors. It's a little hard to imagine a continuous version of the rule, because of the switch from 3-month to 6-month Euribor.
Is there any existing 'right way' of doing this in QuantLib? Thanks, tom -- My dad gave to me a MSX and magazines to read and type programs, mostly adventure games. I falling in love to the letter soap.
The mixing of a multi curve setup in 1 and a single curve setup in 2 is another aspect contracting a consistent curve construction in the usual sense.
The better solution would surely be to add a separate instrument and pricing engine for these swap note futures. You think there would be demand for this? Would people potentially also like to build curves from swap note future market quotes? What is their liquidity after all compared to vanilla swap quotes or Euribor 3M futures?Post a Comment.FRM: Nonlinear interpolation with Solver to construct yield curve
Sunday, July 14, QuantLib-Python: flexible construction scheme for piecewise yield term structures. I consider QuantLib to be a fundamental pricing library, which can effectively handle valuations for pretty much any given type of security. If there is no existing implementation for an instrument available, one can create a new implementation for it.
What then makes the use of QuantLib library sometimes difficult? It's the amount of work to be done, before anything will happen. Outside of that promised functionality to value security, one has to take full responsibility of all involved janitor work. The code is usually always containing endless sections for different variable definitions and creation of different types of helper objects. Even creating realistic pricing scheme for a simple interest rate swap seems to require an army of different variables and objects.
A lot of cooking anyway, before the beef will be served.
Changes for QuantLib 1.18:
In this post, one possible scheme for flexible construction of QuantLib piecewise yield term structures will be presented. The program and all involved files can be downloaded from my GitHub repository. Ticker,Value USD. Period ticker. PiecewiseLinearZero self. January, '02' : ql. February, '03' : ql. March, '04' : ql. April, '05' : ql.
May, '06' : ql. June, '07' : ql. July, '08' : ql. August, '09' : ql. September, '10' : ql. October, '11' : ql. November, '12' : ql. Following if s. ModifiedFollowing if s. Preceding if s. ModifiedPreceding if s.