# UD Fin Lib

Ugly Duckling Finance is currently working on its financial library, UDFinLib. UDFinLib will appear soon and will be advertised on this blog and website. Everybody interested is therefore invited to come back later when it will be ready to use. In this blog post I would like to anticipate some of the features of the library.

The library comes in two parts: the core and the Excel Add-in.

The core contains the real implementation of the various functionalities of the library. It is written in C# and tested with NUnit. It contains several building blocks, each corresponding to specific namespaces. They all interact with each other and a pretty complex structure emerges for the dependencies. The most important blocks are the following:

• The Math namespace. It allows the user to use strictly mathematical methods that are relevant in finance and whose implementations are based either on academic papers or best practice. It contains tools for optimisation and root finding (e.g. the Brent algorithm), linear algebra manipulations and operations with vectors and matrices, interpolation of data points to construct the curve that passes through them (such as the Bessel splines and the monotone splines, the financial Hagan-West splines, etc.), random number generators with the best built-in Gaussian generator, and much more.
• The Date namespace. It allows the user to define dates and tenors, to construct timelines, and keeps information about day count conventions, business day conventions. This building block is very straightforward, but also very useful for practical purposes when dates are important. One very useful method computes the time between two dates by taking into account proper counting conventions.
• The Curve namespace. It allows the user to construct the yield and forward curves from market data. The user needs to specify the input as a collection of nodes (i.e. dates and rates), as well as the desired starting date and interpolation method. It is also possible to define a toy flat curve that does not take market data as input and can be used to perform sanity (are the expected result correct?) and consistency (does the Curve namespace work well with the other namespaces in the library?) checks. Some of the most useful methods are the ones that compute zero and forward rates, as well as discount factors.
• The Fixed Income namespace. This block contains all the financial information that the user needs in order to deal with fixed income instruments. It allows the user to construct specific products and contracts (for example, cash and swaps), as well as to work out the cash flows associated to a particular instrument. In particular, among other functionalities, the user can compute present values of any cash flows, sensitivity on the nodes point (i.e. the PV01), and the risk management positions.

The Excel Add-in is an application programming interface (API) that translates the methods of the core library into Excel functions. While the core is used only by the developers of the library and it will be secrete, these functions will be available to any users. The user will be in fact able to take advantage of the UDFinLib additional functionalities as if they were just Excel functions, thus without extra pain. In order to keep them distinct from Excel, however, we have conventionally decided to have their names in lower case, except for the first letter and any intermediate letters whenever they start a new word within the same command name (notoriously, Excel functions are written in upper case).

The big advantage of having an Excel add-in for the core is that anybody with some financial knowledge and experience with Excel will be able to enjoy our library. No extremely technical competencies are required from the user perspective. This makes UDFinLib very flexible a library that even soft-skilled people can use, since they can forget about the technical implementation, which is left to the developers. That's clearly not the case for the core.

Besides the core and the Excel add-in, there might appear additional parts in the future, corresponding to more plug-ins into other environments (e.g. Matlab, Mathematica, etc.). However, the relevant API's have not been implemented yet at this stage.

UDFinLib will also have its own website, where all the information about how to download it, install it, get a licence, import it into Excel, and above all about how to use it. In fact, there will be an online manual with extensive examples of how to get a first grip on the library functions, and also on how more complicated outputs can be built with a single command but changing a few (sometimes just one) parameters.

If you are interested to know more about this library and, most importantly, if you are interested to use it, we advice you to check this website regularly, because the first release of UDFinLib will be soon announced here. Stay tuned.