code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/0044-LIME-024.feature (about) 1 Feature: Check penalties for early exit 2 3 # For a market with market.liquidity.earlyExitPenalty = 0.25 and 4 # total stake = target stake + 40 already, a liquidity provider who reduces their 5 # commitment by 100 will receive a total of 85 back into their general account 6 # with 15 transferred into the market's insurance account (40 received without penalty, 7 # then the remaining 60 receiving a 25% penalty). (0044-LIME-024) 8 9 Background: 10 Given the following network parameters are set: 11 | name | value | 12 | market.liquidity.bondPenaltyParameter | 1 | 13 | network.markPriceUpdateMaximumFrequency | 0s | 14 | limits.markets.maxPeggedOrders | 2 | 15 | validators.epoch.length | 5s | 16 | market.liquidity.earlyExitPenalty | 0.25 | 17 | market.liquidity.stakeToCcyVolume | 1.0 | 18 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.19 | 19 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 1 | 20 And the liquidity monitoring parameters: 21 | name | triggering ratio | time window | scaling factor | 22 | lqm-params | 0.1 | 24h | 1 | 23 And the average block duration is "1" 24 And the simple risk model named "simple-risk-model-1": 25 | long | short | max move up | min move down | probability of trading | 26 | 0.1 | 0.1 | 60 | 50 | 0.2 | 27 And the fees configuration named "fees-config-1": 28 | maker fee | infrastructure fee | 29 | 0.004 | 0.001 | 30 And the price monitoring named "price-monitoring-1": 31 | horizon | probability | auction extension | 32 | 1 | 0.99 | 5 | 33 And the liquidity sla params named "SLA": 34 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 35 | 0.01 | 0.5 | 1 | 1.0 | 36 And the markets: 37 | 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 | 38 | 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 | 39 And the parties deposit on asset's general account the following amount: 40 | party | asset | amount | 41 | party1 | 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 | 1040 | 0.001 | submission | 47 And the parties place the following orders: 48 | party | market id | side | volume | price | resulting trades | type | tif | reference | 49 | party3 | ETH/DEC21 | buy | 1000 | 900 | 0 | TYPE_LIMIT | TIF_GTC | p3b1 | 50 | party3 | ETH/DEC21 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b2 | 51 | party4 | ETH/DEC21 | sell | 1000 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | p4s1 | 52 | party4 | ETH/DEC21 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p4s2 | 53 54 Scenario: 001, Check commitment updated are handling in time order 55 When the opening auction period ends for market "ETH/DEC21" 56 And the auction ends with a traded volume of "10" at a price of "1000" 57 Then the market data for the market "ETH/DEC21" should be: 58 | mark price | trading mode | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price | 59 | 1000 | TRADING_MODE_CONTINUOUS | 1000 | 1040 | 10 | 900 | 1000 | 1100 | 60 # Place LIMIT orders to cover our commitment 61 And the parties place the following orders: 62 | party | market id | side | volume | price | resulting trades | type | tif | reference | 63 | party1 | ETH/DEC21 | buy | 10 | 999 | 0 | TYPE_LIMIT | TIF_GTC | party1-order1 | 64 | party1 | ETH/DEC21 | sell | 10 | 1001 | 0 | TYPE_LIMIT | TIF_GTC | party1-order2 | 65 When the network moves ahead "1" blocks 66 Then the liquidity provisions should have the following states: 67 | id | party | market | commitment amount | status | 68 | lp1 | party1 | ETH/DEC21 | 1040 | STATUS_ACTIVE | 69 And the parties should have the following account balances: 70 | party | asset | market id | margin | general | bond | 71 | party1 | ETH | ETH/DEC21 | 1200 | 99997760 | 1040 | 72 And the insurance pool balance should be "0" for the market "ETH/DEC21" 73 74 75 76 # Now the party try to reduce their commitment 77 And the parties submit the following liquidity provision: 78 | id | party | market id | commitment amount | fee | lp type | 79 | lp1 | party1 | ETH/DEC21 | 940 | 0.001 | amendment | 80 When the network moves ahead "7" blocks 81 82 Then the liquidity provisions should have the following states: 83 | id | party | market | commitment amount | status | 84 | lp1 | party1 | ETH/DEC21 | 940 | STATUS_ACTIVE | 85 86 # general account should have 99997760-85 (=99997845) 87 And the parties should have the following account balances: 88 | party | asset | market id | margin | general | bond | 89 | party1 | ETH | ETH/DEC21 | 1200 | 99997845 | 940 | 90 And the insurance pool balance should be "15" for the market "ETH/DEC21" 91