How do I market make on Native?
Overview
Market makers fulfil trades in the following ways:
Pricer: Ensures accurate price provision for order requests.
Signer: Safeguards order data for on-chain transactions.
Pool: Executes on-chain swaps using a self-custody treasury.
When users request pricing on Native, the backend navigates various liquidity sources to find the best price. Upon user confirmation to execute a swap, the market maker is engaged to acquire the final price, securely endorsed by the assigned signer. The signer provides market makers with an additional layer of validation, while the transaction execution is handled by the pool smart contract.
Native ensures continuous order flow by working with relayers (i.e. aggregators and solvers). Depth of market making keeps spreads tight and increase arbitrage opportunities.
Understanding positions
To view market maker positions, use the /mm-positions
endpoint. This endpoint displays short and long positions for all tokens, overall credit in USD, and current USD prices.
Note: There is a 1-2 minute delay before off-chain positions and credit are updated.
Available credit is calculated using the formula:
Market Makers can also fetch on-chain positions directly for the most accurate data, excluding the pending off-chain fee, which is updated on-chain periodically.
Settling positions
Market Makers have two options to manage their positions: Repayment and Settlement.
Repayment: This is a permissionless operation where Market Makers can directly repay their short positions to the Vault contract. This action minimizes the short fee they need to pay.
Settlement: This is a permissioned operation where Market Makers can repay short positions and/or claim long positions, provided their credit remains healthy. Since settlement can potentially reduce the Market Maker's credit and make it unhealthy, Native imposes a 2-minute delay. During this delay, other credit-decreasing actions (like collateral removal or borrowing) are paused to ensure accurate credit calculation.
Determining the maximum order size that can be quoted
The size of the order a Market Maker can quote depends on the collateral factor of the long token in the quoting pair. The higher the collateral factor, the larger the order size that can be quoted.
For example, consider a Market Maker quoting on ETH/USDT and PEPE/USDT.
If a user wants to sell ETH or PEPE to buy USDT, ETH and PEPE are the long tokens, and USDT is the short token.
Since ETH has a higher collateral factor than PEPE, it provides more credit value when used as collateral. Therefore, the MM can quote a larger order size for ETH -> USDT than for PEPE -> USDT.
Endpoint to Check:
Use the /mm-available-borrow
endpoint to check the inventory balance and baseShortLimit for each token. The baseShortLimit is calculated as:
This represents the conservative amount an MM can quote if the long token collateral is zero.
Formula to Calculate Actual Maximum Amount:
Example calculations:
MM's availableCreditUsd: $10K
Token X (Collateral Factor: 0): 10K
Token Y (Collateral Factor: 0.5): 20K
Token Z (Collateral Factor: 0.8): 50K
Assuming sufficient inventory, the maximum orders MMs can quote are as follows:
Token X: $10K
After the trade, Market Makers will hold $10K worth of Token X as a long position, but with 0 collateral value. Consequently, they can short up to $10K of USDC, fully utilizing their available credit.
Token Y: $20K
Market Makers take a $20K long position in Token Y, which has a collateral value of $10K (with a collateral factor of 0.5). By shorting $20K of USDC, the net credit position becomes -$10K, thereby exhausting all available credit.
Token Z: $50K
Market Makers take a $50K long position in Token Z, with a collateral value of $40K (with a collateral factor of 0.8). By shorting $50K of USDC, the net credit position is -$10K, again using up all the available credit.
Mechanics of liquidation
An account becomes eligible for liquidation when its availableCredit
drops below zero. Whitelisted liquidators can review all Market Maker positions. If a Market Maker's credit is unhealthy, liquidators can submit a liquidation proposal via the Native API.
The proposal should specify which short positions to repay and which long positions and collateral to claim. Native will verify and, if the proposal improves the account's health, approve it. The liquidators can then submit the approved proposal on-chain to execute the liquidation.
How Native sources its prices
Native's off-chain price feed is central to its credit engine. Prices are aggregated from sources such as Binance, Kucoin, MEXC, and CoinMarketCap. Native also performs internal risk checks by comparing prices from trusted Market Makers.
If a price is flagged as invalid or if price sources are down, Native's risk engine will pause all related activities, including trading, borrowing, settlement, collateral removal, and liquidation.
Handling insufficient inventory for settlement
If an asset is unavailable for settlement, similar to Compound logic, the Market Maker cannot settle. In such cases, the short/borrow fee will be set very high to encourage other Market Makers or borrowers to return funds to Native, following the Jump Rate model.
Last updated