Guides
Oracle and price
Where the NVDA price comes from, how it reaches Arc, and what happens when it goes stale or the US market is closed.
The pipeline
- Source. The price service polls
api.xstocks.fi(NVDAx price-data) every 5 seconds. The response is only{"quote": n}: no timestamp, and no history endpoint was found. - Price service. Stores each tick with our receive time in SQLite and serves
/api/price,/api/candles,/api/ticksand/health. - Relayer. Reads
/api/priceand callsupdatePriceon the PriceOracle on Arc. - Oracle. Validates and stores it. The market reads it on every quote and trade.
Relayer cadence
The relayer checks every 5 seconds and pushes only when one of these is true:
- the price moved by 0.1% (10 bps) or more since the last push, or
- 60 seconds have passed since the last push (heartbeat).
It skips a push when the price service reports the quote as stale. Transactions use a 25 gwei fee because Arc enforces a 20 gwei floor.
Staleness
- Price service: a quote older than 60 seconds (by our receive time) is flagged stale, and the app shows it as stale.
- Oracle:
maxStalenessis 300 seconds on the deployed oracle (from the deploy log). Outside demo mode,getPricereverts for an older price, so trading stops. - Demo mode: the deployed oracle has demo mode on, which serves the last price even when it is stale. This is what allows trading off-hours and it must be off in any production deployment.
Sessions
The oracle stores a session with each price: closed, regular, pre-market, post-market or overnight. The relayer only reports two of them. It sets regular from Monday to Friday between 09:30 and 16:00 New York time and closed otherwise. It does not model holidays or extended hours. The market then applies the spread and cap for that session (see How it works).
Oracle guards
- Only addresses authorised by the owner can update the price.
- Rejects a zero or invalid price, a confidence wider than the configured limit, and a publish time that does not increase or lies in the future.
- Rejects a move larger than the per-update deviation cap unless the owner armed a one-shot override for a gap at the open.
- The relayer currently sends a confidence of 0, so the confidence guard does not do anything useful with this source.
Limits of this setup
- One source, one relayer. No cross-check against a second feed.
- No timestamp from the source, so freshness is measured from when we received the quote.
- A token price from a provider can differ from the stock price. The plan notes premiums of a few percent have been seen; arcusa does not read a provider feed yet.
- The plan chose Ondo's API as the first-choice source, but no key was obtained, so the xStocks endpoint is what runs. Pyth Pro and Stork were researched and not integrated.
- Parity with the real stock is bounded by the spread, caps and staleness limits. It is not guaranteed.