Serving the Quantitative Finance Community

 
User avatar
ioNab
Topic Author
Posts: 0
Joined: July 3rd, 2005, 8:58 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 3:41 pm

Hi!..Newly graduated from school, I have to build my first C++ library for pricers, solvers..etc. I m wondering if there are some recommandations to respect (I wanted to start building a UML diagramm, but I dont think it s a good idea as I dont know all the packages and classes I ll use). The point here is that I want to start with small library that I ll easily extend.My question for people who once did that (quants and quant devs..): are there recommanded architectures I can make? does smone have a model to give me?..Thnkx very much..
 
User avatar
lballabio
Posts: 0
Joined: January 19th, 2004, 12:34 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 3:59 pm

My recommendation, albeit a biased one, is to use QuantLib.Luigi
 
User avatar
ioNab
Topic Author
Posts: 0
Joined: July 3rd, 2005, 8:58 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 4:08 pm

 
User avatar
ioNab
Topic Author
Posts: 0
Joined: July 3rd, 2005, 8:58 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 4:10 pm

I ve already seen this one. seems interesting, but I dont want to copy sources. I need more to know what the building procedure is..thnx lballbio..
 
User avatar
lballabio
Posts: 0
Joined: January 19th, 2004, 12:34 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 4:22 pm

Hmm. It's kind of hard to say how to proceed---design is kind of an art, and experience is a large part of it.However, you can start in at least two ways:a) bottom-up: think of the concepts you'll most likely use. For instance, you can't think of all possible financial instruments you'll have to implement, but "financial instrument" is a concept in its own right. Have a guess at the interfaces such concepts should implement.b) top-down: think of two or three instruments you'll want to price and sketch what you'll need. Look for common features and abstract them.Luigi
 
User avatar
ioNab
Topic Author
Posts: 0
Joined: July 3rd, 2005, 8:58 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 4:29 pm

 
User avatar
ioNab
Topic Author
Posts: 0
Joined: July 3rd, 2005, 8:58 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 4:32 pm

OK, but dont we normally start with implementing basic things (solvers (newton,..etc), integration methods, sde solvers..) so that we can use them for all our pricing fuctions.. The pricers are, I think, the last think to do..?!?
 
User avatar
lballabio
Posts: 0
Joined: January 19th, 2004, 12:34 pm

Classicals steps to build a C++ numerical library?

November 18th, 2005, 8:05 pm

That would be even more bottom-up design. It's a possibility. But be careful that later you don't have to arrange the implementation of your pricers in order to adapt to the interface of your basic tools. It would be the wrong way around.Also, since you said you just graduated: how much programming and how much designing did you do? Starting with a library is not the easiest thing to do, since it has to be more general and therefore it is much more difficult to design than, say, an application. This was the reason for my suggestion of implementing a few pricers, make basic classes in the process, and abstract the common parts: the pricers would be some kind of mini-application, and in implementing them the design of the library (did I mention it is a difficult thing to get upfront?) might start to surface.Luigi
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Classicals steps to build a C++ numerical library?

November 18th, 2005, 8:19 pm

QuoteOriginally posted by: ioNabHi!..Newly graduated from school, I have to build my first C++ library for pricers, solvers..etc. I m wondering if there are some recommandations to respect (I wanted to start building a UML diagramm, but I dont think it s a good idea as I dont know all the packages and classes I ll use). The point here is that I want to start with small library that I ll easily extend.My question for people who once did that (quants and quant devs..): are there recommanded architectures I can make? does smone have a model to give me?..Thnkx very much..> Newly graduated from schoolIn which discipline, which level?Take a small subset of Numerical Analysis that your are good in and build on that. Any way, I wish you good luck.To be honest, this is a very ambitious undertaking. Do you have a Numerical Analysis background? and know C++? Then start.This article I would consider to be my best shot (as of Nov 2005) on a framework for FDM. PM me if you have further questions.
Last edited by Cuchulainn on November 17th, 2005, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Classicals steps to build a C++ numerical library?

November 18th, 2005, 8:24 pm

> That would be even more bottom-up designFor modules (like as in Fortran), bottom-up is mandatory, e.g. I want a LU solver.But for systems we need CDB (top-down decomposition) and C++ objects at lower levels. I lived this in late 1990's in another discipline. It might go the same way in QF. No more methods and polymorphism as such, but interfaces.If you are liking ARCH check this out.
Last edited by Cuchulainn on November 17th, 2005, 11:00 pm, edited 1 time in total.
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

Classicals steps to build a C++ numerical library?

November 20th, 2005, 6:32 pm

What sort of instruments are you working on ?Term structured ? Spot ?
 
User avatar
DavidJN
Posts: 269
Joined: July 14th, 2002, 3:00 am

Classicals steps to build a C++ numerical library?

November 20th, 2005, 7:43 pm

I know this wasn't the actual topic of this post, but somewhere along the line you will also have to give a considerable amount of thought to date/time libraries. Based on about 15 years of experience in the business, I’d say about 1/4 of the effort in modeling any financial problem is getting the date math correct - that is, creating/splitting dates from/into year, month, date, incrementing dates according to the various date rolls, accruing cash flows according to the various day counts, etc. This attention to detail is what separates the sometimes slightly “naïve” software created by otherwise skilled people coming from other disciplines from usable financial workhorses. A word of advice here – when you go to show off your latest Bermudan swaption pricing software to a trading desk the first thing they’ll do (if they know what they are doing) is use it to price the underlying. That is usually when the budding software vendor is politely shown the door. In other words, spend lots of time on the basics because you'll be glad you did when it comes to doing the fancy stuff later.
 
User avatar
ioNab
Topic Author
Posts: 0
Joined: July 3rd, 2005, 8:58 pm

Classicals steps to build a C++ numerical library?

November 21st, 2005, 3:05 pm

> Newly graduated from schoolIn which discipline, which level?>>from a french grande ecole, major in quantitative finance..Take a small subset of Numerical Analysis that your are good in and build on that. Any way, I wish you good luck.To be honest, this is a very ambitious undertaking. Do you have a Numerical Analysis background? and know C++? Then start.>Yes for numerical analysis. I m not strong in C++ (it s the first time I m programming a big thing with, but I m ok with the object oriented - I ve worked with java j2ee long timle ago.. anyway, the programming is not my problem, I want to focus on the design..
 
User avatar
ioNab
Topic Author
Posts: 0
Joined: July 3rd, 2005, 8:58 pm

Classicals steps to build a C++ numerical library?

November 21st, 2005, 3:08 pm

thanx Cuchulainn !! it s interesting..