Perpetual Contracts
Perpetual contracts are one of the most prominent types of derivatives within the market. Buying (going long) or selling (going short) perpetual contracts, allows traders to speculate on the future price of an asset, without having to specify an expiry date. This implies that the trader, buyer and seller, can hold the position for as long as they want. Additionally, there are no added costs apart from funding costs. As a result of this flexibility, perpetual contract trading is ideal. Traders are not locked into a losing trade even in a lousy market or on the weekends.
Within the fxdx protocol, the contract price is linked to the cost of the underlying asset by a dynamic interest rate, this is similar to current perpetual contracts. For liquidation, an on-chain pricing oracle is used (and secondarily for interest payments). The market's order book is off-chain, allowing for faster price changes and more liquidity.
Each perpetual contract has its own set of contract specifications.
• Funding Rate
• Leverage
• Margin Requirement
• Perpetual Liquidations

## Funding Rate

Perpetual contract prices frequently diverge from those of spot markets, dependening on the market sentiment. If most traders believe the underlying asset's value will rise over time, the price of the perpetual contract will almost certainly outperform the current spot price.
Short positions pay funding to long positions if the perpetual is trading at a discount to the underlying index. As a result of this, traders are incentivized to drive the future rate closer to the index price.
• Perpetual futures have funding payments every hour, fxdx protocol follows FTX's method to compute the funding rate.

## Leverage

Leverage allows traders to enter a position that is worth a lot more, by investing a small amount of money. As a consequence of this, the profit, as well as losses, can be dramatically amplified.
• Fxdx protocol allows traders to use leverage by backing a position with margin collateral that is worth less than the total position size. Traders are able to open positions with leverage up to 10x.

## Margin Requirement

The minimal margin percentage that an account must maintain to prevent liquidation is known as the margin requirement. The minimum collateral required to maintain an open position (maintenance margin) and all open orders (initial margin) are calculated periodically.
Traders on derivative exchanges must constantly maintain a healthy ratio between the value of the margin used to open a position, in addition to the notional value of that position. This is known as the margin ratio and can be calculated by the formula given below.
$(Margin + Unrealized PnL)/Notional Value of the Position$
When evaluating liquidation conditions, PnL is calculated using both index Price and 15-minute TWAP of Mark Price; the highest of the two values is then utilized.
Unlike centralized markets, margin calls will be performed by client software, algorithms, or third-party services and not issued by the network.

## Perpetual Liquidations

If the account's margin percentage falls below the maintenance margin minimum (7.5 percent), liquidation may be required. If a trader's position drops and if the loss begins to approach the value of his margin(initial collateral), these sudden price changes can make the position worth less than the collateral. If the value of assets is dangerously close to the value of the trader's collateral, the exchange will liquidate the trader's position to avoid losses. Partially liquidating an account is also possible. In this scenario, the liquidator will assume proportional amounts of the account's margin.
The liquidation takes place on-chain, and any account can act as a liquidator, as long as its final amount matches the maintenance margin criteria.
Incentives
Because a liquidator may take on the whole balance, the temptation to liquidate grows as the target account gets closer to the liquidation threshold. Other elements that influence the liquidation reward include:
• Avoidance of taking on additional price exposure, thus closing costs for the liquidated position
• Gas costs to win liquidation
• Price direction and time to liquidation
Alternatively explained, the more leverage a trader employs, the easier it is to liquidate the position. Due to the possibility that the margin ratio may quickly go below the maintenance margin during volatile market conditions. In order to free up the margin and maintain the position, fxdx will cancel all open orders on the current contract if liquidation is triggered. Orders on other contracts will continue to be accepted.