finmath / finmath-lib

Mathematical Finance Library: Algorithms and methodologies related to mathematical finance.
Apache License 2.0
488 stars 168 forks source link

Stricter behaviour of CalibratedCurves::createForwardCurve() #29

Closed NiklasRodi closed 7 years ago

NiklasRodi commented 7 years ago

What is this PR for?

What type of PR is it?

Feature

cfries commented 7 years ago

I do not understand the change. Maybe I have to look more closely,.... but:

Confused.

(I though that the unit test should fail with this code, I have to check...)

cfries commented 7 years ago

Also: Why was

    private static final boolean isUseForwardCurve;
    static {
        // Default value is true
        isUseForwardCurve = Boolean.parseBoolean(System.getProperty("net.finmath.marketdata.calibration.CalibratedCurves.isUseForwardCurve","true"));
    }

removed. What about the situations where only likes to switch between the two approaches?

NiklasRodi commented 7 years ago

I don't like the feature that a forwardCurve is always created, even if the given forwardCurveName was not found in the model at all. What if I have already added a forwardCurve to my model that is almost "empty" but has e.g. a specific Interpolation method. Now I want to calibrate that curve but have a typo in the forwardCurveName such that it is not found in the model. Instead of getting an exception and being able to correct the name I will get some default forwardCurve that has not the interpolation method I wanted. This error will be very nasty to find. Maybe there are even worse problems.

I prefer the solution where the forwardCurve has to be created outside modulo maybe the wrapping feature (i.e. at least a Discount curve to base my forward curve on has to be created outside). I admit that the wrapping is the only feature left in the function (so maybe one should use a different name?). However, at one point I would also like to get rid of that internal wrapping (again it should be done outside) making the method totally redundant, i.e. at that point I would delete it for good.

NiklasRodi commented 7 years ago
cfries commented 7 years ago

OK. Now I understand your intention. But...

... let me check....

NiklasRodi commented 7 years ago
NiklasRodi commented 7 years ago

Closed as (partially) implemented in commit d2c95c4