HKUDS/Vibe-Trading · error · ValueError

paid-in capital is {paid_in!r}; a capital multiple is undefi

Error message

paid-in capital is {paid_in!r}; a capital multiple is undefined with no capital drawn. Confirm the contribution kinds match the file.

What it means

Capital multiples (DPI, RVPI, TVPI, MOIC) divide by paid-in capital, which is undefined when nothing has been drawn. The guard rejects paid_in <= 0 instead of returning inf or 0, either of which would corrupt downstream analytics.

Source

Thrown at agent/src/quantlib/fundmath.py:710

        )
    return value


def _require_paid_in(paid_in: float) -> float:
    """Reject a zero or negative denominator for a capital multiple.

    Args:
        paid_in: Paid-in capital as a positive magnitude.

    Returns:
        The same value.

    Raises:
        ValueError: If it is not strictly positive -- a multiple of nothing is
            undefined, and returning ``inf`` or ``0`` would both be wrong.
    """
    if paid_in <= 0.0:
        raise ValueError(
            f"paid-in capital is {paid_in!r}; a capital multiple is undefined "
            "with no capital drawn. Confirm the contribution kinds match the file."
        )
    return paid_in


def dpi(
    series: CashFlowSeries,
    *,
    contribution_kinds: Iterable[str] = CONTRIBUTION_KINDS,
    distribution_kinds: Iterable[str] = DISTRIBUTION_KINDS,
) -> float:
    """Distributions to paid-in: realised cash returned per unit drawn.

    Args:
        series: The cash flows.
        contribution_kinds: Kind labels counted as capital in.
        distribution_kinds: Kind labels counted as capital out.

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Inspect series.filter(kind=contribution_kinds) — verify your contribution kind strings match what the file actually uses
  2. Pass the correct contribution_kinds argument matching your data's labels
  3. If the fund genuinely has no draws yet, skip the multiple rather than calling it

Example fix

# before
paid_in = sum(-f.amount for f in series.filter(kind=("contribution",)))
dpi(series, paid_in)  # raises if labels differ

# after
CONTRIB_KINDS = ("contribution", "capital_call", "drawdown")
paid_in = sum(-f.amount for f in series.filter(kind=CONTRIB_KINDS))
if paid_in > 0:
    print(dpi(series, paid_in))
Defensive patterns

Strategy: validation

Validate before calling

paid_in = sum(-f.amount for f in series.filter(kind=CONTRIB_KINDS))
if paid_in <= 0:
    return None  # no multiples for undrawn funds

Try / catch

try:
    dpi(series, paid_in)
except ValueError as e:
    if "paid-in capital" in str(e):
        logging.warning("skipping multiple: no capital drawn")
    else:
        raise

Prevention

When it happens

Trigger: Calling dpi/rvpi/tvpi/moic/fund_multiples with paid_in=0.0 or a negative sum, typically because the series contains no flows whose kind matches the configured contribution kinds.

Common situations: A feed or CSV where contributions are labeled 'drawdown' or 'capital_call' but the code expects 'contribution'; a brand-new fund with no draws yet; filtered series that accidentally excluded contributions.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/b1c0fd4886df2161. Report an issue: GitHub.