Beispiel #1
0
def test_FinIborFuture():

    todayDate = Date(5, 5, 2020)

    testCases.header("VALUES")

    for i in range(1, 12):
        fut = IborFuture(todayDate, i, "3M")
        testCases.print(fut)

        fra = fut.to_fra(0.020, 0.0)
        testCases.print(fra)
Beispiel #2
0
def test_bloombergPricingExample():
    """ This is an example of a replication of a BBG example from
    https://github.com/vilen22/curve-building/blob/master/Bloomberg%20Curve%20Building%20Replication.xlsx
    """

    valuation_date = Date(6, 6, 2018)

    # We do the O/N rate which settles on trade date
    spot_days = 0
    settleDt = valuation_date.add_weekdays(spot_days)
    accrual = DayCountTypes.THIRTY_E_360

    depo = IborDeposit(settleDt, "1D", 1.712 / 100.0, accrual)
    depos = [depo]

    futs = []
    fut = IborFuture(valuation_date, 1)
    futs.append(fut)
    fut = IborFuture(valuation_date, 2)
    futs.append(fut)
    fut = IborFuture(valuation_date, 3)
    futs.append(fut)
    fut = IborFuture(valuation_date, 4)
    futs.append(fut)
    fut = IborFuture(valuation_date, 5)
    futs.append(fut)
    fut = IborFuture(valuation_date, 6)
    futs.append(fut)

    fras = [None] * 6
    fras[0] = futs[0].to_fra(97.6675, -0.00005)
    fras[1] = futs[1].to_fra(97.5200, -0.00060)
    fras[2] = futs[2].to_fra(97.3550, -0.00146)
    fras[3] = futs[3].to_fra(97.2450, -0.00263)
    fras[4] = futs[4].to_fra(97.1450, -0.00411)
    fras[5] = futs[5].to_fra(97.0750, -0.00589)

    accrual = DayCountTypes.THIRTY_E_360
    freq = FrequencyTypes.SEMI_ANNUAL
    spot_days = 2
    settleDt = valuation_date.add_weekdays(spot_days)
    payRec = SwapTypes.PAY
    lag = 1  # Not used

    swaps = []
    swap = OIS(settleDt, "2Y", payRec, (2.77417 + 2.77844) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "3Y", payRec, (2.86098 + 2.86582) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "4Y", payRec, (2.90240 + 2.90620) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "5Y", payRec, (2.92944 + 2.92906) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "6Y", payRec, (2.94001 + 2.94499) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "7Y", payRec, (2.95352 + 2.95998) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "8Y", payRec, (2.96830 + 2.97400) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "9Y", payRec, (2.98403 + 2.98817) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "10Y", payRec, (2.99716 + 3.00394) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "11Y", payRec, (3.01344 + 3.01596) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "12Y", payRec, (3.02276 + 3.02684) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "15Y", payRec, (3.04092 + 3.04508) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "20Y", payRec, (3.04417 + 3.05183) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "25Y", payRec, (3.03219 + 3.03621) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "30Y", payRec, (3.01030 + 3.01370) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "40Y", payRec, (2.96946 + 2.97354) / 200, freq,
               accrual)
    swaps.append(swap)
    swap = OIS(settleDt, "50Y", payRec, (2.91552 + 2.93748) / 200, freq,
               accrual)
    swaps.append(swap)

    oisCurve = OISCurve(valuation_date, depos, fras, swaps)

    #    swaps[0]._fixed_leg.print_valuation()
    #    swaps[0]._floatLeg.print_valuation()

    # The valuation of 53714.55 is very close to the spreadsheet value 53713.96
    principal = 0.0

    testCases.header("VALUATION TO TODAY DATE", " PV")
    testCases.print("VALUE:", swaps[0].value(valuation_date, oisCurve, None))
    testCases.print("FIXED:",
                    -swaps[0]._fixed_leg.value(valuation_date, oisCurve))
    testCases.print("FLOAT:", swaps[0]._floatLeg.value(valuation_date,
                                                       oisCurve, None))

    testCases.header("VALUATION TO SWAP SETTLEMENT DATE", " PV")
    testCases.print("VALUE:", swaps[0].value(settleDt, oisCurve, None))
    testCases.print("FIXED:", -swaps[0]._fixed_leg.value(settleDt, oisCurve))
    testCases.print("FLOAT:", swaps[0]._floatLeg.value(settleDt, oisCurve,
                                                       None))
