示例#1
0
    def swap_index_name(self, curve):
        """
        swap_index takes a Curve-class object and returns the appropriate
        index. Because QuantLib has a separate index object for each
        currency (for reasons that are not entirely clear to me), this
        function is necessary for creating swapRateHelpers. The function
        takes the curve object, then uses the currency and
        floating_leg_tenor attributes to determine the index.

        Currently, the function can handle the following currencies:
        AUD, CAD, CHF, DKK, EUR, GBP, JPY, NZD, SEK, TRL, USD

        Args:
            curve (Curve): curve-class object

        Returns
            object: QuantLib index, defined for a specified period
        """
        if curve.currency == 'AUD':
            return qlib.AUDLibor(self.floating_leg_tenor)
        elif curve.currency == 'CAD':
            return qlib.CADLibor(self.floating_leg_tenor)
        elif curve.currency == 'CHF':
            return qlib.CHFLibor(self.floating_leg_tenor)
        elif curve.currency == 'DKK':
            return qlib.DKKLibor(self.floating_leg_tenor)
        elif curve.currency == 'EUR':
            return qlib.Euribor(self.floating_leg_tenor)
        elif curve.currency == 'GBP':
            return qlib.GBPLibor(self.floating_leg_tenor)
        elif curve.currency == 'JPY':
            return qlib.JPYLibor(self.floating_leg_tenor)
        elif curve.currency == 'NZD':
            return qlib.NZDLibor(self.floating_leg_tenor)
        elif curve.currency == 'SEK':
            return qlib.SEKLibor(self.floating_leg_tenor)
        elif curve.currency == 'TRL':
            return qlib.TRLibor(self.floating_leg_tenor)
        elif curve.currency == 'USD':
            return qlib.USDLibor(self.floating_leg_tenor)
示例#2
0
        def swap_index(curve):
            """
            swap_index takes a Curve-class object and returns the appropriate
            index. Because QuantLib has a separate index object for each
            currency (for reasons that are not entirely clear to me), this
            function is necessary for creating swapRateHelpers. The function
            takes the curve object, then uses the currency and
            floating_leg_tenor attributes to determine the index.

            Currently, the function can handle the following currencies:
            AUD, CAD, CHF, DKK, EUR, GBP, JPY, NZD, SEK, TRL, USD

            Args:
                curve (Curve): curve-class object

            Returns
                object: QuantLib index, defined for a specified period
            """
            if curve.currency == "AUD":
                return qlib.AUDLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "CAD":
                return qlib.CADLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "CHF":
                return qlib.CHFLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "DKK":
                return qlib.DKKLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "EUR":
                return qlib.Euribor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "GBP":
                return qlib.GBPLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "JPY":
                return qlib.JPYLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "NZD":
                return qlib.NZDLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "SEK":
                return qlib.SEKLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "TRL":
                return qlib.TRLibor(curve.swaps.floating_leg_tenor)
            elif curve.currency == "USD":
                return qlib.USDLibor(curve.swaps.floating_leg_tenor)
示例#3
0
 def _create(self, asof_date):
     yield_curve = self[F.YIELD_CURVE]
     tenor = self[F.TENOR]
     yield_handle = ql.YieldTermStructureHandle(yield_curve)
     return ql.AUDLibor(tenor, yield_handle)