def py_SwapLegNPV(swapId, forwardCurveId, discountCurveId, cfAfterDate=None, legNumber=PkMissingInt, cfAfterDateInclusive=False, forecastTodaysFixing=False, debugLevel=0): errVec = Str_Vec() result = Param_VecVec() cfAfterDate = dateToPkDate(cfAfterDate) if cfAfterDate else PkMissingDate rc = pk_SwapLegNPV(_listToPkVec(swapId), legNumber, forwardCurveId, discountCurveId, cfAfterDate, cfAfterDateInclusive, forecastTodaysFixing, debugLevel, result, errVec) _checkAndRaiseErr(errVec) return _unpackVecVecResult(result)
def py_BuildCurvePack(curvePackName, curveEngineName, baseTargets=[], baseInstrumentNames=[], scenarioInstrumentNames=[], scenarioNames=[], scenarioTargets=[], scenariosAreRelative=False, deltaBumpSize=1.e-4, centralDifference=False, gammaMode='', targetChangeTolerance=0.0, mispriceTolerance=1.e-6, impliedFromTargetTolerance=0.0): errVec = Str_Vec() result = Param_VecVec() rc = pk_BuildCurvePack(curvePackName, curveEngineName, _listToPkVec(baseTargets, Double_Vec), _listToPkVec(baseInstrumentNames), _listToPkVec(scenarioInstrumentNames), _listToPkVec(scenarioNames), _matrixToDoubleVecVec(scenarioTargets), scenariosAreRelative, deltaBumpSize, centralDifference, gammaMode, targetChangeTolerance, mispriceTolerance, impliedFromTargetTolerance, result, errVec) _checkAndRaiseErr(errVec) return _unpackVecVecResult(result)
def py_SwapLegAnalysis(swapId, legNumber, afterDate, forwardCurveId, discountCurveId, afterDateInclusive=True, forecastTodaysFixing=True, useSqlFriendlyColHeaders=True, selectedColumns='All', toDate=None): errVec = Str_Vec() result = Param_VecVec() if isinstance(selectedColumns, str): selectedColumns = [selectedColumns] selectedColumns = _listToPkVec(selectedColumns) rc = pk_SwapLegAnalysis(swapId, legNumber, dateToPkDate(afterDate), forwardCurveId, discountCurveId, afterDateInclusive, forecastTodaysFixing, useSqlFriendlyColHeaders, selectedColumns, dateToPkDate(toDate), result, errVec) _checkAndRaiseErr(errVec) return _unpackVecVecResult(result)
def py_BuildSwapCurve(curveName, anchorDate, indexName, tenors, rates, extFwdCurve, extDiscCurve='', startTenors=[], useExtCurveAsBase=True, template=''): '''returns forwardCurveId, discountCurveId, curveEngineId ''' result = Param_VecVec() errVec = Str_Vec() rc = pk_BuildSwapCurve(curveName, dateToPkDate(anchorDate), indexName, _listToPkVec(startTenors), _listToPkVec(tenors), _listToPkVec(rates, Double_Vec), extFwdCurve, extDiscCurve, result, errVec, useExtCurveAsBase, template) _checkAndRaiseErr(errVec) names = tuple(rc) return names, _unpackVecVecResult(result)
def py_CreateIRSwap(swapId, conventions, asofDate, **att): errVec = Str_Vec() result = Param_VecVec() # att = {} # for k in ('startDate', 'fwdStartTenor', 'endDate', 'endDateTenor', 'notional', 'fixedRate', # 'floatSpread', 'discCurveId', 'fwdCurveId', 'firstStubDate', 'lastStubDate', 'addFixingDelayToStartDate'): # att[k] = attributes.get(k, None) conventions = dictToKeyValueVec(conventions) rc = pk_CreateIRSwap(swapId, conventions, dateToPkDate(asofDate), dateToPkDate(att.get('endDate', None)), att.get('endDateTenor', ''), att.get('notional'), att.get('fixedRate'), att.get('floatSpread', 0.0), att.get('discCurveId', ''), att.get('fwdCurveId', ''), dateToPkDate(att.get('firstStubDate', None)), dateToPkDate(att.get('lastStubDate', None)), att.get('addFixingDelayToStartDate', True), result, errVec, att.get('fwdStartTenor', ''), att.get('resetFrequency', '')) _checkAndRaiseErr(errVec) return _unpackVecVecResult(result)
def py_BondFlowAnalysis(bondId, afterDate): errVec = Str_Vec() result = Param_VecVec() rc = pk_BondFlowAnalysis(bondId, dateToPkDate(afterDate), result, errVec) _checkAndRaiseErr(errVec) return _unpackVecVecResult(result)
def py_BuildRPCurvePack(curvePackName, curveNames, bucketDates, deltaBumpSize=0.0001, centralDifference=False, gammaMode=''): errVec = Str_Vec() result = Param_VecVec() rc = pk_BuildRPCurvePack(curvePackName, _listToPkVec(curveNames), _listToPkVec(bucketDates), deltaBumpSize, centralDifference, gammaMode, result, errVec) _checkAndRaiseErr(errVec) return _unpackVecVecResult(result)[0][0]
def py_CurvePackRisk(curvePackName, instrumentNames, curveMap, discountCurveName, centralDifference=False, gammaMode='', riskMode='All', outputFormat='bt', forecastTodaysFixing=False, showBasePv=False): errVec = Str_Vec() result = Param_VecVec() rc = pk_CurvePackRisk(curvePackName, _listToPkVec(instrumentNames), _matrixToStrVecVec(curveMap), discountCurveName, centralDifference, gammaMode, riskMode, outputFormat, forecastTodaysFixing, showBasePv, result, errVec) _checkAndRaiseErr(errVec) return _unpackVecVecResult(result)