public static CurvePoint Solve(this ExtrapolationLong extraShort, CurvePoint min, Maturity maturity) { var p = min.ToPoint(); var x = maturity.ToX(); var point = extraShort.GetPoint(p, x); return(CurvePoint.FromPoint(point, min.Price.Currency)); }
public static CurvePoint Solve(this Interpolation interpolation, CurvePoint a, CurvePoint b, Maturity maturity) { if (a.Price.Currency != b.Price.Currency) { throw new NotImplementedException("Converting between currencies is not supported"); } var pointA = a.ToPoint(); var pointB = b.ToPoint(); var x = maturity.ToX(); var point = interpolation.SolveForY(pointA, pointB, x); return(CurvePoint.FromPoint(point, a.Price.Currency)); }
public Point ToPoint() => new Point(Maturity.ToX(), Price.ToY());