Skip to content
All library documents

Libraries for Pricing FX Forward Contracts

Article Quant Q&A · Author: beta

Summary

The document asks about software for valuing foreign exchange forward deals from trade details such as currencies, notional, forward and spot rates, and relevant dates. It frames fair value as having sensitivity to both exchange-rate changes and interest-rate changes, and seeks a library that can perform the calculation from supplied inputs.

The accepted response names QuantLib and OpenGamma as open-source libraries with broad product and model coverage. QuantLib is described as written in C++ with interfaces for languages including Python, plus tools for connecting pricing libraries to Excel. OpenGamma is described as Java-based, harder to implement, and less thoroughly documented, with commercial support available from its developer. The answer recommends these as starting points rather than explaining a valuation formula or specifying the market curves, conventions, calendars, or other inputs required. Library capabilities and implementation fit should therefore be checked for the intended product and workflow.

Key ideas

  • FX forward valuation uses trade details including currencies, notional, rates, and dates.
  • The question highlights exchange-rate and interest-rate contributions to fair value.
  • QuantLib is a C++ library with interfaces for languages such as Python.
  • OpenGamma is a Java library and is described as having commercial support.
  • The excerpt gives no valuation formula or detailed market data requirements.

Tags

Full text
# Software library: Pricing financial instruments, such as FX Forwards


# Software library: Pricing financial instruments, such as FX Forwards












I am currently reading material on how to price financial instruments such as FX Forward deals. One way of doing this seems to be by calculating its Fair Value³. This value can be split into two components wheras the first one is the part which is responsible for exchange rate changes, and the second part is responsible for interest rate changes.

My question is: Are there any libraries available, that do this calculation given that I provide the necessary input parameters?

Input parameters are:

- bought currency

- sold currency

- nominal value

- forward rate

- spot rate

- action date

- deal date

- maturity date

- value date

## Answer by Bernd (score 3, accepted)

https://quant.stackexchange.com/a/40350

There are two open source libraries that you should take a look at. Both feature a wide list of products and models.

- QuantLib. Written in C++ but usable in other languages such as Python. The library is developed for several years now. A feature that might come very handy is that there are toolboxes to implement derivative pricing libraries in Excel. Take a look here: https://www.quantlib.org/

Personally I use this book for learning QuantLib-Python: https://leanpub.com/quantlibpythoncookbook

- OpenGamma. Written in Java. In my view a bit harder to implement and less good documented. However, ther company that has developed it, offers commercial support. This might be an argument if you are writing software for a bank/company. Take a look here: https://opengamma.com/

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.