code: public double getSpread(double bondPrice, Curve referenceCurve, AnalyticModel model) {
  		GoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0);
  		while(search.getAccuracy() > 1E-11 && !search.isDone()) {
  			double x = search.getNextPoint();
  			double fx=getValueWithGivenSpreadOverCurve(0.0,referenceCurve,x,model);
  			double y = (bondPrice-fx)*(bondPrice-fx);
  
  			search.setValue(y);
  		}
  		return search.getBestPoint();
  	}
docs: Returns the spread value such that the sum of cash flows of the bond discounted with a given reference curve
  with the additional spread coincides with a given price.
  
  @param bondPrice The target price as double.
  @param referenceCurve The reference curve used for discounting the coupon payments.
  @param model The model under which the product is valued.
  @return The optimal spread value.