Beispiel #3
0
def test_bloombergPricingExample():
    """ This is an example of a replication of a BBG example from
    https://github.com/vilen22/curve-building/blob/master/Bloomberg%20Curve%20Building%20Replication.xlsx
    """
    valuation_date = Date(6, 6, 2018)

    # We do the O/N rate which settles on trade date
    spot_days = 0
    settlement_date = valuation_date.add_weekdays(spot_days)
    depoDCCType = DayCountTypes.ACT_360
    depos = []
    deposit_rate = 0.0231381
    maturity_date = settlement_date.add_months(3)
    depo = IborDeposit(settlement_date, maturity_date, deposit_rate,
                       depoDCCType)
    depos.append(depo)

    futs = []
    fut = IborFuture(valuation_date, 1)
    futs.append(fut)
    fut = IborFuture(valuation_date, 2)
    futs.append(fut)
    fut = IborFuture(valuation_date, 3)
    futs.append(fut)
    fut = IborFuture(valuation_date, 4)
    futs.append(fut)
    fut = IborFuture(valuation_date, 5)
    futs.append(fut)
    fut = IborFuture(valuation_date, 6)
    futs.append(fut)

    fras = [None] * 6
    fras[0] = futs[0].to_fra(97.6675, -0.00005)
    fras[1] = futs[1].to_fra(97.5200, -0.00060)
    fras[2] = futs[2].to_fra(97.3550, -0.00146)
    fras[3] = futs[3].to_fra(97.2450, -0.00263)
    fras[4] = futs[4].to_fra(97.1450, -0.00411)
    fras[5] = futs[5].to_fra(97.0750, -0.00589)

    accrual = DayCountTypes.THIRTY_E_360
    freq = FrequencyTypes.SEMI_ANNUAL

    spot_days = 2
    settlement_date = valuation_date.add_weekdays(spot_days)
    fixed_leg_type = SwapTypes.PAY
    interp_type = InterpTypes.FLAT_FWD_RATES

    swaps = []
    swap = IborSwap(settlement_date, "2Y", fixed_leg_type,
                    (2.77417 + 2.77844) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "3Y", fixed_leg_type,
                    (2.86098 + 2.86582) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "4Y", fixed_leg_type,
                    (2.90240 + 2.90620) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "5Y", fixed_leg_type,
                    (2.92944 + 2.92906) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "6Y", fixed_leg_type,
                    (2.94001 + 2.94499) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "7Y", fixed_leg_type,
                    (2.95352 + 2.95998) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "8Y", fixed_leg_type,
                    (2.96830 + 2.97400) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "9Y", fixed_leg_type,
                    (2.98403 + 2.98817) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "10Y", fixed_leg_type,
                    (2.99716 + 3.00394) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "11Y", fixed_leg_type,
                    (3.01344 + 3.01596) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "12Y", fixed_leg_type,
                    (3.02276 + 3.02684) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "15Y", fixed_leg_type,
                    (3.04092 + 3.04508) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "20Y", fixed_leg_type,
                    (3.04417 + 3.05183) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "25Y", fixed_leg_type,
                    (3.03219 + 3.03621) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "30Y", fixed_leg_type,
                    (3.01030 + 3.01370) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "40Y", fixed_leg_type,
                    (2.96946 + 2.97354) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "50Y", fixed_leg_type,
                    (2.91552 + 2.93748) / 200, freq, accrual)
    swaps.append(swap)

    libor_curve = IborSingleCurve(valuation_date, depos, fras, swaps,
                                  interp_type, True)

    assert round(
        swaps[0].value(valuation_date, libor_curve, libor_curve, None),
        4) == 0.0
    assert round(swaps[0]._fixed_leg.value(valuation_date, libor_curve),
                 4) == -53707.6667
    assert round(
        swaps[0]._float_leg.value(valuation_date, libor_curve, libor_curve,
                                  None), 4) == 53707.6667

    assert round(
        swaps[0].value(settlement_date, libor_curve, libor_curve, None),
        4) == 0.0
    assert round(swaps[0]._fixed_leg.value(settlement_date, libor_curve),
                 4) == -53714.5507
    assert round(
        swaps[0]._float_leg.value(settlement_date, libor_curve, libor_curve,
                                  None), 4) == 53714.5507

    oisCurve = buildOIS(valuation_date)

    liborDualCurve = IborDualCurve(valuation_date, oisCurve, depos, fras,
                                   swaps, InterpTypes.FLAT_FWD_RATES, True)

    assert round(
        swaps[0].value(valuation_date, oisCurve, liborDualCurve, None),
        4) == 0.0
    assert round(swaps[0]._fixed_leg.value(valuation_date, oisCurve),
                 4) == -55524.5642
    assert round(
        swaps[0]._float_leg.value(valuation_date, oisCurve, liborDualCurve,
                                  None), 4) == 55524.5642

    assert round(
        swaps[0].value(settlement_date, oisCurve, liborDualCurve, None),
        4) == 0.0
    assert round(swaps[0]._fixed_leg.value(settlement_date, oisCurve),
                 4) == -55524.5709
    assert round(
        swaps[0]._float_leg.value(settlement_date, oisCurve, liborDualCurve,
                                  None), 4) == 55524.5709
