Building a Yield Estimate You Can Actually Audit

A pool’s displayed APR is a summary. It doesn’t tell a depositor everything they might earn. To estimate yield in code, first define what you’re measuring. Keep the inputs traceable and show the time window. This walkthrough covers a simple calculation and the checks that make it easier to test and explain.

Define the thing you are measuring

“Yield” can mean different things. Pool-level fee activity isn’t the same as the return on a particular position. Incentive tokens may add value, and changes in the prices of deposited assets can affect a position’s value too. A headline number is hard to interpret without a clear scope.

Choose what you’re measuring: a pool, a strategy, or a defined position. Then choose a unit of account and an observation interval. Record whether the calculation includes fees, incentives, asset-price changes, deposits, withdrawals, and transaction costs. These definitions are part of the metric, not just documentation around it.

It helps to keep two measures separate:

  • Pool-level activity: observations that may help explain fee generation or incentives.
  • Position-level return: the change in value of a defined deposit over a stated interval, using a stated accounting method.

Neither label is enough on its own. A position-level result still needs a valuation method. Pool activity, by itself, doesn’t describe an individual depositor’s outcome. Keeping these concepts apart prevents a pool statistic from being presented as a realized position return.

Make the annualization step explicit

For one observation interval, calculate a simple annualized rate from the period return and elapsed time:

annualized_simple_return = period_return × year_duration / elapsed_duration 

Give the inputs explicit units. If both durations are in seconds, their ratio is unitless. The result scales the observed period return linearly; it doesn’t predict that the same rate will continue.

Here’s a small Python helper for that transformation. It expects the period return to have already been calculated using a documented method.

def annualize_simple_return( period_return: float, elapsed_seconds: float, year_seconds: float, ) -> float: if elapsed_seconds <= 0: raise ValueError("elapsed_seconds must be positive") if year_seconds <= 0: raise ValueError("year_seconds must be positive") return period_return * year_seconds / elapsed_seconds 

The helper doesn’t calculate the period return. That depends on what’s being valued and how cash flows are handled. Keeping the steps separate makes it easier to see whether an unexpected result came from the accounting or the annualization.

Keep the unannualized return and elapsed duration alongside the annualized result. Someone using an API or dashboard should be able to see the observed period, not just a rate that looks comparable across different windows. Set a policy for data that’s too sparse, stale, or incomplete to support an estimate. Return a clear status instead of a precise-looking number.

Keep observations separate from estimates

A yield pipeline is easier to debug when it keeps source observations apart from derived metrics. Store observations as received, then calculate estimates in a separate step. If the valuation method changes, you can recompute the estimate without rewriting the original observations.

For each observation, retain fields that show where it came from and what it means: the pool or position identifier, timestamp, valuation unit, values used, and the method or version that produced the estimate. If you track fees and incentives separately, say whether they’re already included in the position’s end value. Otherwise, the calculation may count the same value twice.

A minimal conceptual record might look like this:

observation = { "subject_id": subject_id, "observed_at": timestamp, "unit": valuation_unit, "value": marked_value, "method_version": method_version, } 

The names here are illustrative. What matters is that the estimate can be reproduced from its inputs and method. Store missing or stale data as an explicit condition, not a plausible-looking substitute. That way, downstream users and monitoring systems can see the gap.

Treat fees, incentives, and trading conditions as distinct inputs

Trading activity can help explain fee generation, but turnover alone doesn’t establish the return a position receives. Fee rules, position exposure, asset-price changes, and entry or exit costs all matter. Treat activity as a signal to investigate, not as a conclusion about yield.

A quoted fee rate and fees actually accrued during an observation interval are different measurements. Identify which one the calculation uses. Also account for the possibility that the price available for a hypothetical entry or exit differs from a displayed reference price because of market depth or price impact.

When ranking pools, don’t collapse these inputs into an opaque score too early. Keep component values such as observed fees, incentive valuation, costs, and elapsed time. If a combined score is useful, document its weighting and show the underlying components. When a ranking changes, developers can inspect the inputs instead of guessing what the score represents.

Compare like with like

A comparison only means something when candidates use compatible conventions. Apply the same observation-window policy, valuation approach, and treatment of incentives. If a candidate lacks an observation for the chosen window, label that limitation rather than quietly switching to a different interval.

Version the calculation method and retain the raw observations. If a reported estimate changes after a code deployment, the method version helps show whether the underlying data changed or the calculation did. This is useful when reviewing historical values or investigating a dashboard change.

Use the same principle for monitoring. Alert on important input changes, such as a missing observation, a change in valuation source, or a shift in a component—not just on the final annualized rate. An alert that names the changed input gives a developer a place to start investigating.

A review checklist

Before displaying or comparing an estimate, ask:

  • Is this pool-level activity or the return of a defined position?
  • Which components are included, and could any be counted twice?
  • Are the values expressed in the same unit of account?
  • What exact interval do the observations cover?
  • Are fees, incentives, and costs represented consistently?
  • Can a reader see the unannualized result and the annualization assumptions?
  • Can the estimate be reproduced from stored observations and a versioned method?

A useful yield estimate doesn’t need to imply certainty. It needs to show what was measured, what was derived, and which assumptions shaped the result. For more background on Solana pool research, see the WealthVille Learn section.

Conclusion

Start with the definitions, then build the calculation. Keep observations and estimates distinct, show the observation window, and treat activity and quoted rates as inputs to investigate, not final answers. That makes yield estimates easier to compare, test, and explain.

Written by Amitesh Mishra, Founder / Owner at WealthVille, whose work focuses on automated, non-custodial Solana yield optimization and AI-driven pool analytics.