和顺 / 衡律 返回所属 Agent
11.2

现金流日程与折现基础

原能力

实现日期现金流、日计数、折现及币种口径,并保留合同和市场规则来源。(合同附件 R7 11.2)

首选项目

QuantLib(Modified BSD,上游许可正文)。 QuantLib

匹配范围

Schedule、DayCounter、CashFlows 与 DiscountFactors。

源码

QuantLib · class Schedule

ql/time/schedule.hpp · 40–53 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    class Schedule {
      public:
        /*! constructor that takes any list of dates, and optionally
            meta information that can be used by client classes. Note
            that neither the list of dates nor the meta information is
            checked for plausibility in any sense. */
        Schedule(
            const std::vector<Date>&,
            Calendar calendar = NullCalendar(),
            BusinessDayConvention convention = Unadjusted,
            const std::optional<BusinessDayConvention>& terminationDateConvention = std::nullopt,
            const std::optional<Period>& tenor = std::nullopt,
            const std::optional<DateGeneration::Rule>& rule = std::nullopt,
            const std::optional<bool>& endOfMonth = std::nullopt,
  • Copyright (C) 2006, 2007, 2011 Ferdinando Ametrano
  • Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
  • Copyright (C) 2003, 2004, 2005, 2006, 2009 StatPro Italia srl

QuantLib · CashFlows::npv(

ql/cashflows/cashflows.cpp · 420–433 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    Real CashFlows::npv(const Leg& leg,
                        const YieldTermStructure& discountCurve,
                        const std::optional<bool>& includeSettlementDateFlows,
                        Date settlementDate,
                        Date npvDate) {

        if (leg.empty())
            return 0.0;

        if (settlementDate == Date())
            settlementDate = Settings::instance().evaluationDate();

        if (npvDate == Date())
            npvDate = settlementDate;
  • Copyright (C) 2005, 2006 StatPro Italia srl
  • Copyright (C) 2005 Charles Whitmore
  • Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Ferdinando Ametrano
  • Copyright (C) 2008 Toyin Akin

实现与验收要点

逐模块核验日历、结算、单位、计息及舍入。