code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/0044-LIME-025.feature (about) 1 Feature: Check early exit liquidity penalty is working 2 3 # For a market with market.liquidity.earlyExitPenalty = 0.25 and total stake = target stake + 140 already, 4 # if one liquidity provider places a transaction to reduce their stake by 100 followed by a second liquidity 5 # provider who reduces their commitment by 100, the first liquidity provider will receive a full 100 stake back 6 # whilst the second will receive a total of 85 back into their general account with 15 transferred into the 7 # market's insurance account (40 received without penalty, then the remaining 60 receiving a 25% penalty). (0044-LIME-025) 8 9 10 Background: 11 Given the following network parameters are set: 12 | name | value | 13 | market.liquidity.bondPenaltyParameter | 1 | 14 | network.markPriceUpdateMaximumFrequency | 0s | 15 | limits.markets.maxPeggedOrders | 2 | 16 | validators.epoch.length | 5s | 17 | market.liquidity.earlyExitPenalty | 0.25 | 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 following network parameters are set: 39 | name | value | 40 | market.liquidity.providersFeeCalculationTimeStep | 5s | 41 And the parties deposit on asset's general account the following amount: 42 | party | asset | amount | 43 | party1 | ETH | 100000000 | 44 | party2 | ETH | 100000000 | 45 | party3 | ETH | 100000000 | 46 | party4 | ETH | 100000000 | 47 And the parties submit the following liquidity provision: 48 | id | party | market id | commitment amount | fee | lp type | 49 | lp1 | party1 | ETH/DEC21 | 600 | 0.001 | submission | 50 | lp2 | party2 | ETH/DEC21 | 540 | 0.001 | submission | 51 And the parties place the following orders: 52 | party | market id | side | volume | price | resulting trades | type | tif | 53 | party3 | ETH/DEC21 | buy | 1000 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 54 | party3 | ETH/DEC21 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 55 | party4 | ETH/DEC21 | sell | 1000 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 56 | party4 | ETH/DEC21 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 57 58 Scenario: 001, LP gets penalty for exit (0044-LIME-025) 59 When the opening auction period ends for market "ETH/DEC21" 60 And the auction ends with a traded volume of "10" at a price of "1000" 61 Then the market data for the market "ETH/DEC21" should be: 62 | mark price | trading mode | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price | 63 | 1000 | TRADING_MODE_CONTINUOUS | 1000 | 1140 | 10 | 900 | 1000 | 1100 | 64 65 66 # Check we have a valid market with 2 LPs with the right amount of commitment 67 When the network moves ahead "5" blocks 68 Then the liquidity provisions should have the following states: 69 | id | party | market | commitment amount | status | 70 | lp1 | party1 | ETH/DEC21 | 600 | STATUS_ACTIVE | 71 | lp2 | party2 | ETH/DEC21 | 540 | STATUS_ACTIVE | 72 And the insurance pool balance should be "0" for the market "ETH/DEC21" 73 74 # Reduce the commitment of the first LP and make sure no-one gets penalised. 75 And the parties submit the following liquidity provision: 76 | id | party | market id | commitment amount | fee | lp type | 77 | lp1 | party1 | ETH/DEC21 | 500 | 0.001 | amendment | 78 When the network moves ahead "5" blocks 79 Then the liquidity provisions should have the following states: 80 | id | party | market | commitment amount | status | 81 | lp1 | party1 | ETH/DEC21 | 500 | STATUS_ACTIVE | 82 | lp2 | party2 | ETH/DEC21 | 540 | STATUS_ACTIVE | 83 And the insurance pool balance should be "0" for the market "ETH/DEC21" 84 85 # Reduce the commitment of the second LP and check the insurance pool receives the right amount of penalty 86 And the parties submit the following liquidity provision: 87 | id | party | market id | commitment amount | fee | lp type | 88 | lp2 | party2 | ETH/DEC21 | 440 | 0.001 | amendment | 89 When the network moves ahead "5" blocks 90 Then the liquidity provisions should have the following states: 91 | id | party | market | commitment amount | status | 92 | lp1 | party1 | ETH/DEC21 | 500 | STATUS_ACTIVE | 93 | lp2 | party2 | ETH/DEC21 | 440 | STATUS_ACTIVE | 94 And the insurance pool balance should be "15" for the market "ETH/DEC21" 95 96