code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0044-LIME-SLA.feature (about) 1 Feature: Test LP mechanics when there are multiple liquidity providers; 2 3 Background: 4 5 Given the margin calculator named "margin-calculator-1": 6 | search factor | initial factor | release factor | 7 | 1.2 | 1.5 | 1.7 | 8 Given the log normal risk model named "log-normal-risk-model": 9 | risk aversion | tau | mu | r | sigma | 10 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 11 #risk factor short:3.5569036 12 #risk factor long:0.801225765 13 And the following assets are registered: 14 | id | decimal places | 15 | USD | 0 | 16 And the fees configuration named "fees-config-1": 17 | maker fee | infrastructure fee | 18 | 0.0004 | 0.001 | 19 And the price monitoring named "price-monitoring": 20 | horizon | probability | auction extension | 21 | 3600 | 0.99 | 40 | 22 23 And the liquidity sla params named "SLA": 24 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 25 | 0.00001 | 0.5 | 1 | 1.0 | 26 27 And the liquidity sla params named "SLA2": 28 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 29 | 0.5 | 0.5 | 1 | 1.0 | 30 31 And the liquidity sla params named "SLA3": 32 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 33 | 0.05 | 1 | 1 | 1.0 | 34 35 And the liquidity monitoring parameters: 36 | name | triggering ratio | time window | scaling factor | 37 | lqm-params | 10 | 20s | 0.1 | 38 39 And the following network parameters are set: 40 | name | value | 41 | market.value.windowLength | 60s | 42 | network.markPriceUpdateMaximumFrequency | 0s | 43 | limits.markets.maxPeggedOrders | 6 | 44 | market.auction.minimumDuration | 1 | 45 | market.fee.factors.infrastructureFee | 0.001 | 46 | market.fee.factors.makerFee | 0.004 | 47 | market.liquidity.bondPenaltyParameter | 0.2 | 48 | validators.epoch.length | 5s | 49 | market.liquidity.stakeToCcyVolume | 1 | 50 | market.liquidity.successorLaunchWindowLength | 1h | 51 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.5 | 52 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 1 | 53 | validators.epoch.length | 10s | 54 | market.liquidity.providersFeeCalculationTimeStep | 10s | 55 | market.liquidity.equityLikeShareFeeFraction | 1 | 56 57 Given the liquidity monitoring parameters: 58 | name | triggering ratio | time window | scaling factor | 59 | lqm-params | 0.5 | 20s | 1.0 | 60 61 And the markets: 62 | 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 | liquidity monitoring | 63 | ETH/MAR22 | USD | USD | lqm-params | log-normal-risk-model | margin-calculator-1 | 2 | fees-config-1 | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA | lqm-params | 64 | ETH/MAR23 | USD | USD | lqm-params | log-normal-risk-model | margin-calculator-1 | 2 | fees-config-1 | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA2 | lqm-params | 65 | ETH/JAN23 | USD | USD | lqm-params | log-normal-risk-model | margin-calculator-1 | 2 | fees-config-1 | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA3 | lqm-params | 66 67 Given the average block duration is "2" 68 @Now 69 Scenario: 001: lp1 and lp2 under supplies liquidity (and expects to get penalty for not meeting the SLA) since both have orders outside price range 70 Given the parties deposit on asset's general account the following amount: 71 | party | asset | amount | 72 | lp1 | USD | 200000 | 73 | lp2 | USD | 15000 | 74 | party1 | USD | 100000 | 75 | party2 | USD | 100000 | 76 | party3 | USD | 100000 | 77 78 And the parties submit the following liquidity provision: 79 | id | party | market id | commitment amount | fee | lp type | 80 | lp_1 | lp1 | ETH/MAR22 | 80000 | 0.02 | submission | 81 | lp_2 | lp2 | ETH/MAR22 | 500 | 0.01 | submission | 82 83 When the network moves ahead "2" blocks 84 And the parties place the following pegged iceberg orders: 85 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 86 | lp1 | ETH/MAR22 | 2 | 1 | buy | BID | 2 | 200 | lp-b-1 | 87 | lp1 | ETH/MAR22 | 2 | 1 | sell | ASK | 2 | 200 | lp-s-1 | 88 | lp2 | ETH/MAR22 | 2 | 1 | buy | BID | 2 | 200 | lp-b-2 | 89 | lp2 | ETH/MAR22 | 2 | 1 | sell | ASK | 2 | 200 | lp-s-2 | 90 91 Then the parties place the following orders: 92 | party | market id | side | volume | price | resulting trades | type | tif | 93 | party1 | ETH/MAR22 | buy | 10 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 94 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 95 | party2 | ETH/MAR22 | sell | 10 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 96 | party2 | ETH/MAR22 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 97 98 Then the opening auction period ends for market "ETH/MAR22" 99 And the following trades should be executed: 100 | buyer | price | size | seller | 101 | party1 | 1000 | 1 | party2 | 102 103 And the market data for the market "ETH/MAR22" should be: 104 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 105 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 973 | 1027 | 3556 | 80500 | 1 | 106 # # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 10 x 1 x 3.5569036 107 108 And the liquidity fee factor should be "0.02" for the market "ETH/MAR22" 109 110 And the parties should have the following account balances: 111 | party | asset | market id | margin | general | bond | 112 | lp1 | USD | ETH/MAR22 | 10671 | 109329 | 80000 | 113 | lp2 | USD | ETH/MAR22 | 10671 | 3829 | 500 | 114 #margin_intial lp2: 2*1000*3.5569036*1.5=10671 115 #lp1: 21342+98658+80000=200000; lp2: 10671+3829+500=15000 116 117 Then the parties place the following orders: 118 | party | market id | side | volume | price | resulting trades | type | tif | 119 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 120 | party2 | ETH/MAR22 | sell | 1 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 121 122 And the market data for the market "ETH/MAR22" should be: 123 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 124 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 973 | 1027 | 7113 | 80500 | 2 | 125 126 Then the network moves ahead "6" blocks 127 128 And the parties should have the following account balances: 129 | party | asset | market id | margin | general | bond | 130 | lp1 | USD | ETH/MAR22 | 10671 | 109329 | 40000 | 131 | lp2 | USD | ETH/MAR22 | 10671 | 3829 | 250 | 132 #liquidity fee: 1000*0.02 = 20; lp1 get 19, lp2 get 0 133 134 Then the following transfers should happen: 135 | from | to | from account | to account | market id | amount | asset | 136 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 19 | USD | 137 | lp1 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 40000 | USD | 138 | lp2 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 250 | USD | 139 | lp1 | market | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 19 | USD | 140 141 And the insurance pool balance should be "40269" for the market "ETH/MAR22" 142 143 Then the network moves ahead "6" blocks 144 145 And the parties should have the following account balances: 146 | party | asset | market id | margin | general | bond | 147 | lp1 | USD | ETH/MAR22 | 10671 | 109329 | 20000 | 148 | lp2 | USD | ETH/MAR22 | 10671 | 3829 | 125 | 149 150 And the insurance pool balance should be "60394" for the market "ETH/MAR22" 151 # #increament in insurancepool: 60394-40269=20125 which is coming from SLA penalty on lp1 and lp2 152 153 Scenario: An LP cancelled in one Epoch will receive no fees in the next even with orders still on-book (0044-LIME-097) 154 Given the parties deposit on asset's general account the following amount: 155 | party | asset | amount | 156 | lp1 | USD | 2000000 | 157 | lp2 | USD | 2000000 | 158 | party1 | USD | 100000 | 159 | party2 | USD | 100000 | 160 | party3 | USD | 100000 | 161 162 And the parties submit the following liquidity provision: 163 | id | party | market id | commitment amount | fee | lp type | 164 | lp_1 | lp1 | ETH/MAR23 | 50000 | 0.02 | submission | 165 166 When the network moves ahead "2" blocks 167 And the parties place the following pegged iceberg orders: 168 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 169 | lp1 | ETH/MAR23 | 2 | 1 | buy | BID | 100 | 0 | lp-b-1 | 170 | lp1 | ETH/MAR23 | 2 | 1 | sell | ASK | 100 | 0 | lp-s-1 | 171 172 Then the parties place the following orders: 173 | party | market id | side | volume | price | resulting trades | type | tif | 174 | party1 | ETH/MAR23 | buy | 10 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 175 | party1 | ETH/MAR23 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 176 | party2 | ETH/MAR23 | sell | 10 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 177 | party2 | ETH/MAR23 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 178 179 Then the opening auction period ends for market "ETH/MAR23" 180 And the following trades should be executed: 181 | buyer | price | size | seller | 182 | party1 | 1000 | 1 | party2 | 183 184 And the market data for the market "ETH/MAR23" should be: 185 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 186 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 973 | 1027 | 3556 | 50000 | 1 | 187 188 And the parties should have the following account balances: 189 | party | asset | market id | margin | general | bond | 190 | lp1 | USD | ETH/MAR23 | 533536 | 1416464 | 50000 | 191 192 Then the parties place the following orders: 193 | party | market id | side | volume | price | resulting trades | type | tif | 194 | party1 | ETH/MAR23 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 195 | party2 | ETH/MAR23 | sell | 1 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 196 197 And the network moves ahead "1" epochs 198 199 # LP is paid 200 And the parties should have the following account balances: 201 | party | asset | market id | margin | general | bond | 202 | lp1 | USD | ETH/MAR23 | 533536 | 1416484 | 50000 | 203 204 Then the parties submit the following liquidity provision: 205 | id | party | market id | commitment amount | fee | lp type | 206 | lp_2 | lp2 | ETH/MAR23 | 50000 | 0.02 | submission | 207 And the parties place the following pegged iceberg orders: 208 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 209 | lp2 | ETH/MAR23 | 2 | 1 | buy | BID | 100 | 0 | lp-b-2 | 210 | lp2 | ETH/MAR23 | 2 | 1 | sell | ASK | 100 | 0 | lp-s-2 | 211 212 And party "lp1" cancels their liquidity provision for market "ETH/MAR23" 213 214 Then the network moves ahead "1" epochs 215 And the parties should have the following account balances: 216 | party | asset | market id | margin | general | bond | 217 | lp1 | USD | ETH/MAR23 | 533536 | 1466484 | 0 | 218 | lp2 | USD | ETH/MAR23 | 533536 | 1416464 | 50000 | 219 220 Then the parties place the following orders: 221 | party | market id | side | volume | price | resulting trades | type | tif | 222 | party1 | ETH/MAR23 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 223 | party2 | ETH/MAR23 | buy | 1 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 224 225 Then the network moves ahead "1" epochs 226 And the parties should have the following account balances: 227 | party | asset | market id | margin | general | bond | 228 | lp1 | USD | ETH/MAR23 | 533536 | 1466484 | 0 | 229 | lp2 | USD | ETH/MAR23 | 533536 | 1416484 | 50000 | 230 231 Scenario: An LP with orders inside valid range during auction isn't penalised (0044-LIME-096) 232 Given the parties deposit on asset's general account the following amount: 233 | party | asset | amount | 234 | lp1 | USD | 20000000 | 235 | party1 | USD | 1000000000 | 236 | party2 | USD | 1000000000 | 237 | party3 | USD | 1000000 | 238 239 And the parties submit the following liquidity provision: 240 | id | party | market id | commitment amount | fee | lp type | 241 | lp_1 | lp1 | ETH/JAN23 | 180000 | 0.02 | submission | 242 243 When the network moves ahead "2" blocks 244 Then the parties place the following orders: 245 | party | market id | side | volume | price | resulting trades | type | tif | 246 | lp1 | ETH/JAN23 | buy | 100 | 4750 | 0 | TYPE_LIMIT | TIF_GTC | 247 | lp1 | ETH/JAN23 | sell | 100 | 5250 | 0 | TYPE_LIMIT | TIF_GTC | 248 | party1 | ETH/JAN23 | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 249 | party2 | ETH/JAN23 | sell | 10 | 5100 | 0 | TYPE_LIMIT | TIF_GTC | 250 | party2 | ETH/JAN23 | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 251 252 Then the opening auction period ends for market "ETH/JAN23" 253 And the following trades should be executed: 254 | buyer | price | size | seller | 255 | party1 | 5000 | 1 | party2 | 256 257 And the market data for the market "ETH/JAN23" should be: 258 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 259 | 5000 | TRADING_MODE_CONTINUOUS | 3600 | 4865 | 5139 | 17784 | 180000 | 1 | 260 261 When the parties place the following orders: 262 | party | market id | side | volume | price | resulting trades | type | tif | 263 | party1 | ETH/JAN23 | buy | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 264 | party2 | ETH/JAN23 | sell | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 265 | party1 | ETH/JAN23 | buy | 10 | 4900 | 0 | TYPE_LIMIT | TIF_GTC | 266 267 Then the market data for the market "ETH/JAN23" should be: 268 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | auction end | 269 | 5000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 34679 | 180000 | 1 | 40 | 270 271 When the network moves ahead "2" blocks 272 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 273 Then the market data for the market "ETH/JAN23" should be: 274 | mark price | trading mode | target stake | supplied stake | open interest | 275 | 5000 | TRADING_MODE_MONITORING_AUCTION | 34679 | 180000 | 1 | 276 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 277 278 Then the parties place the following orders: 279 | party | market id | side | volume | price | resulting trades | type | tif | 280 | party1 | ETH/JAN23 | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 281 | party2 | ETH/JAN23 | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 282 283 When the network moves ahead "1" epochs 284 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 285 Then the parties should have the following account balances: 286 | party | asset | market id | margin | general | bond | 287 | lp1 | USD | ETH/JAN23 | 2801062 | 17018938 | 90000 | 288 289 When the network moves ahead "1" epochs 290 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 291 Then the parties should have the following account balances: 292 | party | asset | market id | margin | general | bond | 293 | lp1 | USD | ETH/JAN23 | 2801062 | 17018938 | 45000 | 294 295 Scenario: An LP with bid orders outside valid range during auction is penalised (0044-LIME-098) 296 Given the parties deposit on asset's general account the following amount: 297 | party | asset | amount | 298 | lp1 | USD | 20000000 | 299 | party1 | USD | 1000000000 | 300 | party2 | USD | 1000000000 | 301 | party3 | USD | 1000000 | 302 303 And the parties submit the following liquidity provision: 304 | id | party | market id | commitment amount | fee | lp type | 305 | lp_1 | lp1 | ETH/JAN23 | 180000 | 0.02 | submission | 306 307 When the network moves ahead "2" blocks 308 Then the parties place the following orders: 309 | party | market id | side | volume | price | resulting trades | type | tif | 310 | lp1 | ETH/JAN23 | buy | 100 | 4740 | 0 | TYPE_LIMIT | TIF_GTC | 311 | lp1 | ETH/JAN23 | sell | 100 | 5250 | 0 | TYPE_LIMIT | TIF_GTC | 312 | party1 | ETH/JAN23 | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 313 | party2 | ETH/JAN23 | sell | 10 | 5100 | 0 | TYPE_LIMIT | TIF_GTC | 314 | party2 | ETH/JAN23 | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 315 316 Then the opening auction period ends for market "ETH/JAN23" 317 And the following trades should be executed: 318 | buyer | price | size | seller | 319 | party1 | 5000 | 1 | party2 | 320 321 And the market data for the market "ETH/JAN23" should be: 322 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 323 | 5000 | TRADING_MODE_CONTINUOUS | 3600 | 4865 | 5139 | 17784 | 180000 | 1 | 324 325 When the parties place the following orders: 326 | party | market id | side | volume | price | resulting trades | type | tif | 327 | party1 | ETH/JAN23 | buy | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 328 | party2 | ETH/JAN23 | sell | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 329 | party1 | ETH/JAN23 | buy | 10 | 4900 | 0 | TYPE_LIMIT | TIF_GTC | 330 331 Then the market data for the market "ETH/JAN23" should be: 332 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | auction end | 333 | 5000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 34679 | 180000 | 1 | 40 | 334 335 When the network moves ahead "2" blocks 336 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 337 338 Then the parties place the following orders: 339 | party | market id | side | volume | price | resulting trades | type | tif | 340 | party1 | ETH/JAN23 | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 341 | party2 | ETH/JAN23 | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 342 343 When the network moves ahead "1" epochs 344 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 345 Then the parties should have the following account balances: 346 | party | asset | market id | margin | general | bond | 347 | lp1 | USD | ETH/JAN23 | 2801062 | 17018938 | 90000 | 348 349 When the network moves ahead "2" epochs 350 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 351 Then the parties should have the following account balances: 352 | party | asset | market id | margin | general | bond | 353 | lp1 | USD | ETH/JAN23 | 2801062 | 17018938 | 22500 | 354 355 Scenario: An LP with ask orders outside valid range during auction is penalised (0044-LIME-099) 356 Given the parties deposit on asset's general account the following amount: 357 | party | asset | amount | 358 | lp1 | USD | 20000000 | 359 | party1 | USD | 1000000000 | 360 | party2 | USD | 1000000000 | 361 | party3 | USD | 1000000 | 362 363 And the parties submit the following liquidity provision: 364 | id | party | market id | commitment amount | fee | lp type | 365 | lp_1 | lp1 | ETH/JAN23 | 180000 | 0.02 | submission | 366 367 When the network moves ahead "2" blocks 368 Then the parties place the following orders: 369 | party | market id | side | volume | price | resulting trades | type | tif | 370 | lp1 | ETH/JAN23 | buy | 100 | 4750 | 0 | TYPE_LIMIT | TIF_GTC | 371 | lp1 | ETH/JAN23 | sell | 100 | 5260 | 0 | TYPE_LIMIT | TIF_GTC | 372 | party1 | ETH/JAN23 | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 373 | party2 | ETH/JAN23 | sell | 10 | 5100 | 0 | TYPE_LIMIT | TIF_GTC | 374 | party2 | ETH/JAN23 | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 375 376 Then the opening auction period ends for market "ETH/JAN23" 377 And the following trades should be executed: 378 | buyer | price | size | seller | 379 | party1 | 5000 | 1 | party2 | 380 381 And the market data for the market "ETH/JAN23" should be: 382 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 383 | 5000 | TRADING_MODE_CONTINUOUS | 3600 | 4865 | 5139 | 17784 | 180000 | 1 | 384 385 When the parties place the following orders: 386 | party | market id | side | volume | price | resulting trades | type | tif | 387 | party1 | ETH/JAN23 | buy | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 388 | party2 | ETH/JAN23 | sell | 1 | 4850 | 0 | TYPE_LIMIT | TIF_GTC | 389 | party1 | ETH/JAN23 | buy | 10 | 4900 | 0 | TYPE_LIMIT | TIF_GTC | 390 391 Then the market data for the market "ETH/JAN23" should be: 392 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | auction end | 393 | 5000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 34679 | 180000 | 1 | 40 | 394 395 Then the parties place the following orders: 396 | party | market id | side | volume | price | resulting trades | type | tif | 397 | party1 | ETH/JAN23 | buy | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 398 | party2 | ETH/JAN23 | sell | 1 | 5000 | 0 | TYPE_LIMIT | TIF_GTC | 399 400 When the network moves ahead "1" epochs 401 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 402 Then the parties should have the following account balances: 403 | party | asset | market id | margin | general | bond | 404 | lp1 | USD | ETH/JAN23 | 2806398 | 17013602 | 90000 | 405 406 When the network moves ahead "2" epochs 407 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/JAN23" 408 Then the parties should have the following account balances: 409 | party | asset | market id | margin | general | bond | 410 | lp1 | USD | ETH/JAN23 | 2806398 | 17013602 | 22500 | 411 412 @Now 413 Scenario: 001b: lp1 and lp2 under supplies liquidity (and expects to get penalty for not meeting the SLA) since both have orders outside price range, this time with half the fees paid based on score. 414 # half of the fees get paid based on score, the other half will be paid based on ELS. 415 Given the following network parameters are set: 416 | name | value | 417 | market.liquidity.equityLikeShareFeeFraction | 0.5 | 418 And the parties deposit on asset's general account the following amount: 419 | party | asset | amount | 420 | lp1 | USD | 200000 | 421 | lp2 | USD | 15000 | 422 | party1 | USD | 100000 | 423 | party2 | USD | 100000 | 424 | party3 | USD | 100000 | 425 426 And the parties submit the following liquidity provision: 427 | id | party | market id | commitment amount | fee | lp type | 428 | lp_1 | lp1 | ETH/MAR22 | 80000 | 0.02 | submission | 429 | lp_2 | lp2 | ETH/MAR22 | 500 | 0.01 | submission | 430 431 When the network moves ahead "2" blocks 432 And the parties place the following pegged iceberg orders: 433 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 434 | lp1 | ETH/MAR22 | 2 | 1 | buy | BID | 2 | 200 | lp-b-1 | 435 | lp1 | ETH/MAR22 | 2 | 1 | sell | ASK | 2 | 200 | lp-s-1 | 436 | lp2 | ETH/MAR22 | 2 | 1 | buy | BID | 2 | 200 | lp-b-2 | 437 | lp2 | ETH/MAR22 | 2 | 1 | sell | ASK | 2 | 200 | lp-s-2 | 438 439 Then the parties place the following orders: 440 | party | market id | side | volume | price | resulting trades | type | tif | 441 | party1 | ETH/MAR22 | buy | 10 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 442 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 443 | party2 | ETH/MAR22 | sell | 10 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 444 | party2 | ETH/MAR22 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 445 446 Then the opening auction period ends for market "ETH/MAR22" 447 And the following trades should be executed: 448 | buyer | price | size | seller | 449 | party1 | 1000 | 1 | party2 | 450 451 And the market data for the market "ETH/MAR22" should be: 452 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 453 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 973 | 1027 | 3556 | 80500 | 1 | 454 # # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 10 x 1 x 3.5569036 455 456 And the liquidity fee factor should be "0.02" for the market "ETH/MAR22" 457 458 And the parties should have the following account balances: 459 | party | asset | market id | margin | general | bond | 460 | lp1 | USD | ETH/MAR22 | 10671 | 109329 | 80000 | 461 | lp2 | USD | ETH/MAR22 | 10671 | 3829 | 500 | 462 #margin_intial lp2: 2*1000*3.5569036*1.5=10671 463 #lp1: 21342+98658+80000=200000; lp2: 10671+3829+500=15000 464 465 Then the parties place the following orders: 466 | party | market id | side | volume | price | resulting trades | type | tif | 467 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 468 | party2 | ETH/MAR22 | sell | 1 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 469 470 And the market data for the market "ETH/MAR22" should be: 471 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 472 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 973 | 1027 | 7113 | 80500 | 2 | 473 474 Then the network moves ahead "6" blocks 475 476 And the parties should have the following account balances: 477 | party | asset | market id | margin | general | bond | 478 | lp1 | USD | ETH/MAR22 | 10671 | 109329 | 40000 | 479 | lp2 | USD | ETH/MAR22 | 10671 | 3829 | 250 | 480 #liquidity fee: 1000*0.02 = 20; lp1 get 19, lp2 get 0 481 482 Then the following transfers should happen: 483 | from | to | from account | to account | market id | amount | asset | 484 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 14 | USD | 485 | lp1 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 40000 | USD | 486 | lp2 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 250 | USD | 487 | lp1 | market | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 14 | USD | 488 489 And the insurance pool balance should be "40269" for the market "ETH/MAR22" 490 491 Then the network moves ahead "6" blocks 492 493 And the parties should have the following account balances: 494 | party | asset | market id | margin | general | bond | 495 | lp1 | USD | ETH/MAR22 | 10671 | 109329 | 20000 | 496 | lp2 | USD | ETH/MAR22 | 10671 | 3829 | 125 | 497 498 And the insurance pool balance should be "60394" for the market "ETH/MAR22" 499 # #increament in insurancepool: 60394-40269=20125 which is coming from SLA penalty on lp1 and lp2 500 501