Extending equity options and use of native quant libs



I have discovered Open Gamma, and I wanted to know if it was “easily” extendable to support new kind of options (i.e. barriers…).
I also wanted to know if it was possible to integrate an outside quant lib coded in C++ to the project?



We’ve got a page on adding new security types in our documentation. But we do already support equity barrier options (see EquityBarrierOptionSecurity). The data model supports both single and double barriers, with continuous or discrete sampling. The analytics/engine function side currently only supports single barriers.

In answer to your other question, yes, you can use C++ quant code with OpenGamma. This is the reason that functions implement both a FunctionDefinition and FunctionInvoker interface. This allows you to have a split of a FunctionDefinition that gathers all the required data from the engine and various Source/Master interfaces, probably written in Java (although there’s no reason you have to do that), but then you can have a FunctionInvoker which executes on the Calculation nodes via a native interface like JNI/JNA.

Because we’ve found that C++ quant libraries can be ‘quirky’ we’re planning to add more sophisticated support for native libraries over the next few months to include:

  • Protection/recovery from native-level errors (seg faults, SIGBUS, Fortran STOP, infinite loops, etc). We'll probably have a couple of options here from a separate process communicating via a pipe, to shared memory, depending on the level of isolation you require
  • Black-listing of calculations on targets (positions, etc) that persistently cause unrecoverable errors
  • Automatic detection of potential error conditions such as 'don't run over a midnight boundary' (to deal with poor code that statically samples the system clock), reset every n invocations (to prevent memory leaks building up), etc.
We already support:
  • Auto-retry of failed calculation jobs
  • Automatic job distribution to calculation nodes
  • Automatic failover of calculation nodes
Hope that helps.