Trading Module-Institutional Depth 📈

4.1 Trade Lifecycle

The trading lifecycle in HFDX is fully on-chain and deterministic:

  1. Wallet Connection & Authentication — Users connect via EOA or smart wallet, ensuring transaction integrity.

  2. Market Selection — Predefined risk parameters, including leverage limits, margin requirements, and asset eligibility.

  3. Trade Submission via Router — Central execution gateway enforces atomicity of order placement.

  4. Initial Margin Validation — Ensures sufficient collateral before position creation.

  5. Liquidity Reservation — Allocates pool liquidity to back the leveraged trade.

  6. Position Creation & On-Chain Recording — Smart contracts log all position parameters, including collateral, notional, and leverage.

  7. Continuous Monitoring & Funding Accrual — Funding rates are applied continuously to maintain perpetual price alignment.

  8. Voluntary Close or Forced Liquidation — Positions may be closed by users or liquidated based on maintenance margin thresholds.


4.2 Margin & Liquidation Mechanics

Initial Margin (IM):

IM=NotionalLeverageIM = \frac{\text{Notional}}{\text{Leverage}}

Maintenance Margin (MM):

MM=Notional×Maintenance RatioMM = \text{Notional} \times \text{Maintenance Ratio}

Liquidation Condition:

EquityMM\text{Equity} \leq MM

Liquidation Price (Simplified Long Position):

Pliq=Entry Price×(1IMMMNotional)P_{\text{liq}} = \text{Entry Price} \times \left(1 - \frac{IM - MM}{\text{Notional}}\right)

These formulas quantify the risk envelope for each trade and allow predictable liquidation mechanics, essential for institutional risk management.


4.3 Funding Rate Model

Funding rates align perpetual prices with the external spot index:

Funding Rate=Clamp(k×Mark PriceIndex PriceIndex Price, Min, Max)\text{Funding Rate} = \text{Clamp}\left(k \times \frac{\text{Mark Price} - \text{Index Price}}{\text{Index Price}},\ \text{Min},\ \text{Max}\right)

Where:

  • k — Dampening coefficient controlling rate sensitivity

  • Min/Max — Thresholds that prevent extreme capital outflows during volatility

Funding is applied periodically, creating a self-correcting mechanism that stabilizes the perpetual market.


Last updated