Rhea Finance
  • Introduction
  • RHEA Finance White Paper
  • Genesis
  • Tokenomics
  • Governance
  • Community
  • Team
  • Getting Started
    • Setup Wallet
    • Using the Rainbow Bridge
    • Using the Platform
    • Buy REF Token
    • Staying Safe
  • RHEA Finance
    • Overview
      • Auto Router
      • Multi-chain Router
      • Pooling
      • Staking
      • RHEA V2 & DCL Pools
      • Aggregator Bridge
    • Guides
      • Lending & Borrowing
        • Audits & Risks
        • Supplying
        • Borrowing
        • APY
        • Health Factor
        • LP as Collateral
        • How Lending & Borrowing works
          • Health Factor
          • Interest Rate Model
          • Liquidations
          • Oracle
        • Step by Step Guide
      • Margin Trading
        • Guide
      • Trade
        • Swap
        • Limit Orders
      • Liquidity Management
        • Classic Pools
        • Stable & Rated Pools
        • RHEA v2 Pools
      • Farming
      • Staking
      • Aggregator Bridge
      • RHEA Point System
  • SECURITY
    • Contracts
    • Guardians
    • Oracles
    • Audits
    • Bug Bounty
  • DEVELOPERS
    • CLI Trading
    • CLI Farming
    • RHEA SDK
  • SUPPORT
    • FAQ
    • Help
Powered by GitBook
On this page
  • Technical Implementation
  • Loop-Based Leverage (Before Margin Trading)
  • Margin Trading
  • Isolated Positions for Meme Tokens
  • Meme Token Listing Criteria
  • Liquidation
  • Open-Source Liquidation Bot

Was this helpful?

  1. RHEA Finance
  2. Guides

Margin Trading

Margin Trading is built on top of Rhea’s Lending product, allowing users to provide sufficient collateral to access 1–3x leverage.

PreviousStep by Step GuideNextGuide

Last updated 10 days ago

Was this helpful?

Technical Implementation

Reference Document:

Loop-Based Leverage (Before Margin Trading)

Before Margin Trading was introduced, users could manually implement leveraged trading through a series of looping actions:

  • Shorting: Supply USDC → Borrow NEAR → Swap NEAR to USDC → Supply USDC → Borrow NEAR → ...

  • Longing: Supply USDC → Borrow USDC → Swap USDC to NEAR → Supply NEAR → Borrow USDC → ...

Margin Trading

Margin Trading simplifies the user's repeated loop operations into a single action, with steps managed by smart contracts. This makes leveraged trading more accessible and user-friendly.


Margin trading is available for:

  • Meme tokens (Selected assets)

  • NEAR

  • nBTC

Users can deposit Stablecoins (USDC, DAI, or USDt) as collateral to open long or short positions with up to 2x leverage on Meme Tokens and 3x leverage on NEAR and nBTC.

Isolated Positions for Meme Tokens

Due to the low liquidity and high volatility of Meme Tokens, and to avoid impacting the $200M liquidity pool of the main Lending product, we’ve created separate smart contracts (forked Lending contracts) for Meme Tokens. This isolates risk at the contract level.

All USDC used for long and short positions on Meme Tokens comes exclusively from these dedicated Meme Token lending contracts.

Meme Token Listing Criteria

Not all Meme Tokens can be listed on Margin Trading. To ensure the safety of users and the platform, a Meme Token must have over $100K liquidity on Rhea’s DEX to be eligible for listing.


Liquidation

Liquidation in Margin Trading differs from Lending:

  • Lending: Uses partial liquidation — only enough assets are liquidated to bring the user's health factor back to a safe level, avoiding full liquidation.

  • Margin Trading: Involves full liquidation (similar to a total position wipeout). Once a position is liquidated, all assets in that position are sold to repay the Lending debt and compensate the liquidator.


Open-Source Liquidation Bot

The Margin Trading liquidation bot is open-source and available here:

https://hackmd.io/@MarcoSun/SkW-_2Z_yl
https://github.com/burrowHQ/burrowland-liquidation-bot/tree/margin_trading
Margin Trading markets as of current assets