Skip to main content

Position Management

Open Position

Opening a position is the first and crucial step that a trader takes when entering the market. Jungle Exchange sets trading direction rules as such: A trader can hold both long and short positions for the same underlying asset, with positions in the same direction being consolidated.

For example, if a trader opens a 20x long position of 0.04 BTC in BTCUSD contract, and subsequently opens another 10x long position of 0.01 BTC in BTCUSD contract, then these positions will be merged regardless of differences in entry prices or leverage, leaving the trader with a single 16.66x long position with 120 USDC of margin in BTCUSD contract.


Position Mode

When opening a position, traders can select between isolated and cross margin modes, depending on their risk preferences. In the case of isolated margin, each position is independent, with the maximum potential loss being limited to the margin of that specific position opened. In cross margin, the risk across different positions, as well as USDC balance in the contract account will be taken into account. The maximum loss will therefore be the sum of all positions' margins and the USDC balance in the contract account.

Currently, Jungle Exchange only supports isolated mode.


Slippage

At the time of opening a position, traders have the flexibility to set price slippage according to their preference. Generally, higher price slippage increases the likelihood of immediate execution but may result in a less favorable execution price. Conversely, lower price slippage increases the chance of order-matching failure but ensures that the execution price closely aligns with the trader's expected price. This is because the price slippage determines the worst possible price at which the order will be matched (the Accept Price). If the actual price quoted by order matching engine (the Quote Price) falls below the Accept Price, the trade fails, thus protecting the trader. The formula for calculating the Accept Price is as follows:


AcceptPrice<QuotePrice×(1+Slippage)foropenlongorcloseshort;AcceptPrice<QuotePrice\times(1+Slippage)foropenlongorcloseshort; AcceptPrice>QuotePrice×(1+Slippage)foropenshortorcloselong;AcceptPrice>QuotePrice\times(1+Slippage)foropenshortorcloselong;

Leverage

When opening a position, traders can also adjust the leveragel{[1,125]Z}l \in \{[1, 125] \mid Z^{*}\} according to their risk tolerance. Generally, higher leverage results in lower margin requirements for the position, but increases the probability of liquidation instead, and vice versa. For most traders, it is suggested that they exercise caution when choosing leverage exceeding 20, as it entails significantly higher risk.


Position Info

Once the trader has confirmed the settings mentioned above, they can proceed to open a position based on their market outlook in the following steps:

  1. Specify the desired position Sizes={n×contract sizenZ}Size s = \{n \times \text{contract size} \mid n \in \mathbb{Z}^{*}\}. Using the above BTCUSD contract as an example, a position size of 1 BTC is fine, but a size of 0.001BTC will not proceed.

  2. Sit back and wait for the order to be matched at the optimal quote price by Jungle Exchange's order matching system.

  3. Review the quote and estimated position information, including margin mm, position size ss, entry price pe{p}_{e}, leverage ll, liquidation price pl{p}_{l} , set constant fee rate RR, and set constant maintenance margin rate MMRMMR. These values satisfy the following equations:


m×l=s×pem \times l = s \times p_{e}
pl=s×pems(1MMRR)p_{l} = \frac{s \times p_{e} \mp m}{s(1 \mp MMR \mp R)}

Margin Adjustment

First introduced by Robert Shiller in a 1993 paper, perpetual futures differs from traditional finance by having no expiry date set. Since the crypto market is highly volatile and never sleeps, margin requirements are used to ensure that user account balance is sufficient to cover any potential losses, and that market dynamics is kept healthy even under extreme market conditions.

Margin refers to a percentage of the face value of the futures contract that is placed by the trader to open a position.

Maintenance Margin(MM) is the minimum balance required to keep the current position open after all potential losses have been accounted for. If below, the trader may risk liquidation.

Maintenance Margin Rate (MMR): The minimum margin rate required to keep the current position open.

In Isolated mode, traders can increase or remove the margin for a specific position. This more flexible approach of risk control prevents the forced liquidation triggered when MarginLevelMargin Level of a certain position reaches 100%.


Margin Level=m+uPnLs×pm×(MMR+R)\text{Margin Level} = \frac{m + uPnL}{s \times p_{m} \times (MMR + R)}

Reduce Limit, the maximum of margin reduced, margin mm, position size ss, unrealized profit and loss uPnLuPnL, mark price pm2p_{m^{2}}, leverage ll, set constant fee rate RR, and set constant maintenance margin rate MMRMMR. satisfies that


m+uPnLReduce Limit-Funding Fees×pm×(MMR+R)>100%\frac{m + uPnL - \text{Reduce Limit-Funding Fee}}{s \times p_{m} \times (MMR + R)} > 100\%
LeverageMMR
(100 - 125]0.40%
(75 - 100]0.50%
(50 - 75]0.75%
(0 - 50]1.00%

For different markets, tiered MMR parameters are set along with a maximum position size limit, so that when large positions trigger forced liquidation, potential losses from position penetration can be avoided.

Take a simple senario of margin adjustment as an example:

  1. Select Market: Alice chooses a perpetual contract market: BTC/USD.

  2. Open Position: Alice is bull on BTC, currently valued at $50,000. She opens a long position of size 4 BTC with 2x leverage. Her initial margin and margin requirement would be


InitialMargin=4BTC×$50,000 per BTC2=$100,000Initial Margin =\frac{4 B T C \times \$ 50,000 \text { per } B T C}{2}=\$ 100,000
MaintenanceMargin=MMR×InitialMargin=$1,000Maintenance\, Margin=MMR\times Initial\, Margin=\$ 1,000
  1. Margin requirement: The MMR for leverage range of (0,50] is 1.0%, meaning that Alice needs to maintain at least 1,000intheiraccount.IfthemarkpriceofBitcoindropsandAlicespositionfallsbelow1,000 in their account. If the mark price of Bitcoin drops and Alice's position falls below 1,000, she can choose to add margin so that her position will not be liquidated, preventing further losses.

Close Position

Closing a position is the action taken by a trader to exit or unwind their existing trade. Traders close their positions to realize profits or cut losses. In Jungle Exchange, if a trader had opened a long position, they would close it by selling the same amount of the asset they initially bought. Similarly, if they opened a short position, they would close it by buying back the same amount of the asset they initially sold. By closing the position, the trader effectively nullifies their exposure to further price movements of the asset.