> For the complete documentation index, see [llms.txt](https://doc.torch.finance/telegram-usd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.torch.finance/telegram-usd/how-tgusd-works/use-cases/defi/arbitrage.md).

# Arbitrage

Before diving into execution details, we recommend reviewing the [Peg Stability](/telegram-usd/how-tgusd-works/peg-stability.md) section to understand the role of arbitrage in maintaining tgUSD’s price stability.\
Arbitrage is not just a trading opportunity—it’s a key mechanism that supports equilibrium across markets.

Arbitrage opportunities occur when a DEX pool displays a **price premium**, meaning the output value of swapping asset A to B exceeds the input value.

> Example: Swapping 100 tgUSD returns stgUSD worth $100.53—indicating an arbitrage window.

As part of the system’s design, platforms like [Torch Stable Swap](https://app.torch.finance/pools#/swap?tokenIn=1%3A0%3Ab113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe\&tokenOut=1%3A0%3A89ec04b13a423a5ace4187c27be1765b457f3ceb58c5813653e360d7bfbd7e50) and [DeDust](https://dedust.io/pools/EQDoBbJWXOJUPXEvf8qWpAk7B9p1gYTSVJJVE7wzDofzb52n) can exhibit price discrepancies that enable user-driven arbitrage and contribute to peg stability.

<figure><img src="/files/6mx78793jdfwzy3rs1Wk" alt=""><figcaption><p>Left: Swap page in <a href="https://t.me/tgusd_official_bot/app">Telegram USD Mini App</a> | Right: Swap page on <a href="https://app.torch.finance/pools#/swap?tokenIn=1%3A0%3Ab113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe&#x26;tokenOut=1%3A0%3A89ec04b13a423a5ace4187c27be1765b457f3ceb58c5813653e360d7bfbd7e50">Torch Stable Swap Website</a></p></figcaption></figure>

## How Arbitrage Works

1. **Detect Price Discrepancy**\
   Monitor quotes across DEXs. Arbitrage becomes viable when the price difference exceeds the combined cost of swap fees and gas.
2. **Execute the Trade**\
   Swap the undervalued asset for the overvalued one in the pool showing the premium.
3. **Calculate Profit**\
   Profit = Price premium − Swap fee − Gas cost

{% hint style="warning" %}
Arbitrage is highly competitive. If another user front-runs the opportunity or prices shift during your transaction, actual profit may be lower than expected—or result in a loss.
{% endhint %}
