code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0044-LIME-SLA_spot.feature (about) 1 Feature: Test LP mechanics when there are multiple liquidity providers; 2 3 Background: 4 5 Given the log normal risk model named "log-normal-risk-model": 6 | risk aversion | tau | mu | r | sigma | 7 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 8 #risk factor short:3.5569036 9 #risk factor long:0.801225765 10 And the following assets are registered: 11 | id | decimal places | 12 | ETH | 0 | 13 And the fees configuration named "fees-config-1": 14 | maker fee | infrastructure fee | 15 | 0.0004 | 0.001 | 16 And the price monitoring named "price-monitoring": 17 | horizon | probability | auction extension | 18 | 3600 | 0.99 | 40 | 19 20 And the liquidity sla params named "SLA": 21 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 22 | 0.05 | 1 | 1 | 1.0 | 23 24 And the liquidity monitoring parameters: 25 | name | triggering ratio | time window | scaling factor | 26 | lqm-params | 10 | 20s | 0.1 | 27 28 And the following network parameters are set: 29 | name | value | 30 | market.value.windowLength | 60s | 31 | network.markPriceUpdateMaximumFrequency | 0s | 32 | limits.markets.maxPeggedOrders | 6 | 33 | market.auction.minimumDuration | 1 | 34 | market.fee.factors.infrastructureFee | 0.001 | 35 | market.fee.factors.makerFee | 0.004 | 36 | market.liquidity.bondPenaltyParameter | 0.2 | 37 | validators.epoch.length | 5s | 38 | market.liquidity.stakeToCcyVolume | 1 | 39 | market.liquidity.successorLaunchWindowLength | 1h | 40 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.5 | 41 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 1 | 42 | validators.epoch.length | 10s | 43 | market.liquidity.providersFeeCalculationTimeStep | 10s | 44 Given the liquidity monitoring parameters: 45 | name | triggering ratio | time window | scaling factor | 46 | lqm-params | 0.5 | 20s | 1.0 | 47 48 And the spot markets: 49 | id | name | base asset | quote asset | liquidity monitoring | risk model | auction duration | fees | price monitoring | sla params | 50 | BTC/ETH | BTC/ETH | BTC | ETH | lqm-params | log-normal-risk-model | 2 | fees-config-1 | price-monitoring | SLA | 51 52 Given the average block duration is "2" 53 54 Scenario: An LP with orders inside valid range during auction isn't penalised (0044-LIME-116) 55 Given the parties deposit on asset's general account the following amount: 56 | party | asset | amount | 57 | lp1 | ETH | 20000000 | 58 | party1 | ETH | 1000000000 | 59 | party2 | ETH | 1000000000 | 60 | party3 | ETH | 1000000 | 61 | lp1 | BTC | 20000000 | 62 | party1 | BTC | 1000000000 | 63 | party2 | BTC | 1000000000 | 64 | party3 | BTC | 1000000 | 65 66 67 And the parties submit the following liquidity provision: 68 | id | party | market id | commitment amount | fee | lp type | 69 | lp_1 | lp1 | BTC/ETH | 180000 | 0.02 | submission | 70 71 When the network moves ahead "2" blocks 72 Then the parties place the following orders: 73 | party | market id | side | volume | price | resulting trades | type | tif | 74 | lp1 | BTC/ETH | buy | 100 | 4750 | 0 | TYPE_LIMIT | TIF_GTC | 75 | lp1 | BTC/ETH | sell | 100 | 5250 | 0 | TYPE_LIMIT | TIF_GTC | 76 | party1 | BTC/ETH | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 77 | party2 | BTC/ETH | sell | 10 | 5100 | 0 | TYPE_LIMIT | TIF_GTC | 78 | party2 | BTC/ETH | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 79 80 Then the opening auction period ends for market "BTC/ETH" 81 And the following trades should be executed: 82 | buyer | price | size | seller | 83 | party1 | 5000 | 1 | party2 | 84 85 And the market data for the market "BTC/ETH" should be: 86 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | 87 | 5000 | TRADING_MODE_CONTINUOUS | 3600 | 4865 | 5139 | 180000 | 180000 | 88 89 When the parties place the following orders: 90 | party | market id | side | volume | price | resulting trades | type | tif | 91 | party1 | BTC/ETH | buy | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 92 | party2 | BTC/ETH | sell | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 93 | party1 | BTC/ETH | buy | 10 | 4900 | 0 | TYPE_LIMIT | TIF_GTC | 94 95 Then the market data for the market "BTC/ETH" should be: 96 | mark price | trading mode | auction trigger | target stake | supplied stake | auction end | 97 | 5000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 180000 | 180000 | 40 | 98 99 When the network moves ahead "2" blocks 100 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 101 Then the market data for the market "BTC/ETH" should be: 102 | mark price | trading mode | target stake | supplied stake | 103 | 5000 | TRADING_MODE_MONITORING_AUCTION | 180000 | 180000 | 104 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 105 106 Then the parties place the following orders: 107 | party | market id | side | volume | price | resulting trades | type | tif | 108 | party1 | BTC/ETH | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 109 | party2 | BTC/ETH | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 110 111 When the network moves ahead "1" epochs 112 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 113 Then the parties should have the following account balances: 114 | party | asset | market id | general | bond | 115 | lp1 | ETH | BTC/ETH | 19340012 | 90000 | 116 117 When the network moves ahead "1" epochs 118 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 119 Then the parties should have the following account balances: 120 | party | asset | market id | general | bond | 121 | lp1 | ETH | BTC/ETH | 19340012 | 45000 | 122 123 Scenario: An LP with bid orders outside valid range during auction is penalised (0044-LIME-117) 124 Given the parties deposit on asset's general account the following amount: 125 | party | asset | amount | 126 | lp1 | ETH | 20000000 | 127 | party1 | ETH | 1000000000 | 128 | party2 | ETH | 1000000000 | 129 | party3 | ETH | 1000000 | 130 | lp1 | BTC | 20000000 | 131 | party1 | BTC | 1000000000 | 132 | party2 | BTC | 1000000000 | 133 | party3 | BTC | 1000000 | 134 135 And the parties submit the following liquidity provision: 136 | id | party | market id | commitment amount | fee | lp type | 137 | lp_1 | lp1 | BTC/ETH | 180000 | 0.02 | submission | 138 139 When the network moves ahead "2" blocks 140 Then the parties place the following orders: 141 | party | market id | side | volume | price | resulting trades | type | tif | 142 | lp1 | BTC/ETH | buy | 100 | 4740 | 0 | TYPE_LIMIT | TIF_GTC | 143 | lp1 | BTC/ETH | sell | 100 | 5250 | 0 | TYPE_LIMIT | TIF_GTC | 144 | party1 | BTC/ETH | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 145 | party2 | BTC/ETH | sell | 10 | 5100 | 0 | TYPE_LIMIT | TIF_GTC | 146 | party2 | BTC/ETH | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 147 148 Then the opening auction period ends for market "BTC/ETH" 149 And the following trades should be executed: 150 | buyer | price | size | seller | 151 | party1 | 5000 | 1 | party2 | 152 153 And the market data for the market "BTC/ETH" should be: 154 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | 155 | 5000 | TRADING_MODE_CONTINUOUS | 3600 | 4865 | 5139 | 180000 | 180000 | 156 157 When the parties place the following orders: 158 | party | market id | side | volume | price | resulting trades | type | tif | 159 | party1 | BTC/ETH | buy | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 160 | party2 | BTC/ETH | sell | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 161 | party1 | BTC/ETH | buy | 10 | 4900 | 0 | TYPE_LIMIT | TIF_GTC | 162 163 Then the market data for the market "BTC/ETH" should be: 164 | mark price | trading mode | auction trigger | target stake | supplied stake | auction end | 165 | 5000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 180000 | 180000 | 40 | 166 167 When the network moves ahead "2" blocks 168 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 169 170 Then the parties place the following orders: 171 | party | market id | side | volume | price | resulting trades | type | tif | 172 | party1 | BTC/ETH | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 173 | party2 | BTC/ETH | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 174 175 When the network moves ahead "1" epochs 176 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 177 Then the parties should have the following account balances: 178 | party | asset | market id | general | bond | 179 | lp1 | ETH | BTC/ETH | 19341023 | 90000 | 180 181 When the network moves ahead "2" epochs 182 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 183 Then the parties should have the following account balances: 184 | party | asset | market id | general | bond | 185 | lp1 | ETH | BTC/ETH | 19341023 | 22500 | 186 187 Scenario: An LP with ask orders outside valid range during auction is penalised (0044-LIME-118) 188 Given the parties deposit on asset's general account the following amount: 189 | party | asset | amount | 190 | lp1 | ETH | 20000000 | 191 | party1 | ETH | 1000000000 | 192 | party2 | ETH | 1000000000 | 193 | party3 | ETH | 1000000 | 194 | lp1 | BTC | 20000000 | 195 | party1 | BTC | 1000000000 | 196 | party2 | BTC | 1000000000 | 197 | party3 | BTC | 1000000 | 198 199 And the parties submit the following liquidity provision: 200 | id | party | market id | commitment amount | fee | lp type | 201 | lp_1 | lp1 | BTC/ETH | 180000 | 0.02 | submission | 202 203 When the network moves ahead "2" blocks 204 Then the parties place the following orders: 205 | party | market id | side | volume | price | resulting trades | type | tif | 206 | lp1 | BTC/ETH | buy | 100 | 4750 | 0 | TYPE_LIMIT | TIF_GTC | 207 | lp1 | BTC/ETH | sell | 100 | 5260 | 0 | TYPE_LIMIT | TIF_GTC | 208 | party1 | BTC/ETH | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 209 | party2 | BTC/ETH | sell | 10 | 5100 | 0 | TYPE_LIMIT | TIF_GTC | 210 | party2 | BTC/ETH | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 211 212 Then the opening auction period ends for market "BTC/ETH" 213 And the following trades should be executed: 214 | buyer | price | size | seller | 215 | party1 | 5000 | 1 | party2 | 216 217 And the market data for the market "BTC/ETH" should be: 218 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | 219 | 5000 | TRADING_MODE_CONTINUOUS | 3600 | 4865 | 5139 | 180000 | 180000 | 220 221 When the parties place the following orders: 222 | party | market id | side | volume | price | resulting trades | type | tif | 223 | party1 | BTC/ETH | buy | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 224 | party2 | BTC/ETH | sell | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 225 | party1 | BTC/ETH | buy | 10 | 4900 | 0 | TYPE_LIMIT | TIF_GTC | 226 227 Then the market data for the market "BTC/ETH" should be: 228 | mark price | trading mode | auction trigger | target stake | supplied stake | auction end | 229 | 5000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 180000 | 180000 | 40 | 230 231 Then the parties place the following orders: 232 | party | market id | side | volume | price | resulting trades | type | tif | 233 | party1 | BTC/ETH | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 234 | party2 | BTC/ETH | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 235 236 When the network moves ahead "1" epochs 237 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 238 Then the parties should have the following account balances: 239 | party | asset | market id | general | bond | 240 | lp1 | ETH | BTC/ETH | 19340012 | 90000 | 241 242 When the network moves ahead "2" epochs 243 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 244 Then the parties should have the following account balances: 245 | party | asset | market id | general | bond | 246 | lp1 | ETH | BTC/ETH | 19340012 | 22500 |