code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/0044-LIME-023.feature (about)

     1  Feature: If we are below target stake, everyone gets the penalty
     2  
     3  # For a market with market.liquidity.earlyExitPenalty = 0.25 and target stake > total stake,
     4  # a liquidity provider who reduces their commitment by 100 will only receive 75 back into their
     5  # general account with 25 transferred into the market's insurance account. (0044-LIME-023)
     6  
     7    Background:
     8      Given the following network parameters are set:
     9        | name                                                  | value |
    10        | market.liquidity.bondPenaltyParameter                 | 1     |
    11        | network.markPriceUpdateMaximumFrequency               | 0s    |
    12        | limits.markets.maxPeggedOrders                        | 2     |
    13        | validators.epoch.length                               | 5s    |
    14        | market.liquidity.earlyExitPenalty                     | 0.25  |
    15        | market.liquidity.stakeToCcyVolume                     | 1.0   |
    16        | market.liquidity.sla.nonPerformanceBondPenaltySlope   | 0.19  |
    17        | market.liquidity.sla.nonPerformanceBondPenaltyMax     | 1     |
    18      And the liquidity monitoring parameters:
    19        | name               | triggering ratio | time window | scaling factor |
    20        | lqm-params         | 0.1              | 24h         | 1              |  
    21      
    22      And the average block duration is "1"
    23      And the simple risk model named "simple-risk-model-1":
    24        | long | short | max move up | min move down | probability of trading |
    25        | 0.1  | 0.1   | 60          | 50            | 0.2                    |
    26      And the fees configuration named "fees-config-1":
    27        | maker fee | infrastructure fee |
    28        | 0.004     | 0.001              |
    29      And the price monitoring named "price-monitoring-1":
    30        | horizon | probability | auction extension |
    31        | 1       | 0.99        | 5                 |
    32      And the liquidity sla params named "SLA":
    33        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    34        | 0.01        | 0.5                          | 1                             | 1.0                    |
    35      And the markets:
    36        | id        | quote name | asset | liquidity monitoring | risk model          | margin calculator         | auction duration | fees          | price monitoring   | data source config     | linear slippage factor | quadratic slippage factor | sla params |
    37        | ETH/DEC21 | ETH        | ETH   | lqm-params           | simple-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.5                    | 0                         | SLA        |
    38      And the parties deposit on asset's general account the following amount:
    39        | party  | asset | amount     |
    40        | party1 | ETH   | 100000000  |
    41        | party2 | ETH   | 100000000  |
    42        | party3 | ETH   | 100000000  |
    43        | party4 | ETH   | 100000000  |
    44      And the parties submit the following liquidity provision:
    45        | id  | party  | market id | commitment amount | fee   | lp type     |
    46        | lp1 | party1 | ETH/DEC21 | 500               | 0.001 | submission  |
    47        | lp2 | party2 | ETH/DEC21 | 500               | 0.001 | submission  |
    48      And the parties place the following orders:
    49        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    50        | party3 | ETH/DEC21 | buy  | 1000   | 900   | 0                | TYPE_LIMIT | TIF_GTC | p3b1      |
    51        | party3 | ETH/DEC21 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | p3b2      |
    52        | party4 | ETH/DEC21 | sell | 1000   | 1100  | 0                | TYPE_LIMIT | TIF_GTC | p4s1      |
    53        | party4 | ETH/DEC21 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | p4s2      |
    54  
    55    Scenario: 001, Every commitment reduction costs us 25% of the amount
    56     When the opening auction period ends for market "ETH/DEC21"
    57     And the auction ends with a traded volume of "10" at a price of "1000"
    58     Then the market data for the market "ETH/DEC21" should be:
    59       | mark price | trading mode            | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price |
    60       | 1000       | TRADING_MODE_CONTINUOUS | 1000         | 1000           | 10            | 900                   | 1000             | 1100                    |
    61     # Place LIMIT orders to cover our commitment
    62     And the parties place the following orders:
    63       | party  | market id | side | volume | price | resulting trades | type       | tif     | reference     |
    64       | party1 | ETH/DEC21 | buy  | 10     | 999   | 0                | TYPE_LIMIT | TIF_GTC | party1-order1 |
    65       | party1 | ETH/DEC21 | sell | 10     | 1001  | 0                | TYPE_LIMIT | TIF_GTC | party1-order2 |
    66       | party2 | ETH/DEC21 | buy  | 10     | 999   | 0                | TYPE_LIMIT | TIF_GTC | party2-order1 |
    67       | party2 | ETH/DEC21 | sell | 10     | 1001  | 0                | TYPE_LIMIT | TIF_GTC | party2-order2 |
    68     When the network moves ahead "1" blocks
    69     Then the liquidity provisions should have the following states:
    70       | id  | party  | market    | commitment amount | status           |
    71       | lp1 | party1 | ETH/DEC21 | 500               | STATUS_ACTIVE    |
    72       | lp2 | party2 | ETH/DEC21 | 500               | STATUS_ACTIVE    |
    73     And the parties should have the following account balances:
    74       | party  | asset | market id | margin  | general  | bond  |
    75       | party1 | ETH   | ETH/DEC21 | 1200    | 99998300 | 500   |    
    76       | party2 | ETH   | ETH/DEC21 | 1200    | 99998300 | 500   |    
    77     And the insurance pool balance should be "0" for the market "ETH/DEC21"
    78  
    79     # Now reduce the commitment for party 1
    80     And the parties submit the following liquidity provision:
    81      | id  | party  | market id | commitment amount | fee   | lp type     |
    82      | lp1 | party1 | ETH/DEC21 | 400               | 0.001 | amendment   |
    83     When the network moves ahead "7" blocks
    84  
    85     Then the liquidity provisions should have the following states:
    86       | id  | party  | market    | commitment amount | status           |
    87       | lp1 | party1 | ETH/DEC21 | 400               | STATUS_ACTIVE    |
    88  
    89     And the parties should have the following account balances:
    90       | party  | asset | market id | margin  | general  | bond  |
    91       | party1 | ETH   | ETH/DEC21 | 1200    | 99998375 | 400   |   
    92     # party1 should give us 25% of the 100 they reduced by (25 added to insurance pool)  
    93     And the insurance pool balance should be "25" for the market "ETH/DEC21"
    94  
    95     # Now reduce the commitment for party 2
    96     And the parties submit the following liquidity provision:
    97      | id  | party  | market id | commitment amount | fee   | lp type     |
    98      | lp2 | party2 | ETH/DEC21 | 100               | 0.001 | amendment   |
    99     When the network moves ahead "7" blocks
   100  
   101     Then the liquidity provisions should have the following states:
   102       | id  | party  | market    | commitment amount | status           |
   103       | lp2 | party2 | ETH/DEC21 | 100               | STATUS_ACTIVE    |
   104  
   105     And the parties should have the following account balances:
   106       | party  | asset | market id | margin  | general  | bond  |
   107       | party2 | ETH   | ETH/DEC21 | 1200    | 99998600 | 100   |    
   108     # party2 should give up 25% of 400 (add 100 to the insurance pool)
   109     And the insurance pool balance should be "125" for the market "ETH/DEC21"
   110