> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aultblockchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Oracle

> Where reference prices come from and how they affect trading, funding, and liquidation.

> [!NOTE]
>
> **Testnet-Only.** Oracle is available on Ault Testnet. Mainnet currently supports Spot DEX only.

Oracle feeds provide reference prices and tell Ault DEX whether the source market is open. Ault DEX combines them with its own pricing and risk rules.

Receiving a price does not mean the underlying market just traded at that price, that you can hedge at it, or that the Ault DEX market is open.

## Gold, silver, and platinum

RedStone provides these prices, aggregated from market-maker and broker quotes.

| Metal | RedStone feed |
| - | - |
| Gold | `XAU` |
| Silver | `XAG` |
| Platinum | `XPT` |

One GOLD, SILVER, or PLATINUM equals one troy ounce. See [Perpetuals](https://docs.aultblockchain.com/ault-dex/perpetuals.md#metal-market-units).

## External-feed sessions

RedStone publishes metals prices from 18:30 to 17:30 EST, 5 days a week, with a one-hour break each day and closures on weekends and holidays.

These closures apply to the price feed only. They do not halt Ault DEX markets, and trading, funding, and liquidation can continue. A feed closure does not cancel orders, close positions, or remove liquidation risk.

### 2026 holiday hours

On these dates, the gold, silver, and platinum feeds follow the hours below. Times are in EST.

| Date | Holiday | Feed hours |
| - | - | - |
| January 1 | New Year's Day | Closed |
| January 19 | Martin Luther King Jr. Day | 00:00-14:30 and 18:00-24:00 |
| February 16 | Presidents' Day | 00:00-14:30 and 18:00-24:00 |
| April 2 | Day before Good Friday | 00:00-17:00 |
| April 3 | Good Friday | Closed |
| May 25 | Memorial Day | 00:00-14:30 and 18:00-24:00 |
| June 19 | Juneteenth | 00:00-13:00 |
| July 3 | Independence Day | 00:00-13:00 |
| September 7 | Labor Day | 00:00-14:30 and 18:00-24:00 |
| November 26 | Thanksgiving | 00:00-14:30 and 18:00-24:00 |
| November 27 | Day after Thanksgiving | 00:00-14:45 |
| December 24 | Christmas Eve | 00:00-13:45 |
| December 25 | Christmas Day | Closed |
| December 31 | New Year's Eve | 00:00-17:00 |

## Closures, outages, and reopening

* **Scheduled closure:** RedStone keeps publishing the last price from before the close. Small changes can still appear, so a changing price does not mean the market is trading.
* **Unexpected outage:** RedStone publishes the last known price for a limited time, then stops.
* **Reopening:** The price can jump from the held price. Ault DEX can smooth this with a [linear price transition](#linear-price-transitions).

## Which price controls what?

| Price | Role |
| - | - |
| Last trade | The latest trade on Ault DEX. Conditional orders trigger on this price. |
| Effective index | The external price while its source is open and usable, or Ault DEX's internal index during a closed session. Used for Perpetual pricing and funding. |
| Mark | The price used to value Perpetual positions and risk. It can keep its previous value when inputs are insufficient. |
| Lending or Vault valuation price | The asset price converted into the product's accounting currency. |

## Price and funding formulas

`I` is the effective index, `L` is the local median, and `E` is the external-perpetual price. In an open session, `I` needs an enabled, positive external price within the market's age limit. A closed session uses the internal index, starting from the last external price.

### Mark construction

```text theme={null}
Primary candidates = I + EMA150seconds(L - I), L, E
New mark = clamp(candidate median,
                 previous mark * (1 - c), previous mark * (1 + c))
```

`c` is the maximum change allowed per update. With exactly two primary candidates, Ault DEX adds the 30-second EMA of `L` before taking the median. With fewer than two, the mark keeps its previous value and timestamp. A mark with no previous value starts from `I`.

When all inputs exist, `L` is the median of best bid, best ask, and last trade. With a last trade but no bid, it is the lower of last and ask. With no ask, it is the higher of bid and last. With neither side, it is the last trade. Without a last trade, both sides are required and their midpoint is used.

### Closed-session index

`Iold` is the current internal index, `A0` is the external price fixed at the start of the session, and `Ls` is the first tier's maximum leverage at the start of the session.

```text theme={null}
D = max(impact bid - Iold, 0) - max(Iold - impact ask, 0)
alpha = 1 - exp(-min(elapsed seconds, 360) / 3600)
Inew = clamp(Iold + alpha * D, A0 * (1 - 1/Ls), A0 * (1 + 1/Ls))
```

A missing impact price contributes zero. The index updates at most once every five seconds. When the source reopens, the external price is used again. The index and mark can therefore move while the external price is held.

### Funding rate

```text theme={null}
Sample premium = (max(impact bid - I, 0) - max(I - impact ask, 0)) / I
Hourly rate = clamp((average premium + clamp(r8 - average premium, -a, a)) / 8,
                    -h, h)
Funding-index increase = rollover index * hourly rate
```

A missing impact price contributes zero. `r8`, `a`, and `h` are the market's eight-hour interest parameter, interest-adjustment cap, and hourly cap. Funding is not paid every eight hours: it uses UTC-hour windows, sampled at most once per five seconds. An interrupted window can be discarded.

## How Ault DEX handles closed, stale, or transitioning prices

A closed source, an old price, a price transition, and an Ault DEX market halt are different conditions.

| Operation | Rule |
| - | - |
| Feed status and reopening | A session-based feed needs a stored open status. A missing status counts as closed, and an open status does not expire with age. After a reopen, a price from the new session is required. The last price can still be read while closed. |
| Placing Spot and Perpetual orders | A closed source does not halt the market. Orders still go through the usual market, funding, and risk checks. Perpetual risk checks can use a stored mark of any age. |
| Perpetual funding | During a closed session, the internal index can keep funding running. A market halt or a missing index pauses funding and discards the current window. |
| Perpetual reductions and liquidation | An old mark does not stop these actions. Ordinary liquidation skips a halted market when choosing its IOC close. Liquidity and price limits can still prevent a fill. |
| Perpetual collateral transfers | Cross withdrawals need recent marks for held positions, and isolated-margin removal also checks for a recent mark. Deposits and adding collateral do not. |
| Lending and Margin risk actions | Usable price data is required. Borrowing, collateral withdrawal, liquidation, and Margin settlement each have their own checks for closed, old, transitioning, or deviating prices. Liquidation or settlement can still run when borrowing is blocked. |
| Margin automatic borrowing | Also rejects an old or closed price feed for the asset received. |
| Lending repayment from a wallet | Needs no health check, but the pool must have repayment enabled. Manual or cancel-based Margin repayment can still need a solvency check. |
| Trading Vault valuation | Needs enabled, positive, recent prices from an open source with no active price transition. Deposits or redemptions that depend on valuation can fail, and queued redemptions can wait and retry. |

An open status and an old price are different signals. If the status stays open but the external price is older than the Perpetual age limit, the index cannot be read and funding pauses. The internal index is not used in this case.

### Linear price transitions

After a source gap or reopening, Ault DEX can move gradually from the earlier price to the new live price. The `LinearBridging` flag marks this transition, which has nothing to do with token bridging.

When the source closes, the stored price freezes and any active transition stops. A later price can start a new transition.

Perpetual index reads accept a price during a transition. Lending rejects it when that action's transition check is enabled, and Trading Vault valuation rejects it.

When a price needs a conversion feed, both feeds must be enabled and open, the older timestamp is used, and either feed can put the result in transition.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.