master.market-state
- Version
- 0.1.0
- Desk
- Terms named on this page
Whether a listed token's reference price is live right now, and which signal decided it.
Changelog
| Version | Date | Change |
|---|---|---|
0.1.0 | 2026-11-11 | First version. Session window checked against every round of the 35 equity feeds from 2026-06-21 to 2026-11-10. |
What it measures
One term for an issuer-listed token at the moment it is checked, with the signal that decided it in decidedBy. It does not say whether the stock exchange is open, whether the token can be traded, or whether its price is right.
Inputs
- The token's feed, from
master.feed, and whether the feed list has been read at all. - On each check, in one batch at one block:
oraclePaused()on a Robinhood token, andlatestRoundData()on the token's feed when it has one. An Ondo token has nooraclePaused(), so nothing is read for an Ondo token with no feed. - The session schedule,
packages/master/data/session.json, with the market holidays to 2028.
The rule
Decided in this order. The first rule that applies gives the term, and decidedBy names it.
No feedwhen the token has no feed. This is the common case: 35 feeds for 218 listed tokens, on 2026-11-10.PausedwhenoraclePaused()is true.Closedwhen the session schedule is not running.Openwhen the session schedule is running. ButClosedwhen the feed has been quiet for longer than its heartbeat plus a margin of 600 seconds, counted in session time: from the later of its last update and the start of the current session.
A quiet feed alone does not mean Closed. The feeds' heartbeat is 86,400 seconds and their deviation trigger 0.5%, so a feed can be quiet for most of a day while the session runs.
decidedBy states the threshold it applied, the heartbeat and the margin both:
Open: "The 24/5 session schedule is running, and the feed's last update is N seconds of session time old, within its heartbeat of H seconds plus a margin of 600 seconds."Closedwhile the schedule runs: "The schedule is running, but the feed has been quiet for N seconds of session time, longer than its heartbeat of H seconds plus a margin of 600 seconds."
A failed read gives no term. When the oraclePaused() read or the feed read fails, or the feed answers no usable round, the term is left out, the market state is null, and stale names each read that failed in people's words, "the oracle's pause flag" or "the price feed", with the note "The read failed, so no market state is given." When the batch reads one of the two and not the other, only the read that was not answered is named: a read that was answered is never said to have failed. The term still waits for both. A failed read is never Open. Before the feed list has been read once, no token can be said to have no feed, so there is no term either, and stale names "Chainlink's feed directory" with the note "No read of it is on file yet, so no token can be said to have no feed."
A token with no feed is never Paused. Rule 1 comes first: a token with no feed whose oracle is paused stays No feed, and the answer carries the note "The issuer's oracle for this token is paused."
The issuer's price endpoint and its trading-halt flag are not read in Phase 1. No real response from that endpoint has been recorded, so rule 2 rests on oraclePaused() alone. The flag joins rule 2 once a response is recorded.
The session schedule
A trading day's session runs from 20:00 New York time on the day before it to 20:00 New York time on the day itself. Saturdays, Sundays and market holidays are not trading days, so the schedule is not running from 20:00 Friday to 20:00 Sunday, nor over a holiday's session day.
Two Chainlink pages, read on 2026-11-10, describe the window differently. The observed updates decide:
| Source, read 2026-11-10 | Says | Observed |
|---|---|---|
https://docs.chain.link/data-feeds/tokenized-equity-feeds.md | Weekend from Friday 20:00 to Sunday 20:00 ET | Agrees |
https://docs.chain.link/data-feeds/selecting-data-feeds.md | US_Equities_24/5: 18:00 ET Sunday to 17:00 ET Friday | Does not agree on either end |
What every round of the 35 equity feeds showed, 2026-06-21 to 2026-11-10:
- no update on a Saturday, and none on a Sunday before 20:00 New York time;
- 324 updates on Fridays at 17:00 or later, the latest at 20:01:45;
- the first update after a weekend or holiday arrived 16 to 109 seconds after 20:00 New York time (677 reopenings: median 36 seconds, 99th percentile 56 seconds);
- Independence Day observed (Friday 2026-07-03): no update from Thursday 20:00 to Sunday 20:00. Labor Day (Monday 2026-09-07): no update from Friday 20:00 to Monday 20:00;
- the longest quiet spell inside a session was 24 hours and 30 seconds, from the one feed that updates about once a day at its heartbeat.
Early-close days (the day after Thanksgiving, Christmas Eve) are ordinary session days here: no feed has been observed on one yet.
Thresholds
| Threshold | Default | Where |
|---|---|---|
Session rollover | 20:00 New York time | session.json |
Heartbeat | the feed's own, from the directory: 86,400 seconds for every equity feed | master.feed |
Margin added to the heartbeat | 600 seconds | MARKET_STATE_RULES.heartbeatGraceSeconds |
The feed list is stale after | 259,200 seconds | FRESHNESS.feedListSeconds |
Holidays known through | 2028-12-31; later checks carry a stale entry | session.json |
The margin exists because a heartbeat update lands a little after the heartbeat: 30 seconds late at most in the observed rounds.
Terms
| Term | Observed |
|---|---|
No feed | The token has no price feed. |
Paused | The issuer's oracle for the token reports paused ( oraclePaused() is true). |
Closed | The session schedule is not running, or the feed has been quiet for longer than its heartbeat plus a margin of 600 seconds, in session time, while the schedule runs. |
Open | The session schedule is running and the feed has updated within its heartbeat plus a margin of 600 seconds, in session time. |
Evidence
market_state: the callsoraclePaused()andlatestRoundData()at the block of the check; the feed list it rests on (URL, fetch time, SHA-256), which says whether the token has a feed and gives the feed's heartbeat thatdecidedByquotes; forOpenandClosed, the schedule filepackages/master/data/session.json.feed_priceandfeed_updated_at: seemaster.feed.
Recomputation
pnpm tool packages/master/recompute.ts --envelope answer.json --rpc <endpoint> reads oraclePaused() and latestRoundData() again and applies this rule at the time the figure was computed. No free endpoint serves past state, so without an archive endpoint the script re-reads at the head block and says so; a feed that updated since then can change the term, and the line says why.
Ways to game it, and what the method does
| Way | What the method does |
|---|---|
A throttled endpoint, so a stale feed looks live | A failed read gives no term. |
An endpoint that answers one of the two reads and refuses the other | No term, and only the read that was refused is named as failed. |
A weekend price presented as current | The schedule says Closed from 20:00 Friday to 20:00 Sunday, whatever the feed's age. |
A feed that stops updating during the session | Closed once it is quiet for longer than its heartbeat plus a margin of 600 seconds, in session time, and decidedBy says so. |
Limits
- The halt flag of the issuer's price endpoint is not read, so a halted stock with a running feed reads
Open. - The schedule is the feeds' 24/5 window, not the exchange's regular hours.
- A holiday list is a reviewed file: an unscheduled closure is not in it.
What overlaps elsewhere
Chainlink's pages describe the session window: the two above, with the date they were read. This method publishes the window it uses and the observations behind it, checks each feed's updatedAt against it, and names the deciding signal.