deepbook-margin-manager

Installation
SKILL.md

DeepBook Margin: Margin Manager & Risk Management

The MarginManager is a shared object that wraps a BalanceManager and provides the necessary capabilities to deposit, withdraw, trade, and manage leveraged positions.


1. Mathematical Risk Ratio Model

A MarginManager can only borrow from one margin pool at a time (either base or quote asset) to simplify risk evaluations.

The Risk Ratio is defined as: $$\text{Risk Ratio} = \frac{\text{Total Assets}}{\text{Total Debt}}$$

Where:

  • Total Assets = Sum of collateral assets, cash balances, and open position values valued in a common denomination using oracle prices.
  • Total Debt = Total borrowed asset balance + accrued interest.
Installs
1
First Seen
Sep 4, 2026
deepbook-margin-manager — nickthelegend/sui-deepbook-skills