Choose the Price Definition Before Calculating an Agent Feature

By DX Research Group · · Market data

A three-price fixture shows how an unnamed price changes portfolio valuation and market interpretation.

Specify the economic meaning of each price before using it in an agent feature. A last trade, a venue mark, and an external reference can disagree while each correctly represents its own quantity. We would carry the price role into every return, valuation, and trigger calculation rather than normalize all three into an anonymous price column.

Hyperliquid's perpetuals context exposes distinct markPx and oraclePx fields. Use the venue's field names when describing those observations; an adapter should explain any mapping to a generic index-price feature.

Three values produce three different answers

Assume a fictional market with last trade $102, venue mark $100, and external reference $99. The account holds 3 units acquired at $98 each. These values are simultaneous in this synthetic fixture; the example isolates price definition rather than delivery delay.

Valuation basisPosition valuePrice-only gain
Last trade$306$12
Mark$300$6
External reference$297$3

Cost basis is 3 × 98 = $294. The arithmetic is valid in all rows. The interpretation depends on whether the research question concerns last traded activity, venue-account valuation, or an external reference. None of these observations alone supplies the price obtainable for selling all three units.

For a basis feature, write the full formula. Last versus reference is (102 / 99 - 1) × 10,000 ≈ 303.03 bps. Mark versus reference is (100 / 99 - 1) × 10,000 ≈ 101.01 bps. Calling both values “premium” without naming the numerator makes the feature ambiguous.

Separate feature roles from execution evidence

A strategy may use last trade momentum, mark-based exposure, and reference-based divergence in the same turn. That is coherent when each calculation states its role. A fill comparison needs executable depth or actual fills, plus an explicitly chosen benchmark. Replacing the benchmark midway through a study changes what slippage means.

The adapter should retain original decimal strings, the source field, market scope, and any transformation. Preserve unavailable values independently: a missing oracle observation should leave an oracle feature unavailable even when a recent last trade exists. A fallback can be a documented policy, with its use visible in the decision record.

A proposed role-swap test

Create the fixture above and ask each consumer for its declared calculation: valuation, basis, and execution estimate. Deliberately swap mark and last fields in a second input. Expected checks should identify the role mismatch or produce a visibly different value under the changed configuration.

Our execution VWAP note supplies the depth-based calculation after a benchmark is chosen. Our paper/live distinction explains why a marked paper fill has a different evidence class from venue execution. These calculations establish semantic clarity in a constructed case. A real adapter audit would need the saved source payload and the exact field mapping used by each historical turn.

Sources

Related field notes