Quantitative finance/mathematical library for Java

14,575

Solution 1

I do quite a bit of numerical work in Java and Clojure so hopefully my perspective can be useful.

For 1. and 2. here are some options to explore:

  • Parallel Colt - very comprehensive, high-performance mathematical library. Good for lots of vector processing which you get in finance apps.
  • Incanter - R-like statistical library for Clojure (very easy to embed in a Java app). Has pretty much all the statistical tools you could desire, plus is very easy to extend if you want to create your own DSLs
  • EJML - probably the fastest matrix library available in Java
  • Apache Commons Math - handy collection of maths and statistical tools

For 3. (financial models) these tend to be pretty bespoke to the problem you are trying to solve. I doubt you would want to use an off-the-shelf solution even if it existed. I'd suggest developing yourself using the toolkits mentioned above.

Solution 2

QuantLib apparently has Java bindings via SWIG.

Solution 3

Strata from OpenGamma contains those items. It is a professional quantitative finance library written in Java and open source.

The quantitative finance part contains interest rate, forex and equity models. It is developed by industry quants for bank and hedge funds. I don't which type of financial models you want to use; there is a large panel of models and asset classes and you should be able to find off-the-self a professional type implementation.

Solution 4

IdylFin might be just what you are looking for -- inspired by quantmod, it contains some blazing fast, numerically stable statistical methods, an API to Yahoo Finance, as well as some portfolio optimization methods and it's being extended actively.

Disclaimer: I am the author of the library, and it would knock my socks off if you used it ;).

Share:
14,575
Bober02
Author by

Bober02

Something will be added here

Updated on June 05, 2022

Comments

  • Bober02
    Bober02 almost 2 years

    I am currenlty working on a project which relies on a couple of mathematical/statistical/financial tools which I would ideally like to include in one (perhaps several) libraries. What I would like to have is:

    1. Statistical measures - modes, variance etc.
    2. probability distributions + sampling from them available
    3. financial models for e.g. option pricing

    Does anyone have an idea which libraries might be useful?

  • Bober02
    Bober02 almost 12 years
    Thanks, really helpful post indeed. How do you go about using Incanter in Java though?
  • mikera
    mikera almost 12 years
    I normally do the development work in a Clojure REPL (in Eclipse with the Counterclockwise plugin). Then you can save your finished Incanter code in .clj files which you bundle in your Java project along with clojure.jar as a dependency. Then you can call your functions using the normal techniques to call Clojure code from Java. Works pretty smoothly. There's even good Maven integration (so you can run your Clojure test suite as part of a one-click build etc.)
  • duffymo
    duffymo almost 12 years
    +1 - very nice. Sounds like you're doing nice work.
  • cww
    cww almost 12 years
    JQuantLib is a pure-Java reimplementation of QuantLib. I haven't tried it out, but it looks promising.
  • Rishav Dry
    Rishav Dry about 5 years
    This library is no longer maintained. New one is called Strate - github.com/OpenGamma/Strata