Drift Protocol v2

โŒ˜K
๐Ÿ‘พWelcome to Drift Protocol
๐ŸงฎDrift DEX
๐Ÿ‘‹Getting Started
๐Ÿ“ˆPerpetual Futures
๐Ÿ“ŠSpot Margin Trading
๐ŸฆBorrow & Lend
๐Ÿ›๏ธStaking
๐Ÿ”ฌTechnical Explanations
๐Ÿ“Accounting and Settlement
โž—Borrow Interest Rate
๐Ÿ“œDelisting Process
โ›ฒDrift AMM
๐ŸƒJust-In-Time (JIT) Auctions
๐Ÿ“šKeepers & Decentralised Orderbook
โ˜ ๏ธLiquidators
๐Ÿ’งLiquidity Providers (LPs)
๐Ÿ“‹Protocol Guard Rails
๐Ÿ“Risks
๐Ÿ–ฅ๏ธDeveloper Resources
๐Ÿ“”Overview
โŒจ๏ธSDK Documentation
โŒจ๏ธTutorial: Bots
โš ๏ธTroubleshooting
๐Ÿ› ๏ธKeeper Bots
๐Ÿ› ๏ธTrading Bots
โŒจ๏ธHistorical Data (v1)
โŒจ๏ธAPI
๐Ÿ›ก๏ธSecurity
๐Ÿ›ก๏ธAudits
๐Ÿ›ก๏ธBug Bounty
โš–๏ธLegal and Regulations
๐Ÿ“Terms of Use
๐Ÿ“Disclaimer
๐Ÿ“Privacy Policy
๐Ÿ“Competition Terms and Conditions
๐Ÿ“šGlossary
Docs powered byย archbeeย 
11min

Risk Parameters

This risk parameters are relevant to perpetual futures. Further risk parameters are also set out in ๏ปฟPlatform Risks and ๏ปฟBorrow Lend Risk Parameters.๏ปฟ

Price Bands

In Drift v2, to prevent market manipulation and protect users during volatile events, markets will prevent users from sending orders if oracle-mark price breaches the 10% band of the oracle's 5-minute time-weighted average price (TWAP). If the mark and the 5-minute oracle TWAP diverges by 10%, markets will prevent orders from filling until price reverts back within this band.

These formulas are defined below:

Oracle-mark divergence = (mark - oracle) * max_spread

Oracle-TWAP-mark band = within 10% of mark - oracle_twap_{5 minutes}

Collateral Weight

To guard against concentration risk from a single whale, when assets exceed certain size, their asset weights can be discounted. ๏ปฟ

Size Weightage = 1.1 / (weight * sqrt{size} * imf_factor)

Additionally, liabilities (borrows) can have premium applied.

(1-weight/imf_factor) + sqrt{size} * imf_factor

๏ปฟPrice Manipulation Prevention

The Clearinghouse will also pause risk-increasing trades that further increase large oracle-mark divergence. Closing/reducing a position that further breaches this divergence is also not allowed (unless the divergence has already been breached).

Order/Execution Limits

An individual user sub-account can have up to 32 outstanding orders at any one time. A Market Order sent has limits within each instruction (so may be filled iteratively).

  • exceed 2% price impact (set by the market's max_slippage_ratio )

Market Orders have the possibility of only being partially filled before expiration if any of the following limits occur:

  • exceeds its slippage tolerance implied limit price
  • exceeds its active time limit (for market orders, the Clearinghouse sets this at 30 seconds)๏ปฟ

Within a single transaction, orders can filled up by the max_base_asset_amount against the AMM. This maximum is set per market and calling of multiple fill instructions may work. For example, if the maximum amount was 10,000 SOL, an order for 100,000 SOL can be filled against the AMM in 10 instruction calls.

The following conditions will also expire/cancel the remainder(s) of orders:

  • ๏ปฟOut of favor oracle price divergence from maker's set limit price (post only orders)๏ปฟ
    • oracle price 2.5% above maker's ask limit price
    • oracle price 2.5% below maker's bid limit price
  • order fill would reduce free collateral below 0 (for taker orders)

๏ปฟNote that whenever a user's orders are cancelled, fillers receive a small reward for the user they filled, if they did not receive payment otherwise.๏ปฟ

Unbounded P&L and Market Delisting

This risk is addressed in Risks and P&L.

Users can technically achieve unbounded unrealised P&L from entering and exiting a trade against the AMM. Further, as the AMM allows for asynchronous trading; there may not be an offsetting loss within the system to account for the gain made by particular users.

As such, even if user can achieve unbounded unrealised gains - those gains cannot be settled and withdrawable as collateral until there is a dollar of offsetting loss to account for the dollar of gain.

In a circumstance where the majority of participants are in extreme positive unrealised P&L and the unrealised P&L cannot be settled; the market may be eligible for settlement through the Delisting Process.

Updated 07 Dec 2022
Did this page help you?
Yes
No
UP NEXT
Margin
Docs powered byย archbeeย 
TABLE OF CONTENTS
Price Bands
Collateral Weight
Price Manipulation Prevention
Order/Execution Limits
Unbounded P&L and Market Delisting