📈Trading
How trading works

What can I trade?
MadPerps offers classical perpetuals with no borrowing or roll-over fees
On MadPerps you can trade perpetuals on berachain's native assets. You can go long or short on assets that have just launched on Berachain's spot DEXs . Of course MadPerps can also offer leverage on other assets.
As trader you put down margin in either $HONEY or $NECT and you can enter a long or a short position in the selected perpetual contract
Order types
For each trade, the AMM is the counterparty. The smart contract supports market orders and conditional orders with limit price and trigger price. This allows for a variety of order types.
Market with Slippage Protection
A limit price specified in the order protects the market order against slippage. If the limit price is not met, the order execution fails and the order is removed.
Limit
The AMM only allows for orders to be executed that result in a price better or equal to the specified limit.
Stop Limit (Path Independent)
If a trigger price is specified, the AMM only allows the trade to go through if both trigger, and limit price are met. Stop orders on D8X are path independent, that is, both conditions (trigger and limit) have to be met at the same time for the order to go through.
Stop Market (Path Independent)
The trader can specify a loose limit price in combination with a trigger price to mimic a stop market order. The trader will still get the best price available at the time the trigger is met.
Profit/Loss
Funding Payments
The funding rate is accrued continuously on the position size, and paid to/from the margin account in collateral currency at spot. Funding payments are realized when a trader modifies her position size, i.e. by performing an opening or closing trade.
Opening Trades
Opening a position or increasing the size of an existing position:
Locked-in-Value += Index Price * Trade Amount
Cash in margin account += ((Execution Price - Index Price) * Trade Amount
- Fee rate * |Trade Amount| * Index Price) / Collateral spot price
- Accumulated funding since last trade
Closing Trades
Closing or reducing the size of an existing position:
Locked-in-Value += Average Entry Price * Trade Amount
where
Average Entry Price = |Locked-in-Value| / |Position size|
Cash in margin account += ((Execution Price - Index Price) * Trade Amount
- Fee rate * |Trade Amount| * Index Price) / Collateral spot price
- Accumulated funding since last trade
Position Marking
The mark price determines Margin Account calculations and Liquidations.
Unrealized PnL
Current profit and loss of a given open position, in collateral currency:
Unrealized PnL = (Mark Price * Position Size - Locked-in-Value) / Collateral spot price
- Unpaid accumulated funding
Margin Balance
Current value of margin account including unrealized PnL, in collateral currency:
Margin Balance = Cash in margin account + Unrealized PnL
Leverage
Ratio between the position value at mark price in collateral currency and margin balance:
Leverage = (|Position size| * Mark Price / Collateral spot price) / Margin Balance
Margin Rate
Inverse of position leverage:
Margin Rate = 1 / Leverage
Last updated