MadHoney
  • 🐻Enter the Mad World
  • 🍯Welcome to the Den
    • 🔗Official links
    • 🛣️Roadmap (a.k.a. "Where Are We Going, Fren?")
  • 📈MadPerps
    • 📈Trading
    • 💰Liquidity provision
    • 💵Fee structure
    • 🤝Powered by D8X
    • 🏆Trading competition
      • Week 1
      • Week 2
      • Week 3
      • Week 4
      • Week 5
  • 🎲MadMachine
  • 💸$MADNOMICS
  • $MAD Token
  • 🐻The Mad Bears
  • 👨‍💻User guide
    • 💹How to Trade Perps on MadHoney
    • 💵How to provide liquidity
  • 🔓Security (a.k.a. "How We Keep the Bears Safe")
  • 🤝Partnooors (a.k.a. "The Bears Roll Deep")
Powered by GitBook
On this page
  • What can I trade?
  • Order types
  • Profit/Loss
  • Funding Payments
  • Opening Trades
  • Closing Trades
  • Position Marking
  • Unrealized PnL
  • Margin Balance
  • Leverage
  • Margin Rate
  1. MadPerps

Trading

How trading works

PreviousMadPerpsNextLiquidity provision

Last updated 4 months ago

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.

Order Type
Description

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
📈
📈