和顺 / 共识 返回所属 Agent
GS-07.03

独立复算准备

原能力

冻结输入、参数、时间与货币口径,列出供独立复算的差异和未决项。(细化版 p.14–15)

首选项目

DVC(Apache-2.0)。 DVC

匹配范围

锁定输入并提供独立数值对照候选。

源码

DVC · def to_lockfile(

dvc/stage/serialize.py · 195–208 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
def to_lockfile(stage: "PipelineStage", **kwargs) -> dict:
    assert stage.name
    return {stage.name: to_single_stage_lockfile(stage, **kwargs)}


def to_single_stage_file(stage: "Stage", **kwargs):
    state = stage.dumpd(**kwargs)

    # When we load a stage we parse yaml with a fast parser, which strips
    # off all the comments and formatting. To retain those on update we do
    # a trick here:
    # - reparse the same yaml text with a slow but smart ruamel yaml parser
    # - apply changes to a returned structure
    # - serialize it

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

实现与验收要点

防用同一实现作基准,固定币种、时点与容差。