日期差异量化库

Date Difference QuantLib

我想使用 360 天计算日期之间的天数差异。代码如下但不起作用

import QuantLib as ql
import pandas as pd
issueDate = ql.Date(15, 3, 2020)
maturityDate = ql.Date(15, 1, 2025)
tenor = ql.Period(ql.Semiannual)
calendar = ql.UnitedStates()
businessConvention = ql.Unadjusted
dateGeneration = ql.DateGeneration.Backward
monthEnd = False

schedule = ql.Schedule (issueDate, maturityDate, tenor, calendar, businessConvention,
                            businessConvention, dateGeneration, monthEnd)
dateList  =  list(schedule)
def calculateInterOrderTime(dateList):
   result = map(lambda x: [i / np.timedelta64(1, 'D') for i in np.diff([c for c in x])[0]],dateList)
   print(list(result))

我想达到如下效果

[120,180,180,180,180,180,180,180,180,180,180]

如果有人能帮助我实现结果,我将不胜感激。提前致谢。

例如:

dates = [*schedule]
[int(ql.Thirty360().yearFraction(start, end)*360) for start, end in zip(dates[:-1], dates[1:])]

[120, 180, 180, 180, 180, 180, 180, 180, 180, 180]