/src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/LocalRiskMinimizingHedgePortfolio.java
final RandomVariable newNumberOfNumeraireAsset = amountOfNumeraireAsset.add ( numeraireAssetsToBuy ) ;
final RandomVariable delta = derivativeTimesUnderlyingExpected.div(underlyingRabasedMartingaleSquaredExpected); final RandomVariable underlyingValue = model.getAssetValue(time,0); final RandomVariable numeraireValue = model.getNumeraire(time); final RandomVariable newNumberOfStocks = delta; final RandomVariable stocksToBuy = newNumberOfStocks.sub(amountOfUderlyingAsset); final RandomVariable numeraireAssetsToBuy = stocksToBuy.mult(underlyingValue).div(numeraireValue).mult(-1); <extra_id_0> amountOfNumeraireAsset = newNumberOfNumeraireAsset; amountOfUderlyingAsset = newNumberOfStocks; } final RandomVariable underlyingAtEvaluationTime = model.getAssetValue(evaluationTime,0); final RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime); final RandomVariable portfolioValue = amountOfNumeraireAsset.mult(numeraireAtEvaluationTime).add(amountOfUderlyingAsset.mult(underlyingAtEvaluationTime));