Data

Features from Uniswap oracles

Neuropolypse research · 3 October 2026 · 8 min read

Every input a polyp sees is a difference of time-weighted average ticks read from Uniswap V3 pools on Robinhood Chain. This note covers the oracle, the two feature kinds, how a pulse is settled, and how we rebuild the same numbers minute by minute for training.

Ticks and cumulatives

A Uniswap V3 pool prices its two tokens in ticks: the price is 1.0001^tick, so one tick is about a hundredth of a percent. The pool keeps a running sum, tickCumulative, that grows by the current tick every second, and stores snapshots of it in a ring of observations.

observe(secondsAgos) returns the cumulative at any past moment the ring still covers, interpolating between snapshots. The average tick over a window is then a subtraction and a division:

twap(a, b) = floor((tc(now - b) - tc(now - a)) / (a - b))     a > b, in seconds ago

The floor rounds toward negative infinity, the way Uniswap's own OracleLibrary does. Time weighting is the point: a single trade cannot move a 5 minute average much unless the price stays there.

Which way is up

Every market is a pool against USDG. When the asset is token0, a higher tick means the asset is up. When it is token1, the asset's tick is minus the pool tick. We apply that sign after the floor, in the browser and in the contract, so that both see the same integer. For a raw average of 7.5 ticks the inverted value is -7, not -8.

MarketAssetPool feeAsset isRing slotsOracle reach
ETHEther0.01%token010,80914.5 h
NVDANVIDIA0.05%token17,20036.9 h
GOOGLAlphabet0.05%token07,20089 h
SPCXSpaceX0.05%token07,20062.1 h
NETCloudflare0.30%token01,400171 h
AAPLApple0.05%token13,00063.4 h
QQQInvesco QQQ0.05%token11,80152.3 h
TSLATesla0.30%token07,200200.9 h

Reach is how far back observe() could answer when we measured it on 3 October 2026. Busy pools fill their ring faster, so ETH reaches back about 14 hours while TSLA reaches more than a week.

A feature is only useful if the contract will see the same number at pulse time.

Neuropolypse lab notes

MOM and DEV

A genome can use up to eight features, each one of two kinds on any market with a window w of 5, 15, 30 or 60 minutes:

MOM(m, w) = twap(m, w, 0)  - twap(m, 2w, w)
DEV(m, w) = twap(m, 60, 0) - twap(m, w, 0)

MOM asks whether the latest window is above the one before it. DEV asks whether the last minute is above the window's average. Both are in ticks, so a value of 25 is about a quarter of a percent.

The points a feature needs are 0 and w and 2w for MOM, 0 and 60 and w for DEV. Every point is one of eight values, from 0 to 7,200 seconds ago, so the contract collects them per market and makes one observe() call for each distinct market, with its points in descending order. Before the network sees a value, the divisor maps it into plus or minus 127.

Reference and settlement

At a pulse the contract also stores a reference: the target market's average over the last 300 seconds. When the horizon H has passed, anyone can settle. The end value is the 300 second average ending exactly at pulse time plus H:

ref  = twap over [t - 300, t]            stored at the pulse
end  = twap over [t + H - 300, t + H]    read at settle time
move = end - ref

Because the end window is pinned to t + H, settling late reads the same window as settling on time. Waiting for a better moment changes nothing.

When the oracle runs out

If the end window has already fallen out of the pool's ring, observe() reverts and the pulse is void. A void is recorded, never retried and never quietly dropped. With normal trading every ring reaches 14 hours or more, so a settle has hours of slack. A ring counts swaps, not hours, though: a flood of swaps can shrink a small ring (NET keeps 1,400 slots) to minutes of reach. So the keeper settles every due pulse every five minutes whether the polyp has fuel or not, and anyone can settle from the console. How voids count in the record is covered in the scoring note.

Rebuilding minutes for training

Training needs the same features at many past moments. The series API returns, for each minute, the tick-seconds accumulated during that minute. Any minute-aligned TWAP is then exact integer arithmetic: sum the minutes, divide by the span, floor.

There are two sources. Inside the ring, the data is exact: the tick is constant between two observations, so the cumulative interpolates exactly. Older days are rebuilt from swap logs, with block times interpolated between anchor blocks, and every such minute is flagged as not exact. When we compared the two where they overlap, rebuilt minutes matched the ring's minute average 98 to 100% of the time on most markets (94% on ETH, the busiest), and the worst error was one or two ticks. The Workshop can keep exact minutes only.

A closed day never changes, so it is cached for a year at the edge. Today's data refreshes every minute.

Manipulation, briefly

To fake a TWAP you have to hold a pool's price away from the market for the whole window, and arbitrageurs are paid to take the other side. Longer windows cost more to push and deep pools cost more than thin ones. A polyp is a signal with a public record, not an order router, and anyone building on one should weigh it by that record and by the depth of the markets it reads. The trust page lists the oracle risks in plain terms.

See it run

Open the console, pick a polyp and check these numbers against its pulses.