def debentureTransferWhenNoRepay(Ar,b,dealDate,lastPayday,productType):
    D=min(dateDeltaCalc(lastPayday,dealDate),30)
    if productType=="本息保障":
        x=1
    elif productType =="本金保障":
        x=0
    F=Ar+D/30*Ar*b*x
    return F
def debentureTransferWhenAllPayed(Ar,b,dealDate,lastPayday,productType,n):
    D=min(dateDeltaCalc(dealDate,lastPayday),30)
    Ar_new=Ar/(1+b)**n
    F=Ar-Ar*D/30*b
    return F
def debentureTransferWhenOnePayed(Ar,b,dealDate,lastPayday):
    D=min(dateDeltaCalc(dealDate,lastPayday),30)
    F=Ar-D/30*Ar*b
    return F