For the complete documentation index, see llms.txt. This page is also available as Markdown.

Fallback Chain

Rubicon's oracle implements a multi-tier fallback system to ensure price availability even when individual sources fail.

Fallback Hierarchy

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Polygon   β”‚
                    β”‚  (Primary)  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ Success?                β”‚
              β”‚                         β”‚
         β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
         β”‚  YES    β”‚             β”‚     NO      β”‚
         β”‚ Submit  β”‚             β”‚ Try Yahoo   β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚ Success?                β”‚
                           β”‚                         β”‚
                      β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                      β”‚  YES    β”‚             β”‚     NO      β”‚
                      β”‚ Submit  β”‚             β”‚ Try Cache   β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                                                     β”‚
                                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                        β”‚ Cache < 60s old?        β”‚
                                        β”‚                         β”‚
                                   β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                                   β”‚  YES    β”‚             β”‚     NO      β”‚
                                   β”‚ Submit  β”‚             β”‚  DEGRADED   β”‚
                                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tier 1: Polygon (Primary)

Conditions for Use

  • API responding with 2xx status

  • Price data present in response

  • Price within validation bounds

Failure Triggers

  • HTTP errors (4xx, 5xx)

  • Network timeout (>5 seconds)

  • Invalid/missing price data

  • Price outside Β±20% of last known

Recovery

Automatically retries on next 3-second cycle.

Tier 2: Yahoo Finance (Secondary)

Conditions for Use

  • Polygon has failed

  • Yahoo API responding

  • Price data valid

Failure Triggers

  • HTTP errors

  • Parsing failures

  • Rate limiting (HTTP 429)

  • Invalid data format

Considerations

  • Higher latency than Polygon

  • May have slight delay in quotes

  • Logs warning when used

Tier 3: Stale Cache (Tertiary)

Conditions for Use

  • Both Polygon and Yahoo failed

  • Cached price is less than 60 seconds old

  • Cache file exists and is readable

Failure Triggers

  • Cache older than 60 seconds

  • Cache file corrupted or missing

  • No previous price recorded

Implementation

Degraded Mode

When all sources fail:

What Happens

  1. Alert triggered β€” Operations team notified

  2. UI warning β€” Users see "Price Stale" indicator

  3. Trading restricted β€” New positions may be blocked

  4. Oracle submission paused β€” Last valid price remains

Recovery

  • System continuously attempts to reconnect

  • Automatic recovery when source responds

  • Manual intervention if extended outage

Error Counting

We track consecutive errors:

Reset Conditions

  • Any successful price fetch resets counter

  • Counter resets to 0 on recovery

Logging

Each fallback event is logged:

Logs are monitored for patterns indicating source issues.

Failure Scenarios

Scenario 1: Temporary Polygon Outage

Impact: None β€” seamless fallback.

Scenario 2: Both APIs Rate Limited

Impact: Degraded mode after ~60 seconds.

Scenario 3: Network Outage

Impact: Degraded mode, requires network recovery.

Best Practices

For traders during source issues:

  1. Watch status indicator β€” UI shows oracle health

  2. Avoid new positions β€” If "stale" warning shown

  3. Existing positions safe β€” Liquidation uses last valid price

  4. Wait for recovery β€” Usually resolves in minutes

Monitoring Dashboard

Operations team monitors:

Metric
Healthy
Warning
Critical

Primary success rate

>99%

95-99%

<95%

Fallback usage

<1%

1-5%

>5%

Cache usage

0%

<0.1%

>0.1%

Degraded events

0

1/day

>1/day

Last updated