Writing a new Engine function


#1

I added a new engine function as per the steps laid out below:
http://docs.opengamma.com/display/DOC200/Writing+an+Engine+Function

When I run the open gamma server I see the getResults() method getting called for my function but for some reason the execute method is not getting invoked. I have registered the function in the function repository, any ideas?


#2

This usually happens if the value requirement you return from getResults() doesn’t match what you’re asking for in your view definition. Or it could be that your requirements can’t be satisfied. Try overriding the method canHandleMissingInputs and returning true. That might get you further.

Another avenue to look as is that there is another call to a different form of getResults() in the superclass which is invoked later on. It has more information and you might want to examine how it’s mapping requirements into specifications (what you ask for vs what you’re going to get).

A last option is to use the EngineDebugger, which can be launched from either the command line or your IDE. It needs a parameter of

-c http://localhost:8080

if you’re running the fullstack locally. This tool lets you see the trace all the functions that get tried. You need to choose your view and target object from the portfolio viewer on the left and type in your value requirement in it’s textual representation which is e.g.

Present Value[Currency=USD,Aggregation=[MissingInputs]?]

where currency and aggregation are value properties, and MissingInputs is labelled optional.