Beispiel #4
0
def test_FinIborFuture():

    todayDate = Date(5, 5, 2020)

    i = 1
    fut = IborFuture(todayDate, i, "3M")
    fra = fut.to_fra(0.020, 0.0)
    assert fut._delivery_date == Date(17, 6, 2020)
    assert fra._start_date == Date(17, 6, 2020)

    i = 4
    fut = IborFuture(todayDate, i, "3M")
    fra = fut.to_fra(0.020, 0.0)
    assert fut._delivery_date == Date(17, 3, 2021)
    assert fra._start_date == Date(17, 3, 2021)

    i = 7
    fut = IborFuture(todayDate, i, "3M")
    fra = fut.to_fra(0.020, 0.0)
    assert fut._delivery_date == Date(15, 12, 2021)
    assert fra._start_date == Date(15, 12, 2021)

    i = 10
    fut = IborFuture(todayDate, i, "3M")
    fra = fut.to_fra(0.020, 0.0)
    assert fut._delivery_date == Date(21, 9, 2022)
    assert fra._start_date == Date(21, 9, 2022)
def test_bloombergPricingExample(interp_type):
    """ This is an example of a replication of a BBG example from
    https://github.com/vilen22/curve-building/blob/master/Bloomberg%20Curve%20Building%20Replication.xlsx

    """
    valuation_date = Date(6, 6, 2018)

    # We do the O/N rate which settles on trade date
    spot_days = 0
    settlement_date = valuation_date.add_weekdays(spot_days)
    depoDCCType = DayCountTypes.ACT_360
    depos = []
    deposit_rate = 0.0231381
    maturity_date = settlement_date.add_months(3)
    depo = IborDeposit(settlement_date, maturity_date, deposit_rate,
                       depoDCCType)
    depos.append(depo)

    futs = []
    fut = IborFuture(valuation_date, 1)
    futs.append(fut)
    fut = IborFuture(valuation_date, 2)
    futs.append(fut)
    fut = IborFuture(valuation_date, 3)
    futs.append(fut)
    fut = IborFuture(valuation_date, 4)
    futs.append(fut)
    fut = IborFuture(valuation_date, 5)
    futs.append(fut)
    fut = IborFuture(valuation_date, 6)
    futs.append(fut)

    fras = [None] * 6
    fras[0] = futs[0].to_fra(97.6675, -0.00005)
    fras[1] = futs[1].to_fra(97.5200, -0.00060)
    fras[2] = futs[2].to_fra(97.3550, -0.00146)
    fras[3] = futs[3].to_fra(97.2450, -0.00263)
    fras[4] = futs[4].to_fra(97.1450, -0.00411)
    fras[5] = futs[5].to_fra(97.0750, -0.00589)

    accrual = DayCountTypes.THIRTY_E_360
    freq = FrequencyTypes.SEMI_ANNUAL

    spot_days = 2
    settlement_date = valuation_date.add_weekdays(spot_days)
    notional = ONE_MILLION
    fixed_leg_type = SwapTypes.PAY

    swaps = []
    swap = IborSwapOLD(settlement_date, "2Y", fixed_leg_type,
                       (2.77417 + 2.77844) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "3Y", fixed_leg_type,
                       (2.86098 + 2.86582) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "4Y", fixed_leg_type,
                       (2.90240 + 2.90620) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "5Y", fixed_leg_type,
                       (2.92944 + 2.92906) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "6Y", fixed_leg_type,
                       (2.94001 + 2.94499) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "7Y", fixed_leg_type,
                       (2.95352 + 2.95998) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "8Y", fixed_leg_type,
                       (2.96830 + 2.97400) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "9Y", fixed_leg_type,
                       (2.98403 + 2.98817) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "10Y", fixed_leg_type,
                       (2.99716 + 3.00394) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "11Y", fixed_leg_type,
                       (3.01344 + 3.01596) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "12Y", fixed_leg_type,
                       (3.02276 + 3.02684) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "15Y", fixed_leg_type,
                       (3.04092 + 3.04508) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "20Y", fixed_leg_type,
                       (3.04417 + 3.05183) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "25Y", fixed_leg_type,
                       (3.03219 + 3.03621) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "30Y", fixed_leg_type,
                       (3.01030 + 3.01370) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "40Y", fixed_leg_type,
                       (2.96946 + 2.97354) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwapOLD(settlement_date, "50Y", fixed_leg_type,
                       (2.91552 + 2.93748) / 200, freq, accrual)
    swaps.append(swap)

    libor_curve = FinIborSingleCurveOLD(valuation_date, depos, fras, swaps,
                                        interp_type)

    # The valuation of 53714.55 is very close to the spreadsheet value 53713.96
    principal = 0.0

    testCases.header("VALUATION TO TODAY DATE", " PV")
    testCases.print(
        "VALUE:", swaps[0].value(valuation_date, libor_curve, libor_curve,
                                 None))
    testCases.print("FIXED:", swaps[0].fixed_leg_value(valuation_date,
                                                       libor_curve))
    testCases.print(
        "FLOAT:", swaps[0].float_leg_value(valuation_date, libor_curve,
                                           libor_curve, None))

    testCases.header("VALUATION TO SWAP SETTLEMENT DATE", " PV")
    testCases.print(
        "VALUE:", swaps[0].value(settlement_date, libor_curve, libor_curve,
                                 None))
    testCases.print("FIXED:", swaps[0].fixed_leg_value(settlement_date,
                                                       libor_curve))
    testCases.print(
        "FLOAT:", swaps[0].float_leg_value(settlement_date, libor_curve,
                                           libor_curve, None))

    # swaps[0].print_fixed_leg_pv()
    # swaps[0].print_float_leg_pv()

    if 1 == 0:
        plt.figure()

        years = np.linspace(0, 50, 500)
        dates = settlement_date.add_years(years)
        fwds = libor_curve.fwd(dates)
        plt.plot(years, fwds, label="Fwd Rate")
        plt.title(interp_type)
        plt.xlabel("Years")
        plt.legend()

        years = np.linspace(0, 50, 500)
        dates = settlement_date.add_years(years)
        fwds = libor_curve.zero_rate(dates)
        plt.plot(years, fwds, label="Zero Rate")
        plt.title(interp_type)
        plt.xlabel("Years")
        plt.ylabel("Rate")
        plt.legend()
def test_bloombergPricingExample():
    """ This is an example of a replication of a BBG example from
    https://github.com/vilen22/curve-building/blob/master/Bloomberg%20Curve%20Building%20Replication.xlsx

    """
    valuation_date = Date(6, 6, 2018)

    # We do the O/N rate which settles on trade date
    spot_days = 0
    settlement_date = valuation_date.add_weekdays(spot_days)
    depoDCCType = DayCountTypes.ACT_360
    depos = []
    deposit_rate = 0.0231381
    maturity_date = settlement_date.add_months(3)
    depo = IborDeposit(settlement_date, maturity_date, deposit_rate,
                       depoDCCType)
    depos.append(depo)

    futs = []
    fut = IborFuture(valuation_date, 1)
    futs.append(fut)
    fut = IborFuture(valuation_date, 2)
    futs.append(fut)
    fut = IborFuture(valuation_date, 3)
    futs.append(fut)
    fut = IborFuture(valuation_date, 4)
    futs.append(fut)
    fut = IborFuture(valuation_date, 5)
    futs.append(fut)
    fut = IborFuture(valuation_date, 6)
    futs.append(fut)

    fras = [None] * 6
    fras[0] = futs[0].to_fra(97.6675, -0.00005)
    fras[1] = futs[1].to_fra(97.5200, -0.00060)
    fras[2] = futs[2].to_fra(97.3550, -0.00146)
    fras[3] = futs[3].to_fra(97.2450, -0.00263)
    fras[4] = futs[4].to_fra(97.1450, -0.00411)
    fras[5] = futs[5].to_fra(97.0750, -0.00589)

    accrual = DayCountTypes.THIRTY_E_360
    freq = FrequencyTypes.SEMI_ANNUAL

    spot_days = 2
    settlement_date = valuation_date.add_weekdays(spot_days)
    fixed_leg_type = SwapTypes.PAY
    interp_type = InterpTypes.FLAT_FWD_RATES

    swaps = []
    swap = IborSwap(settlement_date, "2Y", fixed_leg_type,
                    (2.77417 + 2.77844) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "3Y", fixed_leg_type,
                    (2.86098 + 2.86582) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "4Y", fixed_leg_type,
                    (2.90240 + 2.90620) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "5Y", fixed_leg_type,
                    (2.92944 + 2.92906) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "6Y", fixed_leg_type,
                    (2.94001 + 2.94499) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "7Y", fixed_leg_type,
                    (2.95352 + 2.95998) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "8Y", fixed_leg_type,
                    (2.96830 + 2.97400) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "9Y", fixed_leg_type,
                    (2.98403 + 2.98817) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "10Y", fixed_leg_type,
                    (2.99716 + 3.00394) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "11Y", fixed_leg_type,
                    (3.01344 + 3.01596) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "12Y", fixed_leg_type,
                    (3.02276 + 3.02684) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "15Y", fixed_leg_type,
                    (3.04092 + 3.04508) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "20Y", fixed_leg_type,
                    (3.04417 + 3.05183) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "25Y", fixed_leg_type,
                    (3.03219 + 3.03621) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "30Y", fixed_leg_type,
                    (3.01030 + 3.01370) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "40Y", fixed_leg_type,
                    (2.96946 + 2.97354) / 200, freq, accrual)
    swaps.append(swap)
    swap = IborSwap(settlement_date, "50Y", fixed_leg_type,
                    (2.91552 + 2.93748) / 200, freq, accrual)
    swaps.append(swap)

    libor_curve = IborSingleCurve(valuation_date, depos, fras, swaps,
                                  interp_type, True)

    testCases.banner("======================================================")
    testCases.banner("SINGLE CURVE VALUATION")
    testCases.header("LABEL", "VALUE")
    testCases.print(
        "VALUE:", swaps[0].value(valuation_date, libor_curve, libor_curve,
                                 None))
    testCases.print("FIXED:",
                    swaps[0]._fixed_leg.value(valuation_date, libor_curve))
    testCases.print(
        "FLOAT:", swaps[0]._floatLeg.value(valuation_date, libor_curve,
                                           libor_curve, None))

    testCases.banner("======================================================")
    testCases.banner("SINGLE CURVE VALUATION TO SWAP SETTLEMENT DATE")
    testCases.header("LABEL", "VALUE")
    testCases.print(
        "VALUE:", swaps[0].value(settlement_date, libor_curve, libor_curve,
                                 None))
    testCases.print("FIXED:",
                    swaps[0]._fixed_leg.value(settlement_date, libor_curve))
    testCases.print(
        "FLOAT:", swaps[0]._floatLeg.value(settlement_date, libor_curve,
                                           libor_curve, None))
    testCases.banner("======================================================")

    #    swaps[0].print_fixed_leg_pv()
    #    swaps[0].print_float_leg_pv()

    oisCurve = buildOIS(valuation_date)
    #    print(oisCurve)

    liborDualCurve = IborDualCurve(valuation_date, oisCurve, depos, fras,
                                   swaps, InterpTypes.FLAT_FWD_RATES, True)
    #    print(liborDualCurve)

    # The valuation of 53714.55 is very close to the spreadsheet value 53713.96

    testCases.header("VALUATION TO TODAY DATE", " PV")
    testCases.print(
        "VALUE:", swaps[0].value(valuation_date, oisCurve, liborDualCurve,
                                 None))
    testCases.print("FIXED:",
                    swaps[0]._fixed_leg.value(valuation_date, oisCurve))
    testCases.print(
        "FLOAT:", swaps[0]._floatLeg.value(valuation_date, oisCurve,
                                           libor_curve, None))

    testCases.header("VALUATION TO SWAP SETTLEMENT DATE", " PV")
    testCases.print(
        "VALUE:", swaps[0].value(settlement_date, oisCurve, liborDualCurve,
                                 None))
    testCases.print("FIXED:",
                    swaps[0]._fixed_leg.value(settlement_date, oisCurve))
    testCases.print(
        "FLOAT:", swaps[0]._floatLeg.value(
            settlement_date,
            oisCurve,
            liborDualCurve,
            None,
        ))

    #    swaps[0].print_fixed_leg_pv()
    #    swaps[0].print_float_leg_pv()

    PLOT = False
    if PLOT is True:

        years = np.linspace(0, 5, 21)
        dates = settlement_date.add_years(years)

        singleCurveFwds = libor_curve.fwd(dates)
        plt.plot(years, singleCurveFwds, label="Single Libor Curve")

        oisCurveFwds = oisCurve.fwd(dates)
        plt.plot(years, oisCurveFwds, label="OIS Curve")

        index_curveFwds = liborDualCurve.fwd(dates)
        plt.plot(years, index_curveFwds, label="Libor Index Curve")

        plt.legend()