Margin Trading

Trade with DEX Liquidity

OpenLeverage smart contract integrates with external DEXs, such as Uniswap, for swapping between assets. Every time a trade is made on OpenLeverage, the trade will be executed on a DEX, and the AMM calculates the entry or exit price in the same way prices are calculated on Uniswap.

Liquidity and Slippage

You need to pay attention to the liquidity depth and stability of the target trading pair on DEX. When the liquidity provision is low, your trade will have bigger slippage on trading, or in extreme market conditions, you may not be able to close your position or be liquidated.

Multidex Routing

OpenLeverage optimizes trading by automatically seeking the best price, lowest slippage, and best costs on multiple exchanges to minimize trading costs.

While our integration with multiple DEXs, including PancakeSwap, Biswap, BabySwap, and Mdex, has enabled our community to save on transaction costs, our integration with 1inch DEX aggregator will provide more opportunities for cost savings. With 1inch, transactions are routed through multiple DEXs to get optimal pricing and reduce transaction costs by up to 99%, which will enhance the trading experience for users.

When traders open positions on OpenLeverage, they can utilize the Best Execution suggestion given by the platform. This suggestion offers the best transaction costs to the user to execute their trades. The interface will display the exchange rate, price impact, gas consumed, and DEX routing to better inform traders how to optimize their trades.

With multidex routing, not only does OpenLeverage reduce transaction costs, but it also increases opportunities for users, enabling them to save more money while boosting the value of their trades.

Collateral Ratio

The OpenLeverage Protocol allows traders to leverage by backing a position with collateral worth less than the total position size. It requires maintaining its collateral ratio above the market limit; otherwise, it could be liquidated.

All asset pairs experience different volatility by nature. To support a permissionless margin trading market, isolated pools are needed with risk parameters associated with the pair. Each pair has its collateral ratio, according to the pair's volatility and the block time and throughput of the chain.

The governance process can change the collateral ratio for each market to protect the lender in the best interest.

The collateral ratio is calculated by adding your collateral value in the borrow token and real-time PnL (Profit and Loss) for a given position and dividing by the borrow notional. Note that the collateral ratio is calculated with real-time prices from the DEXs.

collateralRatio=collateralValue+unrealizedPnlborrowNotional+interestAccruedcollateralRatio = \frac{collateralValue+unrealizedPnl}{borrowNotional+interestAccrued}

Leverage

As long as the trader can keep the position's collateral ratio above the market limit, traders can open positions with leverage from 1.1x to 2.4x.

The recommended max leverage for a trading pair is:

maxLeverage=1collateralRatio1.66maxLeverage = \frac{1}{collateralRatio*1.66}

Leveraged trading puts your funds at risk of liquidation at any time. Be sure you understand the risks of leveraged trading before proceeding.

Fees

There are transaction fees, in addition to the fees charged by the executing DEX. For most pairs, there is a 0.22% Transaction Fee. The pairs listed below have 0% or 0.05% transaction fees:

  • 0% Fees:

    (BNB Chain) BNB-BUSD, BNB-USDT, BNB-USDC, BTCB-BUSD, BTCB-USDT; (ETH Chain) ETH-USDC, ETH-USDT, WBTC-USDC

  • 0.05% Fees: (BNB Chain) ETH-USDC, ETH-BNB, ETH-USDT, ETH-BTCB, ETH-BUSD, BTCB-BNB, USDT-BUSD, USDT-USDC

Transaction fees are distributed to the following:

  • 20% will be deposited into the isolated insurance fund to cover unexpected losses to the lender.

  • 20% will go to the dev fund for sustainable development.

  • 60% will go towards the staking reward program.

Fees and fee allocation can be adjusted through governance to keep the protocol competitive in the market.

Borrowing Interest Rate

By opening a leveraged position, both long and short, you will be paying interest to the borrowing fund from the lending pool. The interest rate is dynamic, based on the utilization of the pool, which means the rate when you are getting into a position isn't always the same through the holding period.

The interest rate is annualized and counted on a block-by-block basis. For example, if you are paying a 30% annualized rate, which means you are paying approximately 0.000000009512938 of the borrowing unit per second.

Example

A trader can open an ETH long position worth 600 USDC backed by collateral of 200 USDC, borrowing 400 USDC from the lending pool. The smart contract executes a swap from USDC to ETH via Uniswap and keeps the position under the contract. The collateral ratio is 50%, equivalent to a 3X leverage.

If ETH falls in value, he loses money, resulting in a negative PNL. PNL is added to the margin, so in our example, the margin will start to go below 100 USDC, decreasing the collateral ratio to 25%. If the trader closes this position, he would instruct the contract to swap the current ETH holding back to USDC, repay the loan with interest, and have the remaining PnL back in his wallet.

Limit Order

Limit orders utilize price triggers for market purchases or sales at specific prices, enabling users to enter or exit positions at their preferred limit price or better. We aim to build the best on-chain limit order experience supported by partial fills and off-chain signatures.

There are several advantages to traders when they utilize the limit order feature:

  • Automated trading

  • Improved execution and risk management

  • More sophisticated trading strategies

What OpenLeverage limit order can do

OpenLeverage support four different kinds of limit order features for margin trading:

  1. Limit Buy is an order to purchase an asset at or below a specified price, enabling traders to control how much they pay by setting the limit price to below the current market price.

  2. Limit Sell is opening up a short position with a limit price higher than the current price.

  3. Take Profit is a condition to close a trade at a specific price point if the market rises to ensure profit.

  4. Stop-Loss is an order to buy or sell crypto assets once the asset reaches a specific price point. A stop-loss is designed to limit a trader's loss of their position.

