code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/liquidity_provision/0044-LIME-045.feature (about) 1 Feature: Spot market SLA 2 3 @SLP 4 Scenario: 0044-LIME-045, when target stake > total stake, and LP reduces LP commitment 5 Given the fees configuration named "fees-config-1": 6 | maker fee | infrastructure fee | 7 | 0 | 0 | 8 Given the log normal risk model named "lognormal-risk-model-1": 9 | risk aversion | tau | mu | r | sigma | 10 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 11 12 And the price monitoring named "price-monitoring-1": 13 | horizon | probability | auction extension | 14 | 360000 | 0.999 | 300 | 15 16 And the liquidity sla params named "SLA-1": 17 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 18 | 0.001 | 0.1 | 2 | 0.2 | 19 20 Given the following assets are registered: 21 | id | decimal places | 22 | ETH | 1 | 23 | BTC | 1 | 24 25 And the following network parameters are set: 26 | name | value | 27 | network.markPriceUpdateMaximumFrequency | 2s | 28 | market.liquidity.earlyExitPenalty | 0.25 | 29 | market.liquidity.bondPenaltyParameter | 0 | 30 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.5 | 31 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.2 | 32 | market.liquidity.maximumLiquidityFeeFactorLevel | 0.4 | 33 | validators.epoch.length | 2s | 34 35 Given time is updated to "2023-07-20T00:00:00Z" 36 37 And the spot markets: 38 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 39 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | SLA-1 | 40 And the following network parameters are set: 41 | name | value | 42 | market.liquidity.providersFeeCalculationTimeStep | 1s | 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 | 50 | 48 | lpprov1 | ETH | 4000 | 49 | lpprov1 | BTC | 60 | 50 | lpprov2 | ETH | 4000 | 51 | lpprov2 | 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 | lpprov1 | BTC/ETH | 2000 | 0.1 | submission | 66 | lp2 | lpprov2 | BTC/ETH | 2000 | 0.1 | submission | 67 68 #0044-LIME-070, When an LP creates a new provision with zero commitment, it should be rejected with an error message stating that the commitment amount is zero. 69 When the parties submit the following liquidity provision: 70 | id | party | market id | commitment amount | fee | lp type | error | 71 | lp1 | lpprov1 | BTC/ETH | 0 | 0.1 | submission | commitment amount is zero | 72 73 And the parties should have the following account balances: 74 | party | asset | market id | general | 75 | lpprov1 | BTC | BTC/ETH | 60 | 76 | lpprov1 | ETH | BTC/ETH | 2000 | 77 78 Then the network moves ahead "1" blocks 79 And the network treasury balance should be "0" for the asset "ETH" 80 And the global insurance pool balance should be "0" for the asset "ETH" 81 And the global insurance pool balance should be "0" for the asset "BTC" 82 And the party "lpprov1" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 83 Then the party "lpprov1" lp liquidity bond account balance should be "2000" for the market "BTC/ETH" 84 85 Then the market data for the market "BTC/ETH" should be: 86 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 87 | 0 | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 3200 | 4000 | 0 | 88 89 # place orders and generate trades 90 And the parties place the following orders: 91 | party | market id | side | volume | price | resulting trades | type | tif | reference | only | 92 | party1 | BTC/ETH | buy | 1 | 12 | 0 | TYPE_LIMIT | TIF_GTC | party-order1 | | 93 | party2 | BTC/ETH | sell | 1 | 19 | 0 | TYPE_LIMIT | TIF_GTC | party-order2 | | 94 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order3 | | 95 | party2 | BTC/ETH | sell | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order4 | | 96 | lpprov1 | BTC/ETH | buy | 6 | 8 | 0 | TYPE_LIMIT | TIF_GTC | lp-order1 | | 97 | lpprov1 | BTC/ETH | sell | 6 | 24 | 0 | TYPE_LIMIT | TIF_GTC | lp-order2 | | 98 99 When the network moves ahead "3" blocks 100 101 Then the market data for the market "BTC/ETH" should be: 102 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 103 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 3200 | 4000 | 0 | 104 105 And the parties should have the following account balances: 106 | party | asset | market id | general | 107 | lpprov1 | BTC | BTC/ETH | 0 | 108 | lpprov1 | ETH | BTC/ETH | 1520 | 109 110 Then the network moves ahead "2" blocks 111 And the network treasury balance should be "0" for the asset "ETH" 112 And the global insurance pool balance should be "0" for the asset "ETH" 113 And the global insurance pool balance should be "0" for the asset "BTC" 114 And the party "lpprov1" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 115 Then "lpprov1" should have holding account balance of "480" for asset "ETH" 116 Then "lpprov1" should have holding account balance of "60" for asset "BTC" 117 Then the party "lpprov1" lp liquidity bond account balance should be "2000" for the market "BTC/ETH" 118 119 #0044-LIME-066, When LP decreases its commitment so that , then the entire amount by which they decreased their commitment is transferred to their general account, their ELS got updated as per the ELS calculation 120 When the parties submit the following liquidity provision: 121 | id | party | market id | commitment amount | fee | lp type | error | 122 | lp1 | lpprov1 | BTC/ETH | 1800 | 0.1 | amendment | | 123 Then the network moves ahead "2" blocks 124 Then the party "lpprov1" lp liquidity bond account balance should be "1800" for the market "BTC/ETH" 125 And the parties should have the following account balances: 126 | party | asset | market id | general | 127 | lpprov1 | BTC | BTC/ETH | 0 | 128 | lpprov1 | ETH | BTC/ETH | 1720 | 129 130 Then the network moves ahead "2" blocks 131 132 #0044-LIME-068,When LP decreases its commitment so that its commitment_variation > max_penalty_free_reduction_amount 133 When the parties submit the following liquidity provision: 134 | id | party | market id | commitment amount | fee | lp type | error | 135 | lp1 | lpprov1 | BTC/ETH | 20 | 0.1 | amendment | | 136 137 #0044-LIME-072, When an LP amends the Fee Factor to a value greater than market.liquidity.maximumLiquidityFeeFactorLevel, the amendments are rejected 138 When the parties submit the following liquidity provision: 139 | id | party | market id | commitment amount | fee | lp type | error | 140 | lp1 | lpprov1 | BTC/ETH | 20 | 0.9 | amendment | invalid liquidity provision fee | 141 142 Then the network moves ahead "7" blocks 143 Then the market data for the market "BTC/ETH" should be: 144 | mark price | trading mode | auction trigger | target stake | supplied stake | 145 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 3200 | 2020 | 146 147 # place orders and generate trades to trigger liquidity fee 148 And the parties place the following orders: 149 | party | market id | side | volume | price | resulting trades | type | tif | reference | only | 150 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | | | 151 | party2 | BTC/ETH | sell | 1 | 15 | 1 | TYPE_LIMIT | TIF_GTC | | | 152 153 Then the network moves ahead "2" blocks 154 And the network treasury balance should be "295" for the asset "ETH" 155 156 And the party "lpprov1" lp liquidity fee account balance should be "7" for the market "BTC/ETH" 157 And the party "lpprov2" lp liquidity fee account balance should be "7" for the market "BTC/ETH" 158 159 Then "lpprov1" should have holding account balance of "480" for asset "ETH" 160 Then "lpprov1" should have holding account balance of "60" for asset "BTC" 161 162 Then the party "lpprov1" lp liquidity bond account balance should be "20" for the market "BTC/ETH" 163 164 Then the market data for the market "BTC/ETH" should be: 165 | mark price | trading mode | auction trigger | target stake | supplied stake | 166 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 3200 | 2020 | 167 168 When the parties submit the following liquidity provision: 169 | id | party | market id | commitment amount | fee | lp type | 170 | lp1 | lpprov1 | BTC/ETH | 1 | 0.1 | amendment | 171 172 Then the network moves ahead "7" blocks 173 174 And the network treasury balance should be "299" for the asset "ETH" 175 176 And the party "lpprov1" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 177 And the party "lpprov2" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 178 Then "lpprov1" should have holding account balance of "480" for asset "ETH" 179 Then "lpprov1" should have holding account balance of "60" for asset "BTC" 180 181 Then the party "lpprov1" lp liquidity bond account balance should be "2" for the market "BTC/ETH" 182 183 184 185