mortgage bond

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

mortgage bond

Nathan Abbott

I am c++ programmer that only knows the basics of quantitative finance. Because I have been programming with QuantLib for two years, I think I have a good understanding on how QuantLib works. Luigi Ballabio's Implementing QuantLib has been a great help on understanding QuantLib. I am working with a financial person who uses my program, He is fluent with quantitative finance, but only knows a little c++ and does not know how QuantLib works.

We want to implement a simple version of mortgage bonds through a MorgtageBond class that will probably inherit from the Bond class (and maybe a FixedRateMortageBond and FloatingRateMortageBond classes derived from the MortgageBond class) and would like to solicit some opinions/suggestions/objections.

Currently we are thinking that it will be defined similar to the amortizing bond classes (taking in a vector of nominals and dates generated outside of QuantLib), but be derived from bond (and inherit all it's functions) and adding specific functions to it (like weighted average life calculation). Has anyone already done/thought of doing something similar?

Secondly, assuming prepayments are not an issue (which for our purposes they are not), a simple mortgage bond is priced similar to corporate bonds, meaning as a spread over swaps (i.e. on a yield basis, yield = swap rate + spread), then use that sum as the yield to calculate the price. The bond class has dirtyPrice and cleanPrice functions which take yield as an input. We can get the par rate from the yield curve by using the parRate function or instantiate a simple swap (as explained in yieldtermstructure.hpp comments).

Our question is w.r.t the spread. We want to build a spread grid/matrix with rating on one axis/rows and maturity/columns on the other. We were thinking of creating a termspreadsurface (similar to capfloortermvolsurface) which could be useful for mbs and corporate bonds (spread per rating/term). Has anyone already done something similar?

Btw, if anybody is interested in residential prepayments/OAS calculations and willing to implement that or is working on that, please contact me and we can hopefully coordinate. Please note however that we have limited (almost zero) expertise on that subject.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Luigi Ballabio
On Sun, 2009-03-08 at 14:14 -0800, Nathan Abbott wrote:
> I am c++ programmer that only knows the basics of quantitative
> finance. Because I have been programming with QuantLib for two years,
> I think I have a good understanding on how QuantLib works. Luigi
> Ballabio's Implementing QuantLib has been a great help on
> understanding QuantLib. I am working with a financial person who uses
> my program, He is fluent with quantitative finance, but only knows a
> little c++ and does not know how QuantLib works.

It seems like a good match.  No, seriously.


> We want to implement a simple version of mortgage bonds through a
> MorgtageBond class that will probably inherit from the Bond class (and
> maybe a FixedRateMortageBond and FloatingRateMortageBond classes
> derived from the MortgageBond class) and would like to solicit some
> opinions/suggestions/objections.

[ snipped ]

At this time, I'm not aware of work being done on this (well, except for
proprietary work, but that's out of the picture.)  Given the model you
want to implement, your approach seems correct.  If possible, keep the
calculations in a pricing engine so that they can be replaced easily
when someone (or you) add a prepayment model or anything else.

Later,
        Luigi


--

The idea that an arbitrary naive human should be able to properly
use a given tool without training or understanding is even more
wrong for computing than it is for other tools (e.g. automobiles,
airplanes, guns, power saws).
-- Doug Gwyn



------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

japari
In reply to this post by Nathan Abbott
Quoting Nathan Abbott <[hidden email]>:

> Btw, if anybody is interested in residential prepayments/OAS calculations
> and willing to implement that or is working on that, please contact me and
> we can hopefully coordinate. Please note however that we have limited
> (almost zero) expertise on that subject.
>

I can do the prepayment and default bits if you want, I am familiar with the
prepayment models. As you suggest this might change your pricing, I could
implement them as a probability of a notional surviving fraction.
We can work out the details.

Regards
Pepe

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

stefanadelbert
In reply to this post by Nathan Abbott
I was thinking of doing something fairly similar with QuantLib as part of a homeloan calculator I'm working on. My idea was to add to the C# codebase that is part of QLNet and extend the Bond class. I'm not as concerned about pricing the mortgage as generating payment and amortising principal schedules.

My background is in C++ so I would be OK working on C++ codebase, but would prefer to work directly on the C# codebase as C# would suit my purposes better.

Please get in touch if you reckon we could collaborate on this.

Stefan

Nathan Abbott wrote
I am c++ programmer that only knows the basics of quantitative finance.
Because I have been programming with QuantLib for two years, I think I have
a good understanding on how QuantLib works. Luigi Ballabio's * Implementing
QuantLib *has been a great help on understanding QuantLib. I am working with
a financial person who uses my program, He is fluent with quantitative
finance, but only knows a little c++ and does not know how QuantLib works.

We want to implement a simple version of mortgage bonds through a
MorgtageBond class that will probably inherit from the Bond class (and maybe
a FixedRateMortageBond and FloatingRateMortageBond classes derived from the
MortgageBond class) and would like to solicit some
opinions/suggestions/objections.

Currently we are thinking that it will be defined similar to the amortizing
bond classes (taking in a vector of nominals and dates generated outside of
QuantLib), but be derived from bond (and inherit all it's functions) and
adding specific functions to it (like weighted average life calculation).
Has anyone already done/thought of doing something similar?

Secondly, assuming prepayments are not an issue (which for our purposes they
are not), a simple mortgage bond is priced similar to corporate bonds,
meaning as a spread over swaps (i.e. on a yield basis, yield = swap rate +
spread), then use that sum as the yield to calculate the price. The bond
class has dirtyPrice and cleanPrice functions which take yield as an input.
We can get the par rate from the yield curve by using the parRate function
or instantiate a simple swap (as explained in yieldtermstructure.hpp
comments).

Our question is w.r.t the spread. We want to build a spread grid/matrix with
rating on one axis/rows and maturity/columns on the other. We were thinking
of creating a termspreadsurface (similar to capfloortermvolsurface) which
could be useful for mbs and corporate bonds (spread per rating/term). Has
anyone already done something similar?

Btw, if anybody is interested in residential prepayments/OAS calculations
and willing to implement that or is working on that, please contact me and
we can hopefully coordinate. Please note however that we have limited
(almost zero) expertise on that subject.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Nathan Abbott
I have a version of a Loan class, a FixedRateLoan class, a MortgageBond class, and a FixedRateMortgageBond class that I am working on. If any body wants to look at them just email me. Any suggests and comments would be helpful.

On Sun, Apr 5, 2009 at 10:56 PM, stefanadelbert <[hidden email]> wrote:

I was thinking of doing something fairly similar with QuantLib as part of a
homeloan calculator I'm working on. My idea was to add to the C# codebase
that is part of QLNet and extend the Bond class. I'm not as concerned about
pricing the mortgage as generating payment and amortising principal
schedules.

My background is in C++ so I would be OK working on C++ codebase, but would
prefer to work directly on the C# codebase as C# would suit my purposes
better.

Please get in touch if you reckon we could collaborate on this.

Stefan


Nathan Abbott wrote:
>
> I am c++ programmer that only knows the basics of quantitative finance.
> Because I have been programming with QuantLib for two years, I think I
> have
> a good understanding on how QuantLib works. Luigi Ballabio's *
> Implementing
> QuantLib *has been a great help on understanding QuantLib. I am working
> with
> a financial person who uses my program, He is fluent with quantitative
> finance, but only knows a little c++ and does not know how QuantLib works.
>
> We want to implement a simple version of mortgage bonds through a
> MorgtageBond class that will probably inherit from the Bond class (and
> maybe
> a FixedRateMortageBond and FloatingRateMortageBond classes derived from
> the
> MortgageBond class) and would like to solicit some
> opinions/suggestions/objections.
>
> Currently we are thinking that it will be defined similar to the
> amortizing
> bond classes (taking in a vector of nominals and dates generated outside
> of
> QuantLib), but be derived from bond (and inherit all it's functions) and
> adding specific functions to it (like weighted average life calculation).
> Has anyone already done/thought of doing something similar?
>
> Secondly, assuming prepayments are not an issue (which for our purposes
> they
> are not), a simple mortgage bond is priced similar to corporate bonds,
> meaning as a spread over swaps (i.e. on a yield basis, yield = swap rate +
> spread), then use that sum as the yield to calculate the price. The bond
> class has dirtyPrice and cleanPrice functions which take yield as an
> input.
> We can get the par rate from the yield curve by using the parRate function
> or instantiate a simple swap (as explained in yieldtermstructure.hpp
> comments).
>
> Our question is w.r.t the spread. We want to build a spread grid/matrix
> with
> rating on one axis/rows and maturity/columns on the other. We were
> thinking
> of creating a termspreadsurface (similar to capfloortermvolsurface) which
> could be useful for mbs and corporate bonds (spread per rating/term). Has
> anyone already done something similar?
>
> Btw, if anybody is interested in residential prepayments/OAS calculations
> and willing to implement that or is working on that, please contact me and
> we can hopefully coordinate. Please note however that we have limited
> (almost zero) expertise on that subject.
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
>

--
View this message in context: http://www.nabble.com/mortgage-bond-tp22403757p22902644.html
Sent from the quantlib-dev mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

stefanadelbert
Hi Nathan

I'm very keen to take a look at your implementations. Are your classes based on the C++ (QuantLib) or the C# (QLNet) codebase? Would you mind giving me a brief overview of what you are trying to achieve or model? Is your aim to value mortgages (MTM) or just to generate events and schedules (a la the ubiquitous online mortgage calculator, which is incidentally what I am trying to achieve)?

I would potentially be very keen to collaborate with you on this. It might require a shared codebase, possibly a branch off the QuantLib or QLNet trunk.

Stef

Nathan Abbott wrote
I have a version of a Loan class, a FixedRateLoan class, a MortgageBond
class, and a FixedRateMortgageBond class that I am working on. If any body
wants to look at them just email me. Any suggests and comments would be
helpful.

On Sun, Apr 5, 2009 at 10:56 PM, stefanadelbert <stefanadelbert@gmail.com>wrote:

>
> I was thinking of doing something fairly similar with QuantLib as part of a
> homeloan calculator I'm working on. My idea was to add to the C# codebase
> that is part of QLNet and extend the Bond class. I'm not as concerned about
> pricing the mortgage as generating payment and amortising principal
> schedules.
>
> My background is in C++ so I would be OK working on C++ codebase, but would
> prefer to work directly on the C# codebase as C# would suit my purposes
> better.
>
> Please get in touch if you reckon we could collaborate on this.
>
> Stefan
>
>
> Nathan Abbott wrote:
> >
> > I am c++ programmer that only knows the basics of quantitative finance.
> > Because I have been programming with QuantLib for two years, I think I
> > have
> > a good understanding on how QuantLib works. Luigi Ballabio's *
> > Implementing
> > QuantLib *has been a great help on understanding QuantLib. I am working
> > with
> > a financial person who uses my program, He is fluent with quantitative
> > finance, but only knows a little c++ and does not know how QuantLib
> works.
> >
> > We want to implement a simple version of mortgage bonds through a
> > MorgtageBond class that will probably inherit from the Bond class (and
> > maybe
> > a FixedRateMortageBond and FloatingRateMortageBond classes derived from
> > the
> > MortgageBond class) and would like to solicit some
> > opinions/suggestions/objections.
> >
> > Currently we are thinking that it will be defined similar to the
> > amortizing
> > bond classes (taking in a vector of nominals and dates generated outside
> > of
> > QuantLib), but be derived from bond (and inherit all it's functions) and
> > adding specific functions to it (like weighted average life calculation).
> > Has anyone already done/thought of doing something similar?
> >
> > Secondly, assuming prepayments are not an issue (which for our purposes
> > they
> > are not), a simple mortgage bond is priced similar to corporate bonds,
> > meaning as a spread over swaps (i.e. on a yield basis, yield = swap rate
> +
> > spread), then use that sum as the yield to calculate the price. The bond
> > class has dirtyPrice and cleanPrice functions which take yield as an
> > input.
> > We can get the par rate from the yield curve by using the parRate
> function
> > or instantiate a simple swap (as explained in yieldtermstructure.hpp
> > comments).
> >
> > Our question is w.r.t the spread. We want to build a spread grid/matrix
> > with
> > rating on one axis/rows and maturity/columns on the other. We were
> > thinking
> > of creating a termspreadsurface (similar to capfloortermvolsurface) which
> > could be useful for mbs and corporate bonds (spread per rating/term). Has
> > anyone already done something similar?
> >
> > Btw, if anybody is interested in residential prepayments/OAS calculations
> > and willing to implement that or is working on that, please contact me
> and
> > we can hopefully coordinate. Please note however that we have limited
> > (almost zero) expertise on that subject.
> >
> >
> ------------------------------------------------------------------------------
> > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> > CA
> > -OSBC tackles the biggest issue in open source: Open Sourcing the
> > Enterprise
> > -Strategies to boost innovation and cut costs with open source
> > participation
> > -Receive a $600 discount off the registration fee with the source code:
> > SFAD
> > http://p.sf.net/sfu/XcvMzF8H
> > _______________________________________________
> > QuantLib-dev mailing list
> > QuantLib-dev@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/quantlib-dev
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/mortgage-bond-tp22403757p22902644.html
> Sent from the quantlib-dev mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> QuantLib-dev mailing list
> QuantLib-dev@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

japari
In reply to this post by Nathan Abbott
Hi Nathan, yes thank you, I want to sign for the free copy :-)
I'll try to look at it from the prepayments/default side. But I do not
think I'll implement anything in the short term.
It is 0.9.7 code, right?

Regards
Pepe


Quoting Nathan Abbott <[hidden email]>:

> I have a version of a Loan class, a FixedRateLoan class, a MortgageBond
> class, and a FixedRateMortgageBond class that I am working on. If any body
> wants to look at them just email me. Any suggests and comments would be
> helpful.
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Nathan Abbott
Sorry for the delay. Here is what I have written so for. First the code is off QuantLib 0.9.7. It will not work with the current copy of QuantLib in subversion.
 
in ql/cashflows/cashflows.hpp,cashflows.cpp
    I add a sumAmount to the cashflows class. The loan class use this method.
 
 
in ql/cashflows/fixedratecoupon.hpp, fixedratecoupon.cpp
    I add delaydays method to a FixedRateLeg. We need this for Mortgage Bonds
 
in ql/experimental/loans/amortizingfixedrateleg.hpp, amortizingfixedrateleg.cpp
    I created a AmortizingFixedRateLeg class. This has the amortizing logic need to create a loan cash flow.
 
in ql/experimental/loans/loan.hpp, loan.cpp
    This is a base loan class. It is very similiar to the bond class.
 
in ql/experimental/loans/fixedrateloan.hpp, fixedrateloan.cpp
    This is a FixedRateLoan class that inherits from the loan class. It use the AmortizingFixedRateLeg to create it legs. It can create its own cash flows and get the npv from an pricingengine.
 
in ql/experimental/loans/discountingloanengine.cpp
    This is the pricing engine for the loan class.
 
in ql/experimental/mortgagebonds/mortgagebond.hpp, mortgagebond.cpp
    This is a base MortgageBond class. Obviously, it inherits from the bond class. Right now all it has is a  WAL calculation method.
 
 
in ql/experimental/mortgagebonds/fixedratemortgagebond.hpp, fixedratemortgagebond.cpp
    This is a FixedRateMortgageBond class. Obviously, it inherits from the mortgagebond class. It is very similiar to the AmortizingFixedRateBond


On Wed, Apr 8, 2009 at 3:24 AM, Jose Aparicio-Navarro <[hidden email]> wrote:
Hi Nathan, yes thank you, I want to sign for the free copy :-)
I'll try to look at it from the prepayments/default side. But I do not
think I'll implement anything in the short term.
It is 0.9.7 code, right?

Regards
Pepe


Quoting Nathan Abbott <[hidden email]>:

> I have a version of a Loan class, a FixedRateLoan class, a MortgageBond
> class, and a FixedRateMortgageBond class that I am working on. If any body
> wants to look at them just email me. Any suggests and comments would be
> helpful.
>


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

QuantLibLoans.zip (43K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

chenjiakai

Thanks a lot Nathan.  I am very interested in your extension and will look at it.  Regards,

 

Jiakai Chen

 


From: Nathan Abbott [mailto:[hidden email]]
Sent: Wednesday, April 08, 2009 10:41 PM
To: Jose Aparicio-Navarro
Cc: stefanadelbert; [hidden email]
Subject: Re: [Quantlib-dev] mortgage bond

 

Sorry for the delay. Here is what I have written so for. First the code is off QuantLib 0.9.7. It will not work with the current copy of QuantLib in subversion.

 

in ql/cashflows/cashflows.hpp,cashflows.cpp

    I add a sumAmount to the cashflows class. The loan class use this method.

 

 

in ql/cashflows/fixedratecoupon.hpp, fixedratecoupon.cpp

    I add delaydays method to a FixedRateLeg. We need this for Mortgage Bonds

 

in ql/experimental/loans/amortizingfixedrateleg.hpp, amortizingfixedrateleg.cpp

    I created a AmortizingFixedRateLeg class. This has the amortizing logic need to create a loan cash flow.

 

in ql/experimental/loans/loan.hpp, loan.cpp

    This is a base loan class. It is very similiar to the bond class.

 

in ql/experimental/loans/fixedrateloan.hpp, fixedrateloan.cpp

    This is a FixedRateLoan class that inherits from the loan class. It use the AmortizingFixedRateLeg to create it legs. It can create its own cash flows and get the npv from an pricingengine.

 

in ql/experimental/loans/discountingloanengine.cpp

    This is the pricing engine for the loan class.

 

in ql/experimental/mortgagebonds/mortgagebond.hpp, mortgagebond.cpp

    This is a base MortgageBond class. Obviously, it inherits from the bond class. Right now all it has is a  WAL calculation method.

 

 

in ql/experimental/mortgagebonds/fixedratemortgagebond.hpp, fixedratemortgagebond.cpp

    This is a FixedRateMortgageBond class. Obviously, it inherits from the mortgagebond class. It is very similiar to the AmortizingFixedRateBond

 

On Wed, Apr 8, 2009 at 3:24 AM, Jose Aparicio-Navarro <[hidden email]> wrote:

Hi Nathan, yes thank you, I want to sign for the free copy :-)
I'll try to look at it from the prepayments/default side. But I do not
think I'll implement anything in the short term.
It is 0.9.7 code, right?

Regards
Pepe



Quoting Nathan Abbott <[hidden email]>:

> I have a version of a Loan class, a FixedRateLoan class, a MortgageBond
> class, and a FixedRateMortgageBond class that I am working on. If any body
> wants to look at them just email me. Any suggests and comments would be
> helpful.
>

 


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

stefanadelbert
In reply to this post by Nathan Abbott
Hi Nathan

Today I've been playing with QLNet and ASP and have got a proof of concept going. I've just used the FixedRateBond class so far and have essentially modelled an interest only mortgage with it.

I have not had a look at your code yet, but I reckon that for my purposes I might take your C++ code and port it to the C# QLNet project onto a branch, if you're OK with that. I still need to finalise with the owners of QLNet about how best to do that.

Stefan

Nathan Abbott wrote
Sorry for the delay. Here is what I have written so for. First the code is
off QuantLib 0.9.7. It will not work with the current copy of QuantLib in
subversion.

in ql/cashflows/cashflows.hpp,cashflows.cpp
    I add a sumAmount to the cashflows class. The loan class use this
method.


in ql/cashflows/fixedratecoupon.hpp, fixedratecoupon.cpp
    I add delaydays method to a FixedRateLeg. We need this for Mortgage
Bonds

in ql/experimental/loans/amortizingfixedrateleg.hpp,
amortizingfixedrateleg.cpp
    I created a AmortizingFixedRateLeg class. This has the amortizing logic
need to create a loan cash flow.

in ql/experimental/loans/loan.hpp, loan.cpp
    This is a base loan class. It is very similiar to the bond class.

 in ql/experimental/loans/fixedrateloan.hpp, fixedrateloan.cpp
    This is a FixedRateLoan class that inherits from the loan class. It use
the AmortizingFixedRateLeg to create it legs. It can create its own cash
flows and get the npv from an pricingengine.

in ql/experimental/loans/discountingloanengine.cpp
    This is the pricing engine for the loan class.

 in ql/experimental/mortgagebonds/mortgagebond.hpp, mortgagebond.cpp
    This is a base MortgageBond class. Obviously, it inherits from the bond
class. Right now all it has is a  WAL calculation method.

  in ql/experimental/mortgagebonds/fixedratemortgagebond.hpp,
fixedratemortgagebond.cpp
    This is a FixedRateMortgageBond class. Obviously, it inherits from the
mortgagebond class. It is very similiar to the AmortizingFixedRateBond


On Wed, Apr 8, 2009 at 3:24 AM, Jose Aparicio-Navarro <japari@free.fr>wrote:

> Hi Nathan, yes thank you, I want to sign for the free copy :-)
> I'll try to look at it from the prepayments/default side. But I do not
> think I'll implement anything in the short term.
> It is 0.9.7 code, right?
>
> Regards
> Pepe
>
>
> Quoting Nathan Abbott <nkabbott@gmail.com>:
>
> > I have a version of a Loan class, a FixedRateLoan class, a MortgageBond
> > class, and a FixedRateMortgageBond class that I am working on. If any
> body
> > wants to look at them just email me. Any suggests and comments would be
> > helpful.
> >
>

 
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

javit
In reply to this post by Nathan Abbott

I'm planning to work on calculations for mortgage related products including prepayments and defaults such as OAS and OAD. Is anybody planning to develop new/existing objects for these calculations? Or already did?

Thank you,
Javit

Nathan Abbott wrote
I am c++ programmer that only knows the basics of quantitative finance.
Because I have been programming with QuantLib for two years, I think I have
a good understanding on how QuantLib works. Luigi Ballabio's * Implementing
QuantLib *has been a great help on understanding QuantLib. I am working with
a financial person who uses my program, He is fluent with quantitative
finance, but only knows a little c++ and does not know how QuantLib works.

We want to implement a simple version of mortgage bonds through a
MorgtageBond class that will probably inherit from the Bond class (and maybe
a FixedRateMortageBond and FloatingRateMortageBond classes derived from the
MortgageBond class) and would like to solicit some
opinions/suggestions/objections.

Currently we are thinking that it will be defined similar to the amortizing
bond classes (taking in a vector of nominals and dates generated outside of
QuantLib), but be derived from bond (and inherit all it's functions) and
adding specific functions to it (like weighted average life calculation).
Has anyone already done/thought of doing something similar?

Secondly, assuming prepayments are not an issue (which for our purposes they
are not), a simple mortgage bond is priced similar to corporate bonds,
meaning as a spread over swaps (i.e. on a yield basis, yield = swap rate +
spread), then use that sum as the yield to calculate the price. The bond
class has dirtyPrice and cleanPrice functions which take yield as an input.
We can get the par rate from the yield curve by using the parRate function
or instantiate a simple swap (as explained in yieldtermstructure.hpp
comments).

Our question is w.r.t the spread. We want to build a spread grid/matrix with
rating on one axis/rows and maturity/columns on the other. We were thinking
of creating a termspreadsurface (similar to capfloortermvolsurface) which
could be useful for mbs and corporate bonds (spread per rating/term). Has
anyone already done something similar?

Btw, if anybody is interested in residential prepayments/OAS calculations
and willing to implement that or is working on that, please contact me and
we can hopefully coordinate. Please note however that we have limited
(almost zero) expertise on that subject.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Luigi Ballabio
On Fri, 2009-12-11 at 10:23 -0800, javit wrote:
>
> I'm planning to work on calculations for mortgage related products including
> prepayments and defaults such as OAS and OAD. Is anybody planning to develop
> new/existing objects for these calculations? Or already did?

The last I knew was the post you quoted below.  There are no other plans
that I know of.  But if you didn't already, maybe you might want to
contact the original poster and see what happened?

Luigi



> Nathan Abbott wrote:
> >
> > I am c++ programmer that only knows the basics of quantitative finance.
> > Because I have been programming with QuantLib for two years, I think I
> > have
> > a good understanding on how QuantLib works. Luigi Ballabio's *
> > Implementing
> > QuantLib *has been a great help on understanding QuantLib. I am working
> > with
> > a financial person who uses my program, He is fluent with quantitative
> > finance, but only knows a little c++ and does not know how QuantLib works.
> >
> > We want to implement a simple version of mortgage bonds through a
> > MorgtageBond class that will probably inherit from the Bond class (and
> > maybe
> > a FixedRateMortageBond and FloatingRateMortageBond classes derived from
> > the
> > MortgageBond class) and would like to solicit some
> > opinions/suggestions/objections.
> >
> > Currently we are thinking that it will be defined similar to the
> > amortizing
> > bond classes (taking in a vector of nominals and dates generated outside
> > of
> > QuantLib), but be derived from bond (and inherit all it's functions) and
> > adding specific functions to it (like weighted average life calculation).
> > Has anyone already done/thought of doing something similar?
> >
> > Secondly, assuming prepayments are not an issue (which for our purposes
> > they
> > are not), a simple mortgage bond is priced similar to corporate bonds,
> > meaning as a spread over swaps (i.e. on a yield basis, yield = swap rate +
> > spread), then use that sum as the yield to calculate the price. The bond
> > class has dirtyPrice and cleanPrice functions which take yield as an
> > input.
> > We can get the par rate from the yield curve by using the parRate function
> > or instantiate a simple swap (as explained in yieldtermstructure.hpp
> > comments).
> >
> > Our question is w.r.t the spread. We want to build a spread grid/matrix
> > with
> > rating on one axis/rows and maturity/columns on the other. We were
> > thinking
> > of creating a termspreadsurface (similar to capfloortermvolsurface) which
> > could be useful for mbs and corporate bonds (spread per rating/term). Has
> > anyone already done something similar?
> >
> > Btw, if anybody is interested in residential prepayments/OAS calculations
> > and willing to implement that or is working on that, please contact me and
> > we can hopefully coordinate. Please note however that we have limited
> > (almost zero) expertise on that subject.
> >
> > ------------------------------------------------------------------------------
> > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> > CA
> > -OSBC tackles the biggest issue in open source: Open Sourcing the
> > Enterprise
> > -Strategies to boost innovation and cut costs with open source
> > participation
> > -Receive a $600 discount off the registration fee with the source code:
> > SFAD
> > http://p.sf.net/sfu/XcvMzF8H
> > _______________________________________________
> > QuantLib-dev mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/quantlib-dev
> >
> >
>
>
> -----
> Cavit (Javit) Hafizoglu
> mailto:[hidden email] mailto:[hidden email]



--

There are no rules of architecture for a castle in the clouds.
-- Gilbert K. Chesterton



------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

mtgequant
In reply to this post by Nathan Abbott
Nathan,

I wanted to see if you can help me with my problem. My current infrastructure is one where I have a Database of loan level information. I have another database which are the coefficients of a Regression model that takes the loan level information as input and then outputs the probability of default, prepayment and severity. I want to create a C++ program that reads the data from the 1st database ( loan level information) then reads the second database and then runs the equation to give loan level probability of default, prepayment and severity for each loan. It then should aggregate all the probabilities into one single prepayment,default and loss severity curve.

I heard from people that using a .dll file ( subroutine) would be the best approach and I wanted to see if you can help me with writing the code. I can send you the database if you want.

Thanks and Regards,

Nathan Abbott wrote
I am c++ programmer that only knows the basics of quantitative finance.
Because I have been programming with QuantLib for two years, I think I have
a good understanding on how QuantLib works. Luigi Ballabio's * Implementing
QuantLib *has been a great help on understanding QuantLib. I am working with
a financial person who uses my program, He is fluent with quantitative
finance, but only knows a little c++ and does not know how QuantLib works.

We want to implement a simple version of mortgage bonds through a
MorgtageBond class that will probably inherit from the Bond class (and maybe
a FixedRateMortageBond and FloatingRateMortageBond classes derived from the
MortgageBond class) and would like to solicit some
opinions/suggestions/objections.

Currently we are thinking that it will be defined similar to the amortizing
bond classes (taking in a vector of nominals and dates generated outside of
QuantLib), but be derived from bond (and inherit all it's functions) and
adding specific functions to it (like weighted average life calculation).
Has anyone already done/thought of doing something similar?

Secondly, assuming prepayments are not an issue (which for our purposes they
are not), a simple mortgage bond is priced similar to corporate bonds,
meaning as a spread over swaps (i.e. on a yield basis, yield = swap rate +
spread), then use that sum as the yield to calculate the price. The bond
class has dirtyPrice and cleanPrice functions which take yield as an input.
We can get the par rate from the yield curve by using the parRate function
or instantiate a simple swap (as explained in yieldtermstructure.hpp
comments).

Our question is w.r.t the spread. We want to build a spread grid/matrix with
rating on one axis/rows and maturity/columns on the other. We were thinking
of creating a termspreadsurface (similar to capfloortermvolsurface) which
could be useful for mbs and corporate bonds (spread per rating/term). Has
anyone already done something similar?

Btw, if anybody is interested in residential prepayments/OAS calculations
and willing to implement that or is working on that, please contact me and
we can hopefully coordinate. Please note however that we have limited
(almost zero) expertise on that subject.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Nathan Abbott
I finish working on creating a loan class and mortgagebond class for QuantLib. I and my user plan on submitting the classes to QuantLib, but we want to do so clean up first. He is out of town at the moment. I do not know when we will submit the classes, because I do not know when he will coming back. I can give you and anybody that wants the classes a prerelease copy of the classes. As for the database stuff I am sorry I am way to busy to help you there.

On Fri, Apr 30, 2010 at 10:09 AM, mtgequant <[hidden email]> wrote:

Nathan,

I wanted to see if you can help me with my problem. My current
infrastructure is one where I have a Database of loan level information. I
have another database which are the coefficients of a Regression model that
takes the loan level information as input and then outputs the probability
of default, prepayment and severity. I want to create a C++ program that
reads the data from the 1st database ( loan level information) then reads
the second database and then runs the equation to give loan level
probability of default, prepayment and severity for each loan. It then
should aggregate all the probabilities into one single prepayment,default
and loss severity curve.

I heard from people that using a .dll file ( subroutine) would be the best
approach and I wanted to see if you can help me with writing the code. I can
send you the database if you want.

Thanks and Regards,



------------------------------------------------------------------------------

_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

gigifaye29
In reply to this post by japari
Hi Pepe,

I saw your msg as below...wondering if you guys have done any of these yet on mortgage with prepayment options.

Thanks,
Xin


Jose Aparicio-Navarro wrote
Quoting Nathan Abbott <nkabbott@gmail.com>:

> Btw, if anybody is interested in residential prepayments/OAS calculations
> and willing to implement that or is working on that, please contact me and
> we can hopefully coordinate. Please note however that we have limited
> (almost zero) expertise on that subject.
>

I can do the prepayment and default bits if you want, I am familiar with the
prepayment models. As you suggest this might change your pricing, I could
implement them as a probability of a notional surviving fraction.
We can work out the details.

Regards
Pepe

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Mike@SFE
In reply to this post by Nathan Abbott
Does anyone know if an OAS framework for mortgage product has been developed in QuanLib?



<quote author="Nathan Abbott">

Btw, if anybody is interested in residential prepayments/OAS calculations
and willing to implement that or is working on that, please contact me and
we can hopefully coordinate. Please note however that we have limited
(almost zero) expertise on that subject.
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Baoho
In reply to this post by Nathan Abbott
Hello, Nathan.  It has been several years since your original post.  I am wondering where you are in terms of developing a mortgage class in QuantLib because I am now working on using Quantlib for mortgage valuation too.  I would greatly appreciate if you or any one else have any new information to offer on the subject.

Thank you very much.

Baoho Chang
Reply | Threaded
Open this post in threaded view
|

Re: mortgage bond

Baoho
In reply to this post by Nathan Abbott
Hello, Nathan.  Is it possible for you to send me a copy of your mortgage class for Quantlib?  Thank you so much.

Regards,

Baoho Chang