Not able to add new functions


#1

Hi ,

I noticed that the list populated for functions under viewDefenition is from a class (Viewrequirements) and hence a static list. This means that i wont be able to add functions on my own.
Is there any way out where i can add my own function and at the same time view the function name under function list in the UI

I am using the develop branch

Thanks
Vineeth


#2

I am pretty sure this was working the other way before.

Thanks
Vineeth


#3

If you look in the config ini file (in examples this would be fullstack/fullstack-example.ini) there is a section, beginning on like 342 for a component called webBasics. You can optionally add a line to set a property on this component called valueRequirementNameClasses. This should contain a comma-separated (no spaces) list of fully qualified class names to scan for value requirement names. If you do provide this property, you will need to include com.opengamma.engine.value.ValueRequirementNames in the list to get the default set.

so, the resulting line would be something like:

valueRequirementNameClasses = com.opengamma.engine.value.ValueRequirementNames,com.my.company.MyValueRequirementNames


#4

Thanks @jim ,

That would be quite useful.

Thanks
Vineeth


#5

I gave “return null” for the function getRequirements to the function class i made.
When i changed it to new HashSet() , it seems to work properly


#6

Yeah, returning null from those functions is generally not a good idea as the engine assumes the function has blown up somewhere.


#7

Hello @jim ,

I am planning to create some functions dynamically.
Like i might add a different function for retrieving single day value for each timeseries available.
With this structure , i am not able to device a way to implement this.

Can you suggest a method to do it.

Thanks
Vineeth


#8

I’m not sure I understand your requirements.


#9

There is a function called TimeSeriesFunction and it has a constructer which accepts a timeseries field value.
Now i need function each which takes the average of all values in a timeseries.
hence if there is 2 timeseries called close , open , volume , there would be 3 functions registered called as openTimeseries , closedTimeseries and volumeTimeseries.
To achieve this i will maintain a single class which accepts the timeseries field name from its constructor.

The issue here is that , as the the timeseries names are not known before , i cant decide on which all variables to declare as static in the value requirement class.

Thanks
Vineeth


#10

Why not just have a single function and value requirement name that takes the field name as a constraint?


#11

I was trying to avoid changing viewdefenition for each execution.