code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/liquidity_provision/0044-LIME-043.feature (about) 1 Feature: Spot market SLA 2 3 Scenario: 001 0044-LIME-043,For a market with `market.liquidity.earlyExitPenalty = 0.25` and `total stake = target stake + 1200` already, if one liquidity provider places a transaction to reduce their stake by `1000` followed by a second liquidity provider who reduces their commitment by `1000`, the first liquidity provider will receive a full `1000` stake back whilst the second will receive a total of `800` back into their general account with `200` transferred into the market's insurance account (`200` received without penalty, then the remaining `800` receiving a `25%` penalty). 4 Given time is updated to "2023-07-20T00:00:00Z" 5 6 Given the fees configuration named "fees-config-1": 7 | maker fee | infrastructure fee | 8 | 0 | 0 | 9 Given the log normal risk model named "lognormal-risk-model-1": 10 | risk aversion | tau | mu | r | sigma | 11 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 12 13 And the price monitoring named "price-monitoring-1": 14 | horizon | probability | auction extension | 15 | 360000 | 0.999 | 300 | 16 17 And the liquidity sla params named "SLA-1": 18 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 19 | 1 | 0.6 | 2 | 0.2 | 20 21 Given the following assets are registered: 22 | id | decimal places | 23 | ETH | 1 | 24 | BTC | 1 | 25 26 And the following network parameters are set: 27 | name | value | 28 | network.markPriceUpdateMaximumFrequency | 2s | 29 | market.liquidity.earlyExitPenalty | 0.25 | 30 | market.liquidity.bondPenaltyParameter | 0.2 | 31 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0 | 32 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0 | 33 | market.liquidity.maximumLiquidityFeeFactorLevel | 0.4 | 34 | validators.epoch.length | 2s | 35 36 And the spot markets: 37 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 38 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | SLA-1 | 39 And the following network parameters are set: 40 | name | value | 41 | market.liquidity.providersFeeCalculationTimeStep | 1s | 42 | market.liquidity.stakeToCcyVolume | 1 | 43 44 Given the parties deposit on asset's general account the following amount: 45 | party | asset | amount | 46 | party1 | ETH | 10000 | 47 | party2 | BTC | 500 | 48 | lp1 | ETH | 4000 | 49 | lp1 | BTC | 60 | 50 | lp2 | ETH | 4000 | 51 | lp2 | BTC | 60 | 52 53 And the average block duration is "1" 54 55 Given the liquidity monitoring parameters: 56 | name | triggering ratio | time window | scaling factor | 57 | updated-lqm-params | 0.2 | 20s | 0.8 | 58 59 When the spot markets are updated: 60 | id | liquidity monitoring | linear slippage factor | quadratic slippage factor | 61 | BTC/ETH | updated-lqm-params | 0.5 | 0.5 | 62 63 When the parties submit the following liquidity provision: 64 | id | party | market id | commitment amount | fee | lp type | 65 | lp1 | lp1 | BTC/ETH | 3000 | 0.1 | submission | 66 | lp2 | lp2 | BTC/ETH | 3000 | 0.1 | submission | 67 68 Then the network moves ahead "1" blocks 69 And the network treasury balance should be "0" for the asset "ETH" 70 And the global insurance pool balance should be "0" for the asset "ETH" 71 And the global insurance pool balance should be "0" for the asset "BTC" 72 And the party "lp1" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 73 Then the party "lp1" lp liquidity bond account balance should be "3000" for the market "BTC/ETH" 74 75 Then the market data for the market "BTC/ETH" should be: 76 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 77 | 0 | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 4800 | 6000 | 0 | 78 79 # place orders and generate trades 80 And the parties place the following orders: 81 | party | market id | side | volume | price | resulting trades | type | tif | reference | only | 82 | party1 | BTC/ETH | buy | 6 | 8 | 0 | TYPE_LIMIT | TIF_GTC | party-order5 | | 83 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order3 | | 84 | party2 | BTC/ETH | sell | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order4 | | 85 | party2 | BTC/ETH | sell | 6 | 24 | 0 | TYPE_LIMIT | TIF_GTC | party-order6 | | 86 87 When the network moves ahead "2" blocks 88 89 Then the following trades should be executed: 90 | buyer | price | size | seller | 91 | party1 | 15 | 1 | party2 | 92 93 Then the market data for the market "BTC/ETH" should be: 94 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 95 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 4800 | 6000 | 0 | 96 97 Then "lp1" should have general account balance of "1000" for asset "ETH" 98 Then "lp2" should have general account balance of "1000" for asset "ETH" 99 100 When the parties submit the following liquidity provision: 101 | id | party | market id | commitment amount | fee | lp type | 102 | lp1 | lp1 | BTC/ETH | 2000 | 0.1 | amendment | 103 Then the network moves ahead "4" blocks 104 When the parties submit the following liquidity provision: 105 | id | party | market id | commitment amount | fee | lp type | 106 | lp2 | lp2 | BTC/ETH | 2000 | 0.1 | amendment | 107 108 Then the network moves ahead "4" blocks 109 110 #bond penalty for lp2 = 800*0.25 =200 111 And the network treasury balance should be "200" for the asset "ETH" 112 Then the party "lp1" lp liquidity bond account balance should be "2000" for the market "BTC/ETH" 113 Then the party "lp2" lp liquidity bond account balance should be "2000" for the market "BTC/ETH" 114 Then "lp1" should have general account balance of "2000" for asset "ETH" 115 Then "lp2" should have general account balance of "1800" for asset "ETH" 116 117