16

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
  • 15,034
  • 31
  • 92
  • 178

4 Answers4

15

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.

Alexander Oh
  • 24,223
  • 14
  • 73
  • 76
mikera
  • 105,238
  • 25
  • 256
  • 415
  • Thanks, really helpful post indeed. How do you go about using Incanter in Java though? – Bober02 May 23 '12 at 00:43
  • 1
    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.) – mikera May 23 '12 at 00:49
  • +1 - very nice. Sounds like you're doing nice work. – duffymo May 23 '12 at 01:23
2

QuantLib apparently has Java bindings via SWIG.

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
  • 2
    [JQuantLib](http://www.jquantlib.org/index.php/Main_Page) is a pure-Java reimplementation of QuantLib. I haven't tried it out, but it looks promising. – cww Jun 10 '12 at 02:40
2

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.

JodaStephen
  • 60,927
  • 15
  • 95
  • 117
Marc
  • 21
  • 1
1

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 ;).

Charles Cooper
  • 273
  • 1
  • 9