Can OpenGamma support weighted portfolio?


#1

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)


#2

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 https://gist.github.com/febintt/8109409
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


#3

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 PositionAndTradeScalingFunction.java and/or *SummingFunction.java. 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.


#4

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.


#5

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.