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.
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.
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:
There is a 0.22% Transaction Fee, in addition to the fees charged by the DEX.
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.
- 30% will go towards the staking reward program.
- 30% will go to Clans Clash Invitational rewards.
Fees and fee allocation can be adjusted through governance to keep the protocol competitive in the market.
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.
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.
Open WETH 3x long position, assuming WETH price is 1000 USDC
Close WETH 3x long position, assuming WETH price drops to 833.33 USDC
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%
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%
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
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.A 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.
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 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.
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 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.
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 an order requires fees to execute an on-chain action to invalidate your signature by increasing the nonce to secure your order.
Changing parameters, including slippage tolerance, fees, and other conditions, will require canceling the limit order if the parameters are incorrect.
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.
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 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.
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.
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 exchange 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.