Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ratiofx.com/llms.txt

Use this file to discover all available pages before exploring further.

Ratio’s pricing is anchored to real-world FX rates from institutional-grade oracle feeds. The oracle infrastructure is designed for reliability, accuracy, and redundancy — ensuring every quote reflects current market conditions.

Oracle architecture

Oracle Infrastructure The system follows a layered approach:
1

External price sources

Raw FX rate data from Pyth Network (primary) and Web2 FX APIs (fallback).
2

Oracle Keeper service

Fetches prices from external sources and pushes them to the on-chain Oracle Aggregator contract.
3

Oracle Aggregator contract

Validates, aggregates, and stores the latest prices on-chain. Single source of truth.
4

FX Engine reads prices

The pricing pipeline reads aggregated prices from the on-chain contract when constructing quotes.
The FX Engine never reads oracle prices directly from external sources. All prices flow through the on-chain aggregator, ensuring a single source of truth with full auditability.

Pyth Network (primary source)

Pyth Network is Ratio’s primary oracle. Key characteristics:
PropertyValue
Update frequency~400 milliseconds
Coverage380+ price feeds including FX pairs
Data qualityEach price includes a confidence interval
Data sourcesProfessional market makers and trading firms
On-chain availabilityAvailable on Kaia via Pyth contract + Hermes API
Ratio uses Pyth feeds for all Phase 1 corridors: USD/IDR, USD/SGD, and USD/MYR. For MYR/IDR, where a direct Pyth feed may not be available, the rate is derived from USD/IDR and USD/MYR — using USD purely as a pricing reference.

Web2 FX API (fallback source)

For redundancy, Ratio integrates traditional Web2 FX data providers as fallback sources. These are used when the primary oracle is unavailable or when an independent reference is needed for validation. The Web2 adapter is pluggable — the system can switch between providers without changing core logic.

Price validation

Every oracle price is validated before use:
CheckWhat it verifiesFailure response
FreshnessIs the price recent enough? Each corridor has a maximum acceptable age.Approaching staleness → wider spreads. Stale → circuit breaker.
Source consistencyDo multiple sources agree?Minor divergence → caution mode. Major divergence → halt.
ReasonablenessDoes the price fall within expected bounds?Out of bounds → halt and alert.
Validation runs on every single quote request — there is no cached or assumed pricing. If reliable data is unavailable, the system halts rather than quoting at an unreliable price.

Cross-currency rate construction

For pairs without a direct oracle feed (e.g., MYR/IDR), the system constructs a reference rate:
MYR/IDR rate = USD/IDR rate ÷ USD/MYR rate
This is standard cross-rate construction used universally in institutional FX. USD is used only as a mathematical reference — no actual USD conversion occurs. The swap executes directly between MYRC and IDRX. When a direct oracle feed becomes available for a cross-currency pair, the system automatically prefers the direct feed and uses the synthetic rate only for arbitrage validation.

Reliability design

Multiple sources

Independent oracle providers prevent single-point-of-failure dependency.

On-chain aggregation

Oracle data is immutably recorded and auditable on Kaia.

Automatic failover

Switches between sources based on freshness and reliability.

Circuit breakers

Halts trading rather than executing at unreliable prices.