The reference price
The price guard compares the settlement price with the average of the prices sampled during the batch. That catches a spike, but a pool held away from its real price for the whole batch moves that average with it. Version 2 adds a second, slower reference.
How it moves
Each market keeps a reference price. On the first sample of every batch, the contract folds in the average of the last sampled batch:
- it moves 1/8 of the way toward that average,
- by at most 0.5 % of the reference per batch.
A price pushed and held for one batch therefore moves the reference by 0.5 % at most.
The check
To settle, the price must sit within the market's band of the batch average (as before) and within twice that band of the reference: 1.2 % for SPY, 3 % for TSLA, 4 % for SPCX, 2 % for the six others.
When the market really moves
A real move is followed. If NVDA reprices 3 % and stays there, the reference closes the gap batch after batch, and settlement passes again on the third active batch (200 to 200.75, 201.41, 201.99, against a 2 % band around 206). The batches in between are voided and every order in them is returned.
After a quiet stretch
A reference not refreshed for more than 16 batches (about an hour) is dropped. The next batch settles on the batch-average guard alone and seeds a new reference, which applies from the batch after. To keep references fresh, the keeper samples every market once every 12 batches even when nobody trades.
This means the reference protects markets that are sampled regularly, which is the case for all nine while the keeper runs. It is a slow average of the on-chain pool, not an external oracle.
