Quantlib
Quantlib
Quantlib
N. P. Firth
OCIAM, Mathematical Institute, 24-29 St. Giles, Oxford. OX1 3LB UK firth@maths.ox.ac.uk Summertown Solutions Ltd., Suite 140, 266 Banbury Road, Oxford. OX2 7DL UK neil@sumsol.co.uk Abstract. As the opensource movement gains momentum more projects are emerging in the domain of mathematical nance. There are a number of pricing libraries available for nancial derivatives, including QuantLib. QuantLib has an eective project structure and is achieving a critical mass of users and developers. Many user groups would benet by adopting the project. 1
1 Introduction
For most people working in the eld of mathematical nance it becomes necessary to code up derivatives pricing algorithms. While it is possible to design and write new code independently it is more powerful, and sometimes easier, to use and build upon existing projects, if these projects are well implemented. There are a number of libraries of varying quality for pricing nancial derivatives available on the internet. We look at the aims of these projects, and at the aims of opensource projects in general. We consider only opensource libraries, as they allow implementations of algorithms to be peer reviewed, and do not require any licensing fees. At this time opensource libraries for pricing nancial derivatives do not cover as many products, or implement as many models as closedsource packages. For a survey of closedsource software providers see Davidson (2004). Most real derivative pricing systems are implemented in C++ however, software tools such as Mathematica (2004) or Matlab (2004) are used by some companies for particular applications. These softwares are more useful for prototyping and are proprietary and therefore, beyond the scope of this paper. In section 2 we discuss some of the terms and issues involved in opensource software development, and survey existing projects for nancial derivatives. In section 3 we look at the dierent motivations of participants in opensource projects, and which are relevant to nancial mathematics. In the following section (section 4) we relate these issues to the QuantLib project. We look at potential user groups and briey discuss the practicalities of contributing to QuantLib. Conclusions are given in section 5.
N. P. Firth
5 6
GNU is a recursive acronym for GNUs Not Unix; it is pronouncedguh-no (GNU, 2004) see http://www.gnu.org/philosophy/free-sw.html for the full GNU denition of free software a history of the Open Source Initiative is available at http://www.opensource. org/docs/history.php see http://www.opensource.org/docs/definition.php see http://www.opensource.org/docs/certification mark.php
2.4 Licensing
Careful choice of license is critical to the survival and success of opensource projects. For example, if a license is not deemed opensource by the Open Source Initiative (2004) then the project will have diculty attracting developers as in the case of Netscape in 1998. Netscape released the source code of their browser under the Netscape Public License, this was not an opensource compatible license, according to the Open Source Initiative (2004), and few developers took up the project. Netscape changed the license to the Mozilla Public License, which was acceptable to the Open Source Initiative (2004), and the project is now successful. Choice of licensing by companies using opensource software is discussed in Bonaccorsi and Rossi (2003b). We need to dene the idea of Copyleft, Copyleft is a general method for making a program free software and requiring all modied and extended versions of the program to be free software as well7 . The three most popular free licenses are, as described on the GNU website8 : GNU General Public License or GNU GPL for short. This is a free software license, and a copyleft license. We recommend it for most software packages. GNU Lesser General Public License or GNU LGPL for short. This is a free software license, but not a strong copyleft license, because it permits linking with non-free modules. It is compatible with the GNU GPL. We recommend it for special circumstances only.
7 8
N. P. Firth
Modied Berkeley Software Distribution License or modied BSD license for short. This is the original BSD license, modied by removal of the advertising clause. It is a simple, permissive non-copyleft free software license, compatible with the GNU GPL. If you want a simple, permissive non-copyleft free software license, the modied BSD license is a reasonable choice. A full list of the OSI certied licenses is available from Open Source Initiative (2004)9 .
2.5 Hosting
The code of an opensource project has to be hosted on a server, somewhere on the internet. The GNU project hosts around 2,000 projects at a site called Savannah (2004). The largest such software development website is SourgeForge.net (2004). Of the approximately 50,000 opensource projects hosted at SourgeForge.net (2004): 71% are licensed under the GPL. 11% under the LGPL. 7% under the modied BSD license (SourgeForge.net, 2004).
In comparison there are just 2345 projects that are not deemed opensource by Open Source Initiative (2004). Non opensource projects can have great diculty attracting and retaining members as illustrated by the Netscape example above (Raymond, 2001; Bonaccorsi and Rossi, 2003b). Hosting a project at a dedicated site such as SourgeForge.net (2004) makes the project more accessible and it is easier to follow opensource management practices as described in Raymond (2000b). Setting up a project at SourgeForge.net (2004) indicates a commitment to the opensource community and an acceptance of opensource values (Raymond, 2000b). This helps to attract developers and users (Bonaccorsi and Rossi, 2003b).
see http://www.opensource.org/licenses/index.php
not classied as opensource by the Open Source Initiative (2004) would make it dicult to attract developers. QuantLib has an opensource license, is accessible to users, and the project administrators welcome developers. Currently QuantLib has 14 registered developers and around 400 users subscribed to the mailing list(Ametrano, 2004). It is achieving the critical mass of users needed to ensure the success of the project. QuantLib is also in use at a number of nancial institutions (Ametrano, 2004; Ballabio, 2004). While these institutions use the library they will ensure its quality for the nancial products in their portfolios.
3 Motivations of participants
Individuals and companies involved in opensource projects have diering motivations. Ideas from anthropology have been used to describe the processes involved in academic research and opensource software. These ideas are extended to the eld of mathematical nance.
N. P. Firth
For many years research has been published in paper journals and knowledge shared verbally at conferences. Knowledge is also disseminated through funding reports. Today the most ecient way of disseminating research is through the internet. Lawrence (2001) nds that online articles are around three times more likely to be cited than articles of similar quality not available online. Articles are also made easier to nd by online citation indexes such as CiteSeer (2004) (a description of how CiteSeer works is given in Lawrence et al. (1999)). The point of research is reduced if results are not published on the internet. As well as being available research also needs to be peer reviewed. Poor research is as easily disseminated as high quality research. Henneberg (1997) discusses the history and some of the failings of the peer review system.
3.3 Openscience
The Open Science Project (Open Science, 2004) is a group of scientists, mathematicians and engineers who recognise the importance of computer software to scientic development in their eld. The project aim is that computer software developed to obtain or process scientic results should be released under an opensource license. This enables the peer review of results by other researchers, and allows results to be veried by other researchers (Kiernan, 1999). The publication of any visualisation techniques and data sets in the public domain has already been recommended by Brown et al. (1995). Academic papers that are available online are more highly cited (Lawrence, 2001). It is easy to imagine that similar trends will appear between citations and participation in openscience projects. The author has experienced a marked increase in requests for preprints and speaking invitations since contributing to QuantLib. Clearly purely theoretical papers are still vital to progress, and should be available on the internet. However, mathematical nance as a research area is driven by practical needs so ideas must be implemented in order to be used. It is at this computational stage that openscience ideas should be adopted.
Survey
About two thirds of 29 Mathematical Finance researchers websites (from the United States and the European Union) informally surveyed have some of their publications available in pdf format on their website (see Table 1). However, only in a single case was any code at all made available. Clearly the benets of disseminating research over the internet have not yet been recognised by all researchers in the eld. Level of electronic Number of Percentage of availability of research researchers researchers No website 3 10% Website only 6 21% Papers online 19 66% Papers and code 1 3%
survey of 146 Italian companies. They found that the top three motivating reasons, using their exact wording, were: 1. Because Open Source software allows small enterprises to aord innovation. 2. Because contributions and feedback from the Free Software community are very useful to x bugs and improve our software. 3. Because of the reliability and quality of Open Source software. The rst of these reasons probably does not apply in the nancial sector, as banks are generally early adopters of technology and have large budgets for information technology. However, smaller institutions, such as asset management rms, or rms in developing countries, may benet from the innovation in opensource software. The second reason is certainly not altruistic. Firms participate in opensource projects so they can get free labour. The third most popular reason is valid for rms of all sizes. The most mature opensource projects are stable and reliable. Overall Bonaccorsi and Rossi (2003a) found that rms in general took more from the projects than they contributed. However, they also argue that successful projects are robust to rms being freeriders, and not contributing code back to the project.
4 QuantLib
QuantLib is a derivatives pricing library implemented in C++ . As the project website (QuantLib, 2004) says, The QuantLib project is aimed at providing a comprehensive software framework for quantitative nance. QuantLib is a free/opensource library for modeling, trading, and risk management in real-life. QuantLib is released under the modied BSD license (QuantLib, 2004). This enables the code to be modied and redistributed by banks or software houses without having to the release code for their proprietary models. A copyleft license (such as the GPL) would only permit the modication to take place within the company, if any code was redistributed all modications to the source would also have to be released under the copyleft license. As in all opensource projects there is a conict between the interests of individuals and corporations, and between contributers and freeriders. Individuals may take the code, but are not forced to
N. P. Firth
contribute code in return. QuantLib is not noticeably suering from the presence of freeriders. There are currently no competing projects to QuantLib with similar aims. QuantLib is the only pricing library which aims to be, and is, used in practice. The current project administrators are managing the project well, so the danger of a fork, or other conict is low. The project administrators are also maintaining a high level of code quality. One danger is the emergence of a competing project of higher quality, with a restrictive, non-free, license, which could divert eort from QuantLib. However, the emergence of such a project is unlikely at the moment, and as we have seen, a non-free license would discourage developers from contributing.
Academics
Academic faculty would also gain from the code debugging and software maintenance benets. They would be able to build models on an established base and be able to focus on interesting research problems. They will be able to continue computational work after their PhD students have left the university. Working code will be veried, tested, and adopted more quickly than academic papers alone. Academics researching in computational areas such as mathematical nance can greatly increase the impact of their work if both their papers and software implementations are available on the internet. As noted in the previous section, QuantLib may also become a useful tool in Masters courses in computational nance, attracting students paying large fees to the university.
Financial institutions
Buyside rms and sellside rms have dierent requirements and interests, so are considered separately. Obviously nancial institutions have the option of using commercial software solutions for their needs. Institutions, particularly in developing countries, may nd that the fact that QuantLib is free inuences their decision to adopt it as their pricing library. Using an opensource solution also gives control back to the institution and avoids vendor lockin.
Sellside institutions
Sellside institutions will not want to release proprietary pricing techniques into the code base. However, they may benet from using QuantLib as a benchmark. QuantLib is not a zero sum game. Just because sellside institutions may not contribute greatly to the project, that does not detract from QuantLibs usefulness to others. Also, just being a user and submitting bug reports is very helpful. QuantLib is useful for training potential recruits, and enabling those recruits to have some quality coding experience before starting work, thereby saving on training costs. A bank involved in QuantLib also gains access to the most technically competent students, ready ltered, without going through recruitment agents. Developers who already know the library also require less training, which is another saving.
Buyside institutions
There is more motivation for a buyside institution to contribute code for pricing algorithms than a sell-side institution. QuantLib is already used in production at a number of institutions (Ametrano, 2004; Ballabio, 2004). Each individual asset management house does not have as many resources to devote to model development as an Investment Bank, so pooling resources makes sense. Asset managers are able to tell whether they are being quoted good prices by sellside rms.
Financial regulation
A possible future use for QuantLib is in nancial regulation. Capital requirements for portfolios of derivatives could be specied using QuantLib pricing algorithms. A reference portfolio could utilize the QuantLib pricing library. QuantLib may become a method for transfering best practices from developed countries to emerging economies where nancial regulators are less experienced.
10
N. P. Firth
(2004) and CVS (2004). To get involved in a project there must also be the desire to contribute quality code, as a developer is unlikely to contribute code that reects badly on his programming ability. Therefore, though code contributions are vetted by the project manager they are welcomed and are usually worth including.
5 Conclusions
The impact, and scientic utility, of computational research in mathematical nance is much greater if it is implemented in a nancial derivatives project such as QuantLib, than if it were not available on the internet. Research available in QuantLib is easier to verify, as anyone can download, read, and run the code. It is also simpler for future researchers to improve code, and test new algorithms against existing implementations in a systematic manner. The Open Science Project aids the transfer of knowledge from universities to commerce. Companies benet from a stable code base. They are able to take advantage of the latest developments from academic research and improve the speed of implementations as needed. Financial institutions are not restricted in what they can do with the library, they have control and can add or change features as required. They also avoid vendor lockin. Such an approach is not possible with closedsource packages.
Acknowledgments
This work is supported by Nomura International plc and the EPSRC. The author would like to thank the QuantLib project leaders Ferdinando Ametrano and Dr. Luigi Ballabio. for their co-operation and useful suggestions. The author would also like to thank Dr. Ruth Stalker Firth for many useful discussions.
References
Ametrano, F. private communication, 2004. URL http://www.ametrano.net/. Arrow, K. J. Gifts and exchanges. Philosophy and Public Aairs, 1(4):343362, Summer 1972. Ballabio, L. private communication, 2004. Beck, K. Extreme Programming Explained: Embracing Change. Addison Wesley, 1999. Boehm, B. W. Improving software productivity. IEEE Computer, 20(9):3457, 1987. Boehm, B. W. A spiral model of software development and enhancement. IEEE Computer, 21(2):6172, 1988. Bonaccorsi, A. and Rossi, C. Altruistic individuals, selsh rms? The structure of motivation in Open Source software. Technical report, SantAnna School of Advanced Studies. Institute for Informatics and Telematics, 2003a. URL http:// opensource.mit.edu/papers/bnaccorsirossimotivationshort.pdf. Bonaccorsi, A. and Rossi, C. Licensing schemes in the production and distribution of Open Source software. An empirical investigation. Technical report, SantAnna School of Advanced Studies. Institute for Informatics and Telematics, 2003b. URL http://opensource.mit.edu/papers/bnaccorsirossilicense. pdf. Brooks, F. P. The Mythical Man Month and Other Essays on Software Engineering. Addison Wesley, 1995. Brown, J. R., Earnshaw, R., Jern, M., and Vince, J. Visualization: Using Computer Graphics to Explore Data and Present Information. John Wiley & Sons, 1995. CiteSeer. CiteSeer website, 2004. URL http://citeseer.ist.psu.edu/.
11
CVS. Concurrent Versions System website, 2004. URL http://www.gnu.org/ software/cvs/. Davidson, C. The Risk annual software survey 2004. Risk, 17(1), 2004. FpML. Financial Products Markup Language website, 2004. URL http://www. fpml.org/. GNU. Gnu website, 2004. URL http://www.gnu.org. Henneberg, M. Peer review: the holy oce of modern science. naturalSCIENCE, 1997. URL http://naturalscience.com/ns/articles/01-02/ns mh.html. Hertel, G., Niedner, S., and Herrmann, S. Motivation of software developers in open source projects: An internet-based survey of contributors to the Linux kernel. Research Policy, 32:11591177, 2003. Hyde, L. The Gift: Imagination and the Erotic Life of Property. Vintage Books, 1983. Kiernan, V. The open source movement turns its eye to science. The Chronicle of Higher Education, November 1999. URL http://chronicle.com/free/v46/ i11/11a05101.htm. Lakhani, K. R. and Wolf, R. G. Why hackers do what they do: Understanding motivation and eort in Free / Open Source software projects. Technical report, MIT Sloan School of Management, 2003. URL http://freesoftware.mit.edu/ papers/lakhaniwolf.pdf. Lawrence, S. Online or invisible? Nature, 411(6837):521, 2001. Lawrence, S., Giles, C. L., and Bollacker, K. Digital libraries and autonomous citation indexing. IEEE Computer, 32(6):6771, 1999. Martingale. Project Martingale website, 2004. URL http://martingale. berlios.de/. Mathematica. Mathematica website, 2004. URL http://www.wolfram.com/. Matlab. Matlab website, 2004. URL http://www.mathworks.com/products/ matlab/. Mauss, M. The Gift. Routledge Classics, 1925. Translated from Essai sur le don. degaard, B. A. Financial numerical recipes, 2004. URL http://finance.bi. no/bernt/gcc prog/. Open Science. Open Science website, 2004. URL http://www.openscience.org/. Open Source Initiative. Open Source Initiative website, 2004. URL http://www. opensource.org/. Premia. PREMIA website, 2004. URL http://cermics.enpc.fr/premia/. QuantLib. QuantLib website, 2004. URL http://www.quantlib.org/. Raymond, E. S. The cathedral & the bazaar, 2000a. URL http://www.catb.org/ esr/writings/cathedral-bazaar/. Raymond, E. S. Homesteading the Noosphere, 2000b. URL http://www.catb. org/esr/writings/cathedral-bazaar/. Raymond, E. S. The magic cauldron, 2000c. URL http://www.catb.org/esr/ writings/cathedral-bazaar/. Raymond, E. S. The Cathedral & the Bazaar. OReilly UK, 2001. Royce, W. W. Managing the development of large software systems: Concepts and techniques. In Proceedings of WesCon, August 1970. Savannah. Savannah.gnu.org website, 2004. URL http://savannah.gnu.org/. Schach, S. R., Jin, B., Wright, D. R., Heller, G. Z., and Offutt, A. J. Maintainability of the Linux kernel. Technical report, Department of Electrical Engineering and Computer Science, Vanderbilt University, 2003. URL http://www. vuse.vanderbilt.edu/srs/preprints/linux.longitudinal.preprint.pdf. Sommerville, I. Software Engineering. Addison Wesley, fourth edition, 1992. SourgeForge.net. SourceForge.net website, 2004. URL http://sourceforge. net/. Stallman, R. M. Free Software, Free Society: Selected Essays of Richard M. Stallman. Free Software Foundation, 2002. StatPro. StatPro website, 2004. URL http://www.statpro.com/.