Skip to main content

Provider-currency size vector, derived remaining, no pending bucket (prod-data-driven)

A read-only check of prod (125 open non-terminal orders, 2026-07-09) settled the size-vector sourcing and corrected two assumptions in ADR-0003/0006:

FieldNulls / 125
userStakeProviderCurrency (provider ccy)0
matchedStakeProviderCurrency (provider ccy)0
matchedStake / stake (user ccy)0
size_matched (provider ccy)2
size_remaining (provider ccy)125 (never populated)

Decisions (supersede the relevant parts of ADR-0003 / ADR-0006)

  • The SizeVector is provider-account currency. Status is proportional, so currency only has to be internally consistent; provider ccy is the native denomination of the disposition fields. Sourced: requested = userStakeProviderCurrency, matched = matchedStakeProviderCurrency (NOT size_matched — gappy, would misclassify a matched order as unmatched), lapsed/cancelled/voided = size_*.
  • remaining (working) is DERIVED = requested − matched − lapsed − cancelled − voided. The provider size_remaining column is never written, so there is no independent "reported remaining".
  • The pending remainder bucket is dropped — it collapses into working. With matched reliably populated, there is no "unreported matched" gap; a non-negative deficit is simply still-working stake.
  • Reconciliation invariant: matched + lapsed + cancelled + voided ≤ requested (+dust). Over-sum → throw FINANCIAL_INTEGRITY. working = max(0, requested − accounted).
  • No user-currency vector. The status is currency-agnostic; the frontend renders displayed amounts in the user's own currency from the order's existing user-ccy fields — a separate concern.

Why this is safe to build clean (no legacy handling)

Prod has no open/pending backlog to protect (orders settle through); the provider-ccy fields are already 100% populated on placed orders, and adapters populate them going forward. orderToSizeVector therefore throws on a placed order missing userStakeProviderCurrency rather than defaulting — a data-integrity fault is surfaced, never masked (financial-security §1).