21
$\begingroup$

I am looking for an all-java implementation of black scholes, preferably open source. I found jquantlib and quantlib (C++). Any other recommendations?

The jquantlib site seems to be down.

I'd prefer to stay away from a C++ implementation that runs on a jvm like quantlib seems to be. My team would like to look at the code if open source and none of us are C++ capable.

$\endgroup$
3
  • $\begingroup$ Odd, the site is down for me too. $\endgroup$
    – Ellie K
    Commented Sep 13, 2011 at 21:31
  • $\begingroup$ Yes - i wonder why. It seems to have a sufficiently active following $\endgroup$
    – colin
    Commented Sep 14, 2011 at 19:05
  • $\begingroup$ Try Maygard, it's all Java. $\endgroup$ Commented May 1, 2013 at 13:51

3 Answers 3

13
$\begingroup$

Black Scholes in java?

This guy, Christian Fries http://www.christian-fries.de/, has some impressive codes and a book on these topics.

You can find http://www.christian-fries.de/finmath/book/index.html the contents as well as the library itself http://www.finmath.net/finmath-lib/.

As well as your request, you'll see LIBOR model, HJM model, binomial model, etc. Of course there are numerical algorithms to solve these problems like Box Muller transform, etc.. He also has a straight forward approach to theoretical stuff on the topics(probably much straight forward than others)

Hope it helps!

$\endgroup$
3
  • $\begingroup$ Ok - finmath appears useful. Thx. Tho the test applets appear to require java 1.5 only. But I'll keep looking. $\endgroup$
    – colin
    Commented Sep 14, 2011 at 18:52
  • $\begingroup$ The code uses enums and generics, so it'll require at least Java 5 (which, to be fair, had been out for almost seven years when @colin's comment was posted!) $\endgroup$ Commented Jan 29, 2013 at 16:44
  • $\begingroup$ It is now at Java 6 and we are developing a branch which will use Java 8. Intention is to support Java 6 and Java 8 by two different releases. $\endgroup$ Commented Aug 31, 2013 at 19:15
6
$\begingroup$

QuantLib itself also provides Swig interfaces which can be used to create bindings for dozens of languages, Java included. Quoting:

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of target languages including common scripting languages such as Perl, PHP, Python, Tcl and Ruby. The list of supported languages also includes non-scripting languages such as C#, Common Lisp (CLISP, Allegro CL, CFFI, UFFI), D, Go language, Java, Lua, Modula-3, OCAML, Octave and R.

See the QuantLib site for more on support for other languages and extensions.

On the other hand, JQuantLib is an independent project that was last reported to have a good sized portion of a prior release ported to Java.

$\endgroup$
4
$\begingroup$

Yep, there is one and it's leagues better than jquantlib.

https://code.google.com/p/maygard/

$\endgroup$
7
  • 1
    $\begingroup$ Why is it better? Your answer would be significantly improved if you add a few points along these lines. $\endgroup$ Commented Apr 29, 2013 at 13:44
  • 1
    $\begingroup$ I wonder too why it's 'leagues better', from quickly looking at the source I'd say it's 'leagues' worse. The payoff for futures contracts is simply wrong, and (unless the java compiler does miracles) the numerical routines look rather slow. $\endgroup$
    – hroptatyr
    Commented Apr 30, 2013 at 10:54
  • $\begingroup$ It's leagues better because unlike jquantlib it's actually an object-oriented "Java API" and not a C++ procedural convert. I've used the API for fast, accurate and precise pricing of bonds and exotic options. The numerical routines are only as slow as your computer; if you want real-time performance you need to get a 'Real-Time JVM' such as Oracle's JRockIt. $\endgroup$ Commented May 1, 2013 at 13:01
  • $\begingroup$ Can you update your answer to state this? Also, JRockit isn't a real-time java. Did you mean a JIT? $\endgroup$ Commented May 10, 2013 at 1:51
  • $\begingroup$ Oracle JRockit Real Time offers response time capabilities in microseconds! It guarantees a maximum response time of single digit milliseconds with Deterministic-GC and contains Latency Analysis Tools for monitoring and tuning the application. oracle.com/technetwork/middleware/jrockit/overview/… $\endgroup$ Commented May 10, 2013 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.