code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/liquidity_provision/0044-LIME-044.feature (about) 1 Feature: Spot market SLA 2 3 Scenario: 001 0044-LIME-044,For a market with `market.liquidity.earlyExitPenalty = 0.25` and `total stake = target stake + 1200` already, a liquidity provider who reduces their commitment by `2000` will receive a total of `1800` back into their general account with `200` transferred into the market's insurance account (`40` received without penalty, then the remaining `60` 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 | 2000 | 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 | 4000 | 5000 | 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 | 4000 | 5000 | 0 | 96 97 Then "lp1" should have general account balance of "1000" for asset "ETH" 98 Then "lp2" should have general account balance of "2000" 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 | 1000 | 0.1 | amendment | 103 104 Then the network moves ahead "4" blocks 105 106 # #bond penalty for lp1 = 1000*0.25 =250 107 And the network treasury balance should be "250" for the asset "ETH" 108 Then the party "lp1" lp liquidity bond account balance should be "1000" for the market "BTC/ETH" 109 Then the party "lp2" lp liquidity bond account balance should be "2000" for the market "BTC/ETH" 110 Then "lp1" should have general account balance of "2750" for asset "ETH" 111 Then "lp2" should have general account balance of "2000" for asset "ETH" 112 113 Then the market data for the market "BTC/ETH" should be: 114 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 115 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 4000 | 3000 | 0 | 116 When the parties submit the following liquidity provision: 117 | id | party | market id | commitment amount | fee | lp type | 118 | lp1 | lp1 | BTC/ETH | 500 | 0.1 | amendment | 119 120 Then the network moves ahead "4" blocks 121 122 # #bond penalty for lp1 = 500*0.25 =125, so total bond penalty is 125+250=375 123 And the network treasury balance should be "375" for the asset "ETH" 124 Then the party "lp1" lp liquidity bond account balance should be "500" for the market "BTC/ETH" 125 Then the party "lp2" lp liquidity bond account balance should be "2000" for the market "BTC/ETH" 126 #general account for lp1: (500-125)+2750=3125 127 Then "lp1" should have general account balance of "3125" for asset "ETH" 128 Then "lp2" should have general account balance of "2000" for asset "ETH" 129 130