Can OpenGamma support weighted portfolio?


I would like to attach a weight (probably calculated from the market value) on the nodes of a portfolio to calculate the weighted value(eg. market value weighted beta)


To calculate weight of a portfolio based on market value, I need to get the total market value of the portfolio which the security contained.
see weight function here
in which I have added a requirement to get the market value of the portfolio node that security contains.
I could not find as the market value of the portfolio is available there.

market value function is already written as

and getting corresponding values


You might have better luck looking at the *ScalingFunction classes. In here you could add in a multiplier that you get from the target portfolio node. This would then apply the scaling to all (linear) analytic outputs. Try and/or * Portfolio nodes can have arbitrary string attributes attached so you could just parse a value out of those. You might have to add the attributes programatically though as I don’t think our UI lets you see or manipulate the attribute set.


Portfolio level sum is the sum of each sub portfolio_node from the portfolio’s root node down to the leaf. got the desired result changing the appropriate targets.


But still I could not find a way to pass a parameter to the function for eg. getting the total market value of a particular portfolio on a particular date, if I pass a date to the function.