> ## 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.

# Rebalancing

> How Ratio maintains healthy pool inventory through automated rebalancing

Cross-border payment flows are inherently directional. Morning remittance flows might push USD→IDR while afternoon commerce flows push IDR→USD. Over any period, one direction typically dominates, creating inventory imbalances.

Ratio's rebalancing system ensures pools stay healthy and corridors remain available — automatically, without manual intervention.

## The two-phase model

<img src="https://mintcdn.com/ratiolabs/_WZ1jJo-JiN7xW7b/images/rebalancing-flow.svg?fit=max&auto=format&n=_WZ1jJo-JiN7xW7b&q=85&s=eb216921a666ed96f390f114622d83ac" alt="Two-Phase Rebalancing" width="680" height="220" data-path="images/rebalancing-flow.svg" />

Ratio separates the user experience (instant settlement) from inventory management through a two-phase model:

<Tabs>
  <Tab title="Phase 1 — Instant settlement">
    Every user swap settles instantly against the protocol's liquidity pools. The user receives their destination stablecoin in under one second. At this point, the swap is complete from the user's perspective.

    Phase 1 is what partners and end users see — fast, atomic, predictable.
  </Tab>

  <Tab title="Phase 2 — Async rebalancing">
    Behind the scenes, the protocol monitors pool imbalances. When thresholds are exceeded, the system coordinates external rebalancing — sourcing liquidity from market makers, OTC partners, or stablecoin issuers to restore target pool levels.

    Phase 2 is invisible to partners. It happens asynchronously and does not affect settlement speed.
  </Tab>
</Tabs>

## How rebalancing triggers work

The system monitors each pool's balance relative to its target and responds with increasing urgency:

<Steps>
  <Step title="Mild imbalance">
    The pricing engine adjusts the mid-rate via inventory skew, naturally attracting offsetting flow. No external action needed.
  </Step>

  <Step title="Moderate imbalance">
    The system coordinates with external market makers via RFQ (Request for Quote) to source needed liquidity. Pool availability is maintained throughout.
  </Step>

  <Step title="Severe imbalance">
    The system escalates to emergency sourcing, recalls liquidity from yield strategies, and may restrict trading to the rebalancing direction only.
  </Step>
</Steps>

<Note>
  Each corridor has independently configured thresholds, allowing the system to respond differently to imbalances in deep G10 corridors versus thinner emerging-market corridors.
</Note>

## Time-of-day awareness

Rebalancing is aware of market hours and trading patterns. The system distinguishes between:

* **Peak hours** — When bilateral flow offsets are likely. Rebalancing is more patient, waiting for natural correction.
* **Off-peak hours** — When external rebalancing may be needed sooner.
* **Holidays** — Market holiday calendars for each jurisdiction are factored in.

This prevents premature rebalancing during periods when natural offsets are expected — reducing external costs.

## Self-stabilising design

Multiple mechanisms work together to create a self-stabilising system:

<CardGroup cols={2}>
  <Card title="Inventory-aware pricing" icon="scale-balanced">
    Attracts offsetting flow before external action is needed.
  </Card>

  <Card title="Tiered thresholds" icon="stairs">
    Escalates response proportionally to imbalance severity.
  </Card>

  <Card title="Yield recall" icon="arrow-rotate-left">
    Provides additional liquidity without relying on external markets.
  </Card>

  <Card title="Cooldown periods" icon="clock">
    Prevents over-rebalancing by spacing out external actions.
  </Card>
</CardGroup>

The result is a system that handles the natural ebb and flow of cross-border payments automatically — maintaining pool health while minimising cost.
