tunnl
  • Introduction
  • Roadmap
  • Orderbook Exchange
    • Getting Started
    • Userflow
    • UI/UX
    • Matching Engine and Orderbook
    • On-Chain Execution
    • Margin and Shorts
    • Oracles
    • Decentralized Leverage
    • Liquidations
    • Interest and Lending Rate
    • Fees
    • Token Details
  • Aggregated USDC
  • Aggregated Swaps
    • Getting Started
    • Fees
  • MPC Vaults
  • TUN Token
    • Profit Share and Buy Back
    • Token Allocations
    • Token Emissions
    • Governance
Powered by GitBook
On this page
  • Margin and Shorting Functionality
  • How it Works
  • Margin Variables
  1. Orderbook Exchange

Margin and Shorts

PreviousOn-Chain ExecutionNextOracles

Last updated 1 month ago

Please note that decentralized leverage, margin trading, and borrow/lend capabilties are still in their beta phase. One must always be careful when using beta products as there could be unexpected outcomes and there is a risk to using them.

Margin and Shorting Functionality

Aside from Tunnl's unique off-chain/on-chain functionality, "" is another unique feature that allows you to place margin and short orders, just like in centralized exchanges.

How it Works

In order to initiate a margin or short trade you follow very similar steps to placing an order trade, but you enable margin by sliding the "Enable Margin and Shorts" slider where you normally place trades. Please note that after you place a margin or a short order, you will not be able to disable this slider until you have paid back all borrowed funds ("Liabilities").

Once margin is enabled, you will be able to place orders larger than your current balance or sell assets you do not own by using funds borrowed from other users on the exchange. You will also notice that your maximum buy/sell amount will be modified to show how much of an asset you are now able to buy or short using margin. Another field that will appear will be your "Portfolio Liquidation Level" which shows how close you are to being liquidated if your "Total Collateral Value" drops below that price.

Margin Variables

The following are the variables that affect how much margin you are able to use and what your liquidation point is:

Liabilities

Liabilities are borrowed funds, either attained through margin trading or directly using the borrow functionality of Tunnl. Users pay on their liabilities, denominated in the token of the liability, on an hourly basis until their liabilities are paid back. The interest payments are automatically added to the user's liabilities.

Collateral Multiplier

Each token has a "Collateral Multiplier" assigned to it depending on the risk assessment of that token. The lower the collateral multiplier, the lower value compared to it's actual value that the token is assigned.

Collateral Value = Token Amount * Token Price * Token Multiplier

For example, if a token has a collateral multiplier of 0.8, $100 worth of that token will only count for $80 worth of collateral.

Total Collateral Value

The "Total Collateral Value" takes into account all of your assets' collateral value, minus your liabilities, in stablecoin value.

Total Collateral Value = (Token Amount in Assets * Token Price * Collateral Multiplier) - (Token Amount in Liabilities * Token Price)

Initial Margin Requirement

Each token has its own "Initial Margin Requirement". The initial margin requirement is a multiplier, which is multiplied by the dollar value of the total liabilities of an asset a user has. It is calculated every time a user borrows a token. This determines how much of a token you are able to borrow when opening up a margin position or borrowing directly.

For example, if the initial margin requirement of a token is 1.0, a user needs to have $1.00 in collateral for every $1.00 of the token they borrow. If the initial margin requirement is 0.5, then the user needs to have $0.50 of collateral for every $1.00 of the token they borrow. If a user does not have at least the required amount of collateral they will not be able to open the new position.

Maintenance Margin Requirement

Each token has its own "Maintenance Margin Requirement". The maintenance margin requirement is a multiplier, which is multiplied by the dollar value of the total liabilities of an asset a user has. This determines what collateral value your portfolio must stay above in order not to get liquidated.

For example, if the maintenance margin requirement of a token is 0.5, a user needs to have $0.50 in collateral for every $1.00 of the token they borrow. If their Total Collateral Value falls below $0.50, their positions are in danger of being liquidated.

Aggregate Initial Margin Requirement

When a user has more than one token as a liability, the sum of their initial margin requirements is used to determine their Aggregate Initial Margin Requirement. In order to borrow or open new margin positions, their Total Collateral Value must always remain above the Aggregate Initial Margin Requirement.

Aggregate Maintenance Margin Requirement

When a user has more than one token as a liability, the sum of their maintenance margin requirements is used to determine their Aggregate Maintenance Margin Requirement. A user's Total Collateral Value must always remain above the Aggregate Maintenance Margin Requirement in order to avoid liquidations.

Decentralized Leverage
interest