Best execution

The limit order will automatically seek the best price, lowest slippage, and fees on multiple exchanges that support the pair to minimize the trading costs.

Partial fill

Partial fill is useful in decentralized environments to capture the best opportunities and minimize trading costs.

Partial fill is enabled for all orders. It means an order could be filled partially, e.g., executed in multiple trades, meeting price limits and slippage control requirements. The remaining position will be filled when the conditions are met again.

When partial fill happens, your commission fees will be deducted proportionately with the percentage of the filled order.

Limit order fees

Fees are extra fees that cover the gas costs and are collected by the executors on top of the transaction fees that occur on OpenLeverage and the DEXs.

Slippage tolerance

Slippage tolerance is an essential parameter that will impact the success rate of your executed limit order, especially with pairs with unstable liquidity on DEXs. When you place your limit order, your slippage setting might be sufficient for your execution. As time goes on, liquidity on the DEX might go up or down. When it goes down, your order size will have a different impact and need a higher slippage to enable the limit order to execute.

We do not recommend low slippage due to a reduced success rate.

Default slippage tolerance has been set on the dApp to optimize your order. We monitor the success rate and intend to optimize settings along the way.

Expiration time

The expiration time is the setting time that will be expired. No cancellation will need to be done. After the expiration, users may place another limit order again.

Canceling limit order

Canceling an order does not require a fee. It only requires the user's signature to validate the cancellation.

Changing parameters, including slippage tolerance, fees, and other conditions, will require canceling the limit order if the parameters are incorrect.

Multiple orders

Multiple limit orders can be placed with different prices and amounts. When the price hits different levels, you can see other triggers occur to help you capture the best opportunities and hedge your risk. Users can sell and buy at the same time.

Approving token usage

Since the limit order feature is implemented on a new smart contract, users must approve their assets to deposit and OLE tokens for gas fees.

You will need to approve token usage, even if you have done margin trading.

Trigger price

Trigger price is the limit price, where the price would be triggered compared to market conditions.

You need to be careful about where the current price is and the trigger price: If the order is buying, the limit price should be lower than the current price. If the order sells, the limit price is above the current price.

Otherwise, the order will be immediately executed.

Close with Repayment

This feature was recommended by Council Member Happystar through his proposal and backed by a clear community consensus enabling users to convert leveraged positions to spot positions by repaying assets and interest borrowed.

As a handy tool for arbitraging, users can capture the price difference between OpenLeverage and any other venue. When users see pairs that trade in multiple values and see a significant price difference, they can go long on OpenLeverage and sell on another platform.

For example, if a trader longs $2,000 worth of BNB at a lower price and sells $2,000 worth of BNB on Binance at a higher price, they can get BUSD and transfer the BUSD back on-chain and close the position with repayment. There is no price action on the close position.

Users are also able to close with repayment. Usually, when traders close their position, their holdings are sold at the current price, with collateral and PNL returned. What closing with payment means is that OpenLeverage will enable traders to repay the loan with interest and transfer the entire holding to the trader's account so that no assets are exchanged during the process. Assets must be repaid entirely and purchased.

OpenLeverage subsidizes users' trades with OLE and reduces transaction costs while widening opportunities versus simply trading on DEXs. Users are enabled to borrow more assets to do arbitraging and increase the capacity of their capital.

PNL (Profit and Loss) Formula

PNL=HeldAssetsBorrowedAssetsCollateralPNL = Held Assets - Borrowed Assets - Collateral

Long Position Example:

A trader opens an ETH 3x long position on the ETH-USDT pair when 1 ETH is valued at 3,000 USDT. If the ETH price rises to 4,100 USDT, there are two methods to calculate the PNL according to the collateral token:

  • Method 1 (Calculating ETH):

Leverage: 3x long Your collateral: 1 ETH Your borrowing: 6,000 USDT Your held amount: 3 ETH

PNL (ETH) = 3 - (6,000/4,100) - 1 = 0.536ETH PNL (%) = 0.536/1 * 100% = 53.66%

  • Method 2 (Calculating USDT):

Leverage: 3x long Your collateral: 3,000 USDT Your borrowing: 6,000 USDT Your held amount: 3 ETH

PNL (USDT) = 3 * 4,100 - 6,000 - 3,000 = 3,300 USDT PNL (%) = 3,300/3,000 * 100% = 110%

Even though PNL percentages are different, your profits will be the same.

Short Position Example:

A trader opens an ETH 3x short position on the ETH-USDT pair when 1 ETH is valued at 3,000 USDT. If the ETH price rises to 4,100 USDT, there are two methods to calculate the PNL according to the collateral token:

  • Method 1 (Calculating ETH):

Leverage: 3x short Your Collateral: 1 ETH Your Borrowing: 2 ETH Your held Amount: 9,000 USDT

PNL (ETH) = 9,000/4,100 - 2 - 1 = -0.805 ETH PNL (%) = -0.804/1 * 100% = -80.49%

  • Method 2 (Calculating USDT):

Leverage: 3x short Your Collateral: 3,000 USDT Your Borrowing: 2 ETH Your held Amount: 9,000 USDT

PNL (USDT) = 9,000-2 * 4,100-3,000 = -2,200USDT PNL (%) = -2,200/3,000 * 100%=-73.33%

Even though PNL percentages are different, your losses will be the same.

Last updated