예제 #1
0
def py_VanillaSwapFairRate(swapIds,
                           forwardCurveIds,
                           discountCurveIds,
                           forecastTodaysFixing=False):
    errVec = pk.Str_Vec()
    result = pk.Param_VecVec()
    coefficients = pk.Double_Vec()
    leafInstrumentArgsBase_Vec = pk.YCLeafInstrumentArgsBase_Vec()
    curveMap = pk.Str_VecVec()
    curveSuffix = pk.PkMissingString
    rateOrSpread = pk.Str_Vec()
    #Str_Vec objIds, Str_Vec forwardCurveIds, Str_Vec discountCurveIds, Double_Vec coefficients, YCLeafInstrumentArgsBase_Vec leafInstrumentArgsBase, PkCommon::PkBool const & forecastTodaysFixing, Str_VecVec curveMapIn, Param_VecVec result, Str_Vec errVec, std::string const & curveSuffix, Str_Vec rateOrSpread
    rc = pk.pk_VanillaSwapFairRate(peakHelper.listToPkVec(swapIds),
                                   peakHelper.listToPkVec(forwardCurveIds),
                                   peakHelper.listToPkVec(discountCurveIds),
                                   coefficients, leafInstrumentArgsBase_Vec,
                                   forecastTodaysFixing, curveMap, result,
                                   errVec, curveSuffix, rateOrSpread)
    #rc =pk.pk_VanillaSwapFairRate(peakHelper.listToPkVec(swapIds), peakHelper.listToPkVec(forwardCurveIds), peakHelper.listToPkVec(discountCurveIds), coefficients, leafInstrumentArgsBase, forecastTodaysFixing, curveMap, result, errVec)
    peakHelper.checkPeakErr(errVec)
    return peakHelper.unpackVecVecResult(result)
예제 #2
0
def py_BuildSwapCurve(curveName,
                      anchorDate,
                      indexName,
                      tenors,
                      rates,
                      extFwdCurve,
                      extDiscCurve='',
                      startTenors=[],
                      useExtCurveAsBase=False,
                      template=''):
    '''returns forwardCurveId, discountCurveId, curveEngineId
    '''
    result = pk.Param_VecVec()
    errVec = pk.Str_Vec()
    rc = pk.pk_BuildSwapCurve(curveName, peakHelper.dateToPkDate(anchorDate),
                              indexName, peakHelper.listToPkVec(startTenors),
                              peakHelper.listToPkVec(tenors),
                              peakHelper.listToPkVec(rates, pk.Double_Vec),
                              extFwdCurve, extDiscCurve, result, errVec,
                              useExtCurveAsBase, template)
    peakHelper.checkPeakErr(errVec)
    names = tuple(rc)
    return names, peakHelper.unpackVecVecResult(result)
예제 #3
0
def py_SwapInfo(objId, legNumber, asOfDate, resultFormat=''):
    resultMap = pk.Matrix_Map()
    errVec = pk.Str_Vec()
    rc = pk.pk_SwapInfo(peakHelper.listToPkVec(objId), legNumber,
                        peakHelper.dateToPkDate(asOfDate), resultFormat,
                        resultMap, errVec)
    peakHelper.checkPeakErr(errVec)
    result = peakHelper.unpackMatrix_Map(resultMap)
    for k, v in result.iteritems():
        if len(v[0]) == 2:
            if v[0][0] == 'Key':
                result[k] = dict(v[1:])
        elif len(v) == 2:
            result[k] = dict(zip(v[0], v[1]))
    return result
예제 #4
0
def py_SwapLegNPV(swapIds,
                  forwardCurveId,
                  discountCurveId,
                  cfAfterDate=None,
                  legNumber=pk.PkMissingInt,
                  cfAfterDateInclusive=False,
                  forecastTodaysFixing=False,
                  debugLevel=0):
    errVec = pk.Str_Vec()
    result = pk.Param_VecVec()
    cfAfterDate = peakHelper.dateToPkDate(
        cfAfterDate) if cfAfterDate else pk.PkMissingDate
    rc = pk.pk_SwapLegNPV(peakHelper.listToPkVec(swapIds), legNumber,
                          forwardCurveId, discountCurveId, cfAfterDate,
                          cfAfterDateInclusive, forecastTodaysFixing,
                          debugLevel, result, errVec)
    peakHelper.checkPeakErr(errVec)
    return peakHelper.unpackVecVecResult(result)
예제 #5
0
def py_SwapLegAnalysis(swapId,
                       legNumber,
                       afterDate,
                       forwardCurveId,
                       discountCurveId,
                       afterDateInclusive=True,
                       forecastTodaysFixing=True,
                       useSqlFriendlyColHeaders=True,
                       selectedColumns='All',
                       toDate=None):
    errVec = pk.Str_Vec()
    result = pk.Param_VecVec()
    if isinstance(selectedColumns, str):
        selectedColumns = [selectedColumns]
    selectedColumns = peakHelper.listToPkVec(selectedColumns)
    rc = pk.pk_SwapLegAnalysis(swapId, legNumber,
                               peakHelper.dateToPkDate(afterDate),
                               forwardCurveId, discountCurveId,
                               afterDateInclusive, forecastTodaysFixing,
                               useSqlFriendlyColHeaders, selectedColumns,
                               peakHelper.dateToPkDate(toDate), result, errVec)
    peakHelper.checkPeakErr(errVec)
    return peakHelper.unpackVecVecResult(result)
예제 #6
0
def py_IndexAddFixings(indexId, fixingDates, fixingValues):
    errVec = pk.Str_Vec()
    rc = pk.pk_IndexAddFixings(indexId, peakHelper.listToPkVec(fixingDates),
                               peakHelper.listToPkVec(fixingValues), errVec)
    peakHelper.checkPeakErr(errVec)
    return rc