code.vegaprotocol.io/vega@v0.79.0/core/integration/features/fees/setting-fee-and-rewarding-lps.feature (about) 1 Feature: Test liquidity provider reward distribution 2 3 # Spec file: ../spec/0042-setting-fees-and-rewarding-lps.md 4 5 Background: 6 Given the simple risk model named "simple-risk-model-1": 7 | long | short | max move up | min move down | probability of trading | 8 | 0.1 | 0.1 | 500 | 500 | 0.1 | 9 And the liquidity monitoring parameters: 10 | name | triggering ratio | time window | scaling factor | 11 | lqm-params | 0.00 | 24h | 1 | 12 13 And the following network parameters are set: 14 | name | value | 15 | market.value.windowLength | 1h | 16 | network.markPriceUpdateMaximumFrequency | 1s | 17 | network.markPriceUpdateMaximumFrequency | 0s | 18 | limits.markets.maxPeggedOrders | 612 | 19 | market.liquidity.equityLikeShareFeeFraction | 1 | 20 And the log normal risk model named "lognormal-risk-model-1": 21 | risk aversion | tau | mu | r | sigma | 22 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 23 And the fees configuration named "fees-config-1": 24 | maker fee | infrastructure fee | 25 | 0.0004 | 0.001 | 26 And the price monitoring named "price-monitoring-1": 27 | horizon | probability | auction extension | 28 | 1 | 0.99 | 3 | 29 And the price monitoring named "price-monitoring-2": 30 | horizon | probability | auction extension | 31 | 10000 | 0.9999999 | 3 | 32 And the oracle spec for settlement data filtering data from "0xCAFECAFE" named "ethDec21Oracle": 33 | property | type | binding | 34 | prices.ETH.value | TYPE_INTEGER | settlement data | 35 And the oracle spec for trading termination filtering data from "0xCAFECAFE" named "ethDec21Oracle": 36 | property | type | binding | 37 | trading.terminated | TYPE_BOOLEAN | trading termination | 38 39 And the liquidity sla params named "SLA": 40 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 41 | 1.0 | 0.5 | 1 | 1.0 | 42 43 And the markets: 44 | 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 | 45 | ETH/DEC21 | ETH | ETH | lqm-params | simple-risk-model-1 | default-margin-calculator | 2 | fees-config-1 | price-monitoring-1 | ethDec21Oracle | 1e0 | 1e0 | SLA | 46 | ETH/DEC22 | ETH | ETH | lqm-params | lognormal-risk-model-1 | default-margin-calculator | 2 | fees-config-1 | price-monitoring-2 | ethDec21Oracle | 1e0 | 1e0 | SLA | 47 And the following network parameters are set: 48 | name | value | 49 | market.liquidity.providersFeeCalculationTimeStep | 600s | 50 And the average block duration is "1" 51 52 Scenario: 001, 1 LP joining at start, checking liquidity rewards over 3 periods, 1 period with no trades 53 # setup accounts 54 Given the parties deposit on asset's general account the following amount: 55 | party | asset | amount | 56 | lp1 | ETH | 1000000000 | 57 | party1 | ETH | 100000000 | 58 | party2 | ETH | 100000000 | 59 60 And the parties submit the following liquidity provision: 61 | id | party | market id | commitment amount | fee | lp type | 62 | lp1 | lp1 | ETH/DEC21 | 10000 | 0.001 | submission | 63 | lp1 | lp1 | ETH/DEC21 | 10000 | 0.001 | amendment | 64 | lp1 | lp1 | ETH/DEC21 | 10000 | 0.001 | amendment | 65 | lp1 | lp1 | ETH/DEC21 | 10000 | 0.001 | amendment | 66 And the parties place the following pegged iceberg orders: 67 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 68 | lp1 | ETH/DEC21 | 15 | 10 | buy | BID | 30 | 2 | 69 | lp1 | ETH/DEC21 | 15 | 10 | buy | MID | 30 | 1 | 70 | lp1 | ETH/DEC21 | 15 | 10 | sell | ASK | 30 | 2 | 71 | lp1 | ETH/DEC21 | 15 | 10 | sell | MID | 30 | 1 | 72 Then the parties place the following orders: 73 | party | market id | side | volume | price | resulting trades | type | tif | 74 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 75 | party1 | ETH/DEC21 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 76 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 77 | party2 | ETH/DEC21 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 78 79 Then the opening auction period ends for market "ETH/DEC21" 80 81 And the following trades should be executed: 82 | buyer | price | size | seller | 83 | party1 | 1000 | 10 | party2 | 84 85 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 86 And the mark price should be "1000" for the market "ETH/DEC21" 87 And the open interest should be "10" for the market "ETH/DEC21" 88 And the target stake should be "1000" for the market "ETH/DEC21" 89 And the supplied stake should be "10000" for the market "ETH/DEC21" 90 91 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 92 | party | equity like share | average entry valuation | 93 | lp1 | 1 | 10000 | 94 95 Then the network moves ahead "1" blocks 96 97 And the price monitoring bounds for the market "ETH/DEC21" should be: 98 | min bound | max bound | 99 | 500 | 1500 | 100 101 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 102 103 Then the parties place the following orders with ticks: 104 | party | market id | side | volume | price | resulting trades | type | tif | reference | 105 | party1 | ETH/DEC21 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 106 | party2 | ETH/DEC21 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 107 108 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 109 And the accumulated liquidity fees should be "20" for the market "ETH/DEC21" 110 111 # opening auction + time window 112 Then time is updated to "2019-11-30T00:10:05Z" 113 114 Then the following transfers should happen: 115 | from | to | from account | to account | market id | amount | asset | 116 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 20 | ETH | 117 118 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 119 120 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 121 Then time is updated to "2019-11-30T00:20:05Z" 122 123 When the parties place the following orders: 124 | party | market id | side | volume | price | resulting trades | type | tif | reference | 125 | party1 | ETH/DEC21 | buy | 8 | 1100 | 1 | TYPE_LIMIT | TIF_GTC | party1-buy | 126 # | party2 | ETH/DEC21 | sell | 40 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | party2-sell | 127 128 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 129 130 # this is slightly different than expected, as the trades happen against the LP, 131 # which is probably not what you expected initially 132 And the accumulated liquidity fees should be "8" for the market "ETH/DEC21" 133 134 # opening auction + time window 135 Then time is updated to "2019-11-30T00:30:05Z" 136 137 Then the following transfers should happen: 138 | from | to | from account | to account | market id | amount | asset | 139 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 8 | ETH | 140 141 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 142 143 144 Scenario: 002, 2 LPs joining at start, equal commitments 145 146 Given the parties deposit on asset's general account the following amount: 147 | party | asset | amount | 148 | lp1 | ETH | 1000000000 | 149 | lp2 | ETH | 1000000000 | 150 | party1 | ETH | 100000000 | 151 | party2 | ETH | 100000000 | 152 153 And the parties submit the following liquidity provision: 154 | id | party | market id | commitment amount | fee | lp type | 155 | lp1 | lp1 | ETH/DEC21 | 5000 | 0.001 | submission | 156 | lp1 | lp1 | ETH/DEC21 | 5000 | 0.001 | amendment | 157 | lp1 | lp1 | ETH/DEC21 | 5000 | 0.001 | amendment | 158 | lp1 | lp1 | ETH/DEC21 | 5000 | 0.001 | amendment | 159 And the parties place the following pegged iceberg orders: 160 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 161 | lp1 | ETH/DEC21 | 20 | 15 | buy | BID | 100 | 2 | 162 | lp1 | ETH/DEC21 | 20 | 15 | buy | MID | 200 | 1 | 163 | lp1 | ETH/DEC21 | 20 | 15 | sell | ASK | 100 | 2 | 164 | lp1 | ETH/DEC21 | 20 | 15 | sell | MID | 100 | 1 | 165 And the parties submit the following liquidity provision: 166 | id | party | market id | commitment amount | fee | lp type | 167 | lp2 | lp2 | ETH/DEC21 | 5000 | 0.002 | submission | 168 | lp2 | lp2 | ETH/DEC21 | 5000 | 0.002 | amendment | 169 | lp2 | lp2 | ETH/DEC21 | 5000 | 0.002 | amendment | 170 | lp2 | lp2 | ETH/DEC21 | 5000 | 0.002 | amendment | 171 And the parties place the following pegged iceberg orders: 172 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 173 | lp2 | ETH/DEC21 | 20 | 15 | buy | BID | 100 | 2 | 174 | lp2 | ETH/DEC21 | 20 | 15 | buy | MID | 100 | 1 | 175 | lp2 | ETH/DEC21 | 20 | 15 | sell | ASK | 100 | 2 | 176 | lp2 | ETH/DEC21 | 20 | 15 | sell | MID | 100 | 1 | 177 Then the parties place the following orders: 178 | party | market id | side | volume | price | resulting trades | type | tif | 179 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 180 | party1 | ETH/DEC21 | buy | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 181 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 182 | party2 | ETH/DEC21 | sell | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 183 184 Then the opening auction period ends for market "ETH/DEC21" 185 186 And the following trades should be executed: 187 | buyer | price | size | seller | 188 | party1 | 1000 | 90 | party2 | 189 190 191 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 192 And the mark price should be "1000" for the market "ETH/DEC21" 193 And the open interest should be "90" for the market "ETH/DEC21" 194 And the target stake should be "9000" for the market "ETH/DEC21" 195 And the supplied stake should be "10000" for the market "ETH/DEC21" 196 197 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 198 | party | equity like share | average entry valuation | 199 | lp1 | 0.5 | 5000 | 200 | lp2 | 0.5 | 10000 | 201 202 And the price monitoring bounds for the market "ETH/DEC21" should be: 203 | min bound | max bound | 204 | 500 | 1500 | 205 206 And the liquidity fee factor should be "0.002" for the market "ETH/DEC21" 207 208 # no fees in auction 209 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 210 211 Then the parties place the following orders: 212 | party | market id | side | volume | price | resulting trades | type | tif | reference | 213 | party1 | ETH/DEC21 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 214 | party2 | ETH/DEC21 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 215 216 And the accumulated liquidity fees should be "39" for the market "ETH/DEC21" 217 218 # opening auction + time window 219 Then time is updated to "2019-11-30T00:10:05Z" 220 221 # these are different from the tests, but again, we end up with a 2/3 vs 1/3 fee share here. 222 Then the following transfers should happen: 223 | from | to | from account | to account | market id | amount | asset | 224 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 19 | ETH | 225 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 19 | ETH | 226 227 228 Then the parties place the following orders: 229 | party | market id | side | volume | price | resulting trades | type | tif | reference | 230 | party1 | ETH/DEC21 | buy | 40 | 1100 | 2 | TYPE_LIMIT | TIF_GTC | party1-buy | 231 | party2 | ETH/DEC21 | sell | 40 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | party2-sell | 232 233 And the accumulated liquidity fees should be "79" for the market "ETH/DEC21" 234 235 # opening auction + time window 236 Then time is updated to "2019-11-30T00:20:08Z" 237 238 Then the following transfers should happen: 239 | from | to | from account | to account | market id | amount | asset | 240 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 39 | ETH | 241 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 39 | ETH | 242 243 @FeeRound 244 Scenario: 003, 2 LPs joining at start, equal commitments, unequal offsets 245 Given the following network parameters are set: 246 | name | value | 247 | limits.markets.maxPeggedOrders | 10 | 248 | market.liquidity.providersFeeCalculationTimeStep | 5s | 249 And the liquidity sla params named "updated-SLA": 250 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 251 | 1.0 | 0.5 | 1 | 1.0 | 252 And the markets are updated: 253 | id | sla params | linear slippage factor | quadratic slippage factor | 254 | ETH/DEC22 | updated-SLA | 1e0 | 1e0 | 255 And the parties deposit on asset's general account the following amount: 256 | party | asset | amount | 257 | lp1 | ETH | 100000000000 | 258 | lp2 | ETH | 100000000000 | 259 | party1 | ETH | 100000000 | 260 | party2 | ETH | 100000000 | 261 And the parties submit the following liquidity provision: 262 | id | party | market id | commitment amount | fee | lp type | 263 | lp1 | lp1 | ETH/DEC22 | 40000 | 0.001 | submission | 264 | lp1 | lp1 | ETH/DEC22 | 40000 | 0.001 | | 265 | lp2 | lp2 | ETH/DEC22 | 40000 | 0.002 | submission | 266 | lp2 | lp2 | ETH/DEC22 | 40000 | 0.002 | | 267 And the parties place the following pegged iceberg orders: 268 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 269 | lp1 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 32 | lp1-bids-1 | 270 | lp1 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 32 | lp1-asks-1 | 271 | lp2 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 102 | lp2-bids-1 | 272 | lp2 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 102 | lp2-asks-1 | 273 When the parties place the following orders: 274 | party | market id | side | volume | price | resulting trades | type | tif | 275 | party1 | ETH/DEC22 | buy | 1 | 995 | 0 | TYPE_LIMIT | TIF_GTC | 276 | party1 | ETH/DEC22 | buy | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 277 | party2 | ETH/DEC22 | sell | 1 | 1005 | 0 | TYPE_LIMIT | TIF_GTC | 278 | party2 | ETH/DEC22 | sell | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 279 And the opening auction period ends for market "ETH/DEC22" 280 Then the market data for the market "ETH/DEC22" should be: 281 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price | 282 | 1000 | TRADING_MODE_CONTINUOUS | 10000 | 893 | 1120 | 43908 | 80000 | 90 | 995 | 1000 | 1005 | 283 And the following trades should be executed: 284 | buyer | price | size | seller | 285 | party1 | 1000 | 90 | party2 | 286 And the liquidity provider fee shares for the market "ETH/DEC22" should be: 287 | party | equity like share | average entry valuation | 288 | lp1 | 0.5 | 40000 | 289 | lp2 | 0.5 | 80000 | 290 And the liquidity fee factor should be "0.002" for the market "ETH/DEC22" 291 # no fees in auction 292 And the accumulated liquidity fees should be "0" for the market "ETH/DEC22" 293 294 When the parties place the following orders: 295 | party | market id | side | volume | price | resulting trades | type | tif | 296 | party1 | ETH/DEC22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 297 | party2 | ETH/DEC22 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 298 Then the accumulated liquidity fees should be "40" for the market "ETH/DEC22" 299 300 When the network moves ahead "6" blocks 301 302 Then the accumulated liquidity fees should be "1" for the market "ETH/DEC22" 303 304 305 # observe that lp2 gets lower share of the fees despite the same commitment amount (that is due to their orders being much wider than those of lp1) 306 Then the following transfers should happen: 307 | from | to | from account | to account | market id | amount | asset | 308 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 26 | ETH | 309 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 13 | ETH | 310 311 # modify lp2 orders so that they fall outside the price monitoring bounds 312 And the parties place the following pegged iceberg orders: 313 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 314 | lp2 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 116 | lp2-bids-2 | 315 | lp2 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 116 | lp2-asks-2 | 316 And the parties cancel the following orders: 317 | party | reference | 318 | lp2 | lp2-bids-1 | 319 | lp2 | lp2-asks-1 | 320 And the market data for the market "ETH/DEC22" should be: 321 | mark price | trading mode | horizon | min bound | max bound | best static bid price | static mid price | best static offer price | 322 | 1000 | TRADING_MODE_CONTINUOUS | 10000 | 893 | 1120 | 995 | 1000 | 1005 | 323 And the accumulated liquidity fees should be "1" for the market "ETH/DEC22" 324 325 326 327 And the parties place the following orders: 328 | party | market id | side | volume | price | resulting trades | type | tif | 329 | party2 | ETH/DEC22 | buy | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 330 | party1 | ETH/DEC22 | sell | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 331 Then the accumulated liquidity fees should be "41" for the market "ETH/DEC22" 332 333 When the network moves ahead "6" blocks 334 335 # all the fees go to lp2 336 Then the following transfers should happen: 337 | from | to | from account | to account | market id | amount | asset | 338 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 41 | ETH | 339 # zero fee shares are filtered out now, so no transfer events are generated 340 #| market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 0 | ETH | 341 342 # lp2 manually adds some limit orders within PM range, observe automatically deployed orders go down and fee share go up 343 When clear all events 344 And the parties place the following orders: 345 | party | market id | side | volume | price | resulting trades | type | tif | 346 | lp2 | ETH/DEC22 | buy | 100 | 995 | 0 | TYPE_LIMIT | TIF_GTC | 347 | lp2 | ETH/DEC22 | sell | 100 | 1005 | 0 | TYPE_LIMIT | TIF_GTC | 348 349 350 When the parties place the following orders: 351 | party | market id | side | volume | price | resulting trades | type | tif | 352 | party2 | ETH/DEC22 | buy | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 353 | party1 | ETH/DEC22 | sell | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 354 Then the accumulated liquidity fees should be "40" for the market "ETH/DEC22" 355 356 When the network moves ahead "6" blocks 357 # lp2 has increased their liquidity score by placing limit orders closer to the mid (and within price monitoring bounds), 358 # hence their fee share is larger (and no longer 0) now. 359 # 0034-PROB-005 360 Then the following transfers should happen: 361 | from | to | from account | to account | market id | amount | asset | 362 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 24 | ETH | 363 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 15 | ETH | 364 365 # lp2 manually adds some pegged orders within PM range, liquidity obligation is now fullfiled by limit and pegged orders so no automatic order deployment takes place 366 And the parties place the following pegged iceberg orders: 367 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 368 | lp2 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 1 | lp2-bids-3 | 369 | lp2 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 1 | lp2-asks-3 | 370 371 When the parties place the following orders: 372 | party | market id | side | volume | price | resulting trades | type | tif | 373 | party2 | ETH/DEC22 | buy | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 374 | party1 | ETH/DEC22 | sell | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 375 Then the accumulated liquidity fees should be "41" for the market "ETH/DEC22" 376 377 When the network moves ahead "6" blocks 378 # lp2 has increased their liquidity score by placing pegged orders closer to the mid (and within price monitoring bounds), 379 # hence their fee share is larger now. 380 Then the following transfers should happen: 381 | from | to | from account | to account | market id | amount | asset | 382 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 22 | ETH | 383 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 18 | ETH | 384 385 @FeeRound 386 Scenario: 004, 2 LPs joining at start, unequal commitments 387 388 Given the parties deposit on asset's general account the following amount: 389 | party | asset | amount | 390 | lp1 | ETH | 1000000000 | 391 | lp2 | ETH | 1000000000 | 392 | party1 | ETH | 100000000 | 393 | party2 | ETH | 100000000 | 394 395 And the parties submit the following liquidity provision: 396 | id | party | market id | commitment amount | fee | lp type | 397 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 398 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 399 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 400 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 401 And the parties place the following pegged iceberg orders: 402 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 403 | lp1 | ETH/DEC21 | 100 | 1 | buy | BID | 200 | 2 | 404 | lp1 | ETH/DEC21 | 100 | 1 | sell | ASK | 200 | 2 | 405 And the parties submit the following liquidity provision: 406 | id | party | market id | commitment amount | fee | lp type | 407 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 408 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 409 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 410 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 411 And the parties place the following pegged iceberg orders: 412 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 413 | lp2 | ETH/DEC21 | 100 | 1 | buy | BID | 200 | 2 | 414 | lp2 | ETH/DEC21 | 100 | 1 | sell | ASK | 200 | 2 | 415 Then the parties place the following orders: 416 | party | market id | side | volume | price | resulting trades | type | tif | 417 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 418 | party1 | ETH/DEC21 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 419 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 420 | party2 | ETH/DEC21 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 421 422 Then the opening auction period ends for market "ETH/DEC21" 423 424 And the following trades should be executed: 425 | buyer | price | size | seller | 426 | party1 | 1000 | 60 | party2 | 427 428 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 429 And the mark price should be "1000" for the market "ETH/DEC21" 430 And the open interest should be "60" for the market "ETH/DEC21" 431 And the target stake should be "6000" for the market "ETH/DEC21" 432 And the supplied stake should be "10000" for the market "ETH/DEC21" 433 434 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 435 | party | equity like share | average entry valuation | 436 | lp1 | 0.8 | 8000 | 437 | lp2 | 0.2 | 10000 | 438 439 And the price monitoring bounds for the market "ETH/DEC21" should be: 440 | min bound | max bound | 441 | 500 | 1500 | 442 443 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 444 445 # no fees in auction 446 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 447 448 Then the parties place the following orders: 449 | party | market id | side | volume | price | resulting trades | type | tif | reference | 450 | party1 | ETH/DEC21 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 451 | party2 | ETH/DEC21 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 452 453 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 454 455 And the following trades should be executed: 456 | buyer | price | size | seller | 457 | party2 | 1000 | 20 | party1 | 458 459 And the accumulated liquidity fees should be "20" for the market "ETH/DEC21" 460 # opening auction + time window 461 Then time is updated to "2019-11-30T00:10:05Z" 462 463 # these are different from the tests, but again, we end up with a 2/3 vs 1/3 fee share here. 464 Then the following transfers should happen: 465 | from | to | from account | to account | market id | amount | asset | 466 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 16 | ETH | 467 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 4 | ETH | 468 469 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 470 471 Then the parties place the following orders: 472 | party | market id | side | volume | price | resulting trades | type | tif | reference | 473 | party1 | ETH/DEC21 | buy | 40 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-buy | 474 | party2 | ETH/DEC21 | sell | 40 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-sell | 475 476 And the following trades should be executed: 477 | buyer | price | size | seller | 478 | party1 | 1000 | 40 | party2 | 479 480 And the accumulated liquidity fees should be "40" for the market "ETH/DEC21" 481 482 # opening auction + time window 483 Then time is updated to "2019-11-30T00:20:06Z" 484 485 # these are different from the tests, but again, we end up with a 2/3 vs 1/3 fee share here. 486 Then the following transfers should happen: 487 | from | to | from account | to account | market id | amount | asset | 488 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 32 | ETH | 489 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 8 | ETH | 490 491 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 492 493 @FeeRound 494 Scenario: 005, 2 LPs joining at start, unequal commitments, 1 LP lp3 joining later, and 4 LPs lp4/5/6/7 with large commitment and low/high fee joins later (0042-LIQF-032) 495 496 And the following network parameters are set: 497 | name | value | 498 | validators.epoch.length | 600s | 499 500 Given the parties deposit on asset's general account the following amount: 501 | party | asset | amount | 502 | lp1 | ETH | 100000000000 | 503 | lp2 | ETH | 100000000000 | 504 | lp3 | ETH | 100000000000 | 505 | lp4 | ETH | 100000000000 | 506 | lp5 | ETH | 100000000000 | 507 | lp6 | ETH | 100000000000 | 508 | lp7 | ETH | 100000000000 | 509 | party1 | ETH | 100000000000 | 510 | party2 | ETH | 100000000000 | 511 512 And the parties submit the following liquidity provision: 513 | id | party | market id | commitment amount | fee | lp type | 514 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 515 And the parties place the following pegged iceberg orders: 516 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 517 | lp1 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 518 | lp1 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 519 And the parties submit the following liquidity provision: 520 | id | party | market id | commitment amount | fee | lp type | 521 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 522 And the parties place the following pegged iceberg orders: 523 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 524 | lp2 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 525 | lp2 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 526 527 Then the parties place the following orders: 528 | party | market id | side | volume | price | resulting trades | type | tif | 529 | party1 | ETH/DEC21 | buy | 1000 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 530 | party1 | ETH/DEC21 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 531 | party2 | ETH/DEC21 | sell | 1000 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 532 | party2 | ETH/DEC21 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 533 534 Then the opening auction period ends for market "ETH/DEC21" 535 536 And the following trades should be executed: 537 | buyer | price | size | seller | 538 | party1 | 1000 | 60 | party2 | 539 540 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 541 And the mark price should be "1000" for the market "ETH/DEC21" 542 And the open interest should be "60" for the market "ETH/DEC21" 543 And the target stake should be "6000" for the market "ETH/DEC21" 544 And the supplied stake should be "10000" for the market "ETH/DEC21" 545 546 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 547 | party | equity like share | average entry valuation | 548 | lp1 | 0.8 | 8000 | 549 | lp2 | 0.2 | 10000 | 550 551 And the price monitoring bounds for the market "ETH/DEC21" should be: 552 | min bound | max bound | 553 | 500 | 1500 | 554 555 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 556 557 # no fees in auction 558 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 559 560 561 Then the parties place the following orders: 562 | party | market id | side | volume | price | resulting trades | type | tif | reference | 563 | party1 | ETH/DEC21 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 564 | party2 | ETH/DEC21 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 565 566 And the following trades should be executed: 567 | buyer | price | size | seller | 568 | party2 | 1000 | 20 | party1 | 569 570 And the accumulated liquidity fees should be "20" for the market "ETH/DEC21" 571 572 # opening auction + time window 573 Then time is updated to "2019-11-30T00:10:05Z" 574 575 # these are different from the tests, but again, we end up with a 2/3 vs 1/3 fee share here. 576 Then the following transfers should happen: 577 | from | to | from account | to account | market id | amount | asset | 578 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 16 | ETH | 579 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 4 | ETH | 580 581 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 582 583 When time is updated to "2019-11-30T00:15:00Z" 584 And the parties submit the following liquidity provision: 585 | id | party | market id | commitment amount | fee | lp type | 586 | lp3 | lp3 | ETH/DEC21 | 10000 | 0.001 | submission | 587 And the parties place the following pegged iceberg orders: 588 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 589 | lp3 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 590 | lp3 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 591 Then the network moves ahead "1" blocks" 592 593 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 594 | party | equity like share | average entry valuation | 595 | lp1 | 0.4 | 8000 | 596 | lp2 | 0.1 | 10000 | 597 | lp3 | 0.5 | 20000 | 598 599 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 600 601 When time is updated to "2019-11-30T00:20:00Z" 602 Then the parties place the following orders: 603 | party | market id | side | volume | price | resulting trades | type | tif | 604 | party1 | ETH/DEC21 | buy | 16 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 605 | party2 | ETH/DEC21 | sell | 16 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 606 607 And the following trades should be executed: 608 | buyer | price | size | seller | 609 | party1 | 1000 | 16 | party2 | 610 611 And the accumulated liquidity fees should be "16" for the market "ETH/DEC21" 612 613 When time is updated to "2019-11-30T00:20:06Z" 614 # lp3 gets lower fee share than indicated by the ELS this fee round as it was later to deploy liquidity (so lower liquidity scores than others had) 615 Then the following transfers should happen: 616 | from | to | from account | to account | market id | amount | asset | 617 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 8 | ETH | 618 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 2 | ETH | 619 | market | lp3 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 5 | ETH | 620 621 And the accumulated liquidity fees should be "1" for the market "ETH/DEC21" 622 623 # make sure we're in the next time window now 624 When time is updated to "2019-11-30T00:30:07Z" 625 And the parties place the following orders: 626 | party | market id | side | volume | price | resulting trades | type | tif | 627 | party1 | ETH/DEC21 | buy | 16 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 628 | party2 | ETH/DEC21 | sell | 16 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 629 Then the accumulated liquidity fees should be "17" for the market "ETH/DEC21" 630 631 When time is updated to "2019-11-30T00:40:08Z" 632 Then the following transfers should happen: 633 | from | to | from account | to account | market id | amount | asset | 634 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 6 | ETH | 635 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 1 | ETH | 636 | market | lp3 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 8 | ETH | 637 And the accumulated liquidity fees should be "2" for the market "ETH/DEC21" 638 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 639 And the target stake should be "7200" for the market "ETH/DEC21" 640 And the supplied stake should be "20000" for the market "ETH/DEC21" 641 #AC 0042-LIQF-024:lp4 joining a market that is above the target stake with a commitment large enough to push one of two higher bids above the target stake, and a higher fee bid than the current fee: the fee doesn't change 642 And the parties submit the following liquidity provision: 643 | id | party | market id | commitment amount | fee | lp type | 644 | lp4 | lp4 | ETH/DEC21 | 20000 | 0.004 | submission | 645 And the parties place the following pegged iceberg orders: 646 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 647 | lp4 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 648 | lp4 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 649 Then the network moves ahead "2" blocks 650 When time is updated to "2019-11-30T00:50:09Z" 651 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 652 #AC 0042-LIQF-029: lp5 joining a market that is above the target stake with a sufficiently large commitment to push ALL higher bids above the target stake and a lower fee bid than the current fee: their fee is used 653 And the parties submit the following liquidity provision: 654 | id | party | market id | commitment amount | fee | lp type | 655 | lp5 | lp5 | ETH/DEC21 | 30000 | 0.0005 | submission | 656 And the parties place the following pegged iceberg orders: 657 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 658 | lp5 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 659 | lp5 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 660 Then the network moves ahead "2" blocks 661 When time is updated to "2019-11-30T01:00:10Z" 662 And the liquidity fee factor should be "0.0005" for the market "ETH/DEC21" 663 And the target stake should be "7200" for the market "ETH/DEC21" 664 And the supplied stake should be "70000" for the market "ETH/DEC21" 665 666 #AC 0042-LIQF-030: lp6 joining a market that is above the target stake with a commitment not large enough to push any higher bids above the target stake, and a lower fee bid than the current fee: the fee doesn't change 667 And the parties submit the following liquidity provision: 668 | id | party | market id | commitment amount | fee | lp type | 669 | lp6 | lp6 | ETH/DEC21 | 2000 | 0.0001 | submission | 670 | lp6 | lp6 | ETH/DEC21 | 2000 | 0.0001 | submission | 671 And the parties place the following pegged iceberg orders: 672 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 673 | lp6 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 674 | lp6 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 675 Then the network moves ahead "2" blocks 676 When time is updated to "2019-11-30T01:10:11Z" 677 And the liquidity fee factor should be "0.0005" for the market "ETH/DEC21" 678 679 @FeeRound 680 Scenario: 006, 2 LPs joining at start, unequal commitments, market settles (0042-LIQF-014) 681 682 Given the parties deposit on asset's general account the following amount: 683 | party | asset | amount | 684 | lp1 | ETH | 1000000000 | 685 | lp2 | ETH | 1000000000 | 686 | party1 | ETH | 100000000 | 687 | party2 | ETH | 100000000 | 688 689 And the parties submit the following liquidity provision: 690 | id | party | market id | commitment amount | fee | lp type | 691 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 692 And the parties place the following pegged iceberg orders: 693 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 694 | lp1 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 695 | lp1 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 696 And the parties submit the following liquidity provision: 697 | id | party | market id | commitment amount | fee | lp type | 698 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 699 And the parties place the following pegged iceberg orders: 700 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 701 | lp2 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 702 | lp2 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 703 704 Then the parties place the following orders: 705 | party | market id | side | volume | price | resulting trades | type | tif | 706 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 707 | party1 | ETH/DEC21 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 708 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 709 | party2 | ETH/DEC21 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 710 711 Then the opening auction period ends for market "ETH/DEC21" 712 713 # no fees in auction 714 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 715 716 Then the parties place the following orders: 717 | party | market id | side | volume | price | resulting trades | type | tif | reference | 718 | party1 | ETH/DEC21 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 719 | party2 | ETH/DEC21 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 720 721 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 722 723 And the following trades should be executed: 724 | buyer | price | size | seller | 725 | party2 | 1000 | 20 | party1 | 726 727 And the accumulated liquidity fees should be "20" for the market "ETH/DEC21" 728 729 # opening auction + time window 730 Then time is updated to "2019-11-30T00:10:05Z" 731 732 Then the following transfers should happen: 733 | from | to | from account | to account | market id | amount | asset | 734 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 16 | ETH | 735 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 4 | ETH | 736 737 738 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 739 740 Then the parties place the following orders: 741 | party | market id | side | volume | price | resulting trades | type | tif | reference | 742 | party1 | ETH/DEC21 | buy | 40 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-buy | 743 | party2 | ETH/DEC21 | sell | 40 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-sell | 744 745 And the following trades should be executed: 746 | buyer | price | size | seller | 747 | party1 | 1000 | 40 | party2 | 748 749 And the accumulated liquidity fees should be "40" for the market "ETH/DEC21" 750 751 When the oracles broadcast data signed with "0xCAFECAFE": 752 | name | value | 753 | trading.terminated | true | 754 Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21" 755 756 When the oracles broadcast data signed with "0xCAFECAFE": 757 | name | value | 758 | prices.ETH.value | 42 | 759 Then the market state should be "STATE_SETTLED" for the market "ETH/DEC21" 760 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 761 And the following transfers should happen: 762 | from | to | from account | to account | market id | amount | asset | 763 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 32 | ETH | 764 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 8 | ETH | 765 766 Scenario: 007, 2 LPs joining at start, unequal commitments, 1 leaves later (0042-LIQF-012) 767 768 Given the parties deposit on asset's general account the following amount: 769 | party | asset | amount | 770 | lp1 | ETH | 1000000000 | 771 | lp2 | ETH | 1000000000 | 772 | party1 | ETH | 100000000 | 773 | party2 | ETH | 100000000 | 774 775 And the parties submit the following liquidity provision: 776 | id | party | market id | commitment amount | fee | lp type | 777 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 778 And the parties place the following pegged iceberg orders: 779 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 780 | lp1 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 781 | lp1 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 782 And the parties submit the following liquidity provision: 783 | id | party | market id | commitment amount | fee | lp type | 784 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 785 And the parties place the following pegged iceberg orders: 786 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 787 | lp2 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 788 | lp2 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 789 Then the parties place the following orders: 790 | party | market id | side | volume | price | resulting trades | type | tif | 791 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 792 | party1 | ETH/DEC21 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 793 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 794 | party2 | ETH/DEC21 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 795 796 Then the opening auction period ends for market "ETH/DEC21" 797 798 And the following trades should be executed: 799 | buyer | price | size | seller | 800 | party1 | 1000 | 60 | party2 | 801 802 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 803 And the mark price should be "1000" for the market "ETH/DEC21" 804 And the open interest should be "60" for the market "ETH/DEC21" 805 And the target stake should be "6000" for the market "ETH/DEC21" 806 And the supplied stake should be "10000" for the market "ETH/DEC21" 807 808 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 809 | party | equity like share | average entry valuation | 810 | lp1 | 0.8 | 8000 | 811 | lp2 | 0.2 | 10000 | 812 813 And the price monitoring bounds for the market "ETH/DEC21" should be: 814 | min bound | max bound | 815 | 500 | 1500 | 816 817 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 818 819 # no fees in auction 820 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 821 822 Then the parties place the following orders: 823 | party | market id | side | volume | price | resulting trades | type | tif | reference | 824 | party1 | ETH/DEC21 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 825 | party2 | ETH/DEC21 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 826 827 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 828 829 And the following trades should be executed: 830 | buyer | price | size | seller | 831 | party2 | 1000 | 20 | party1 | 832 833 And the accumulated liquidity fees should be "20" for the market "ETH/DEC21" 834 # opening auction + time window 835 Then time is updated to "2019-11-30T00:10:05Z" 836 837 # these are different from the tests, but again, we end up with a 2/3 vs 1/3 fee share here. 838 Then the following transfers should happen: 839 | from | to | from account | to account | market id | amount | asset | 840 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 16 | ETH | 841 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 4 | ETH | 842 843 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 844 845 Then the parties place the following orders: 846 | party | market id | side | volume | price | resulting trades | type | tif | reference | 847 | party1 | ETH/DEC21 | buy | 40 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-buy | 848 | party2 | ETH/DEC21 | sell | 40 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-sell | 849 850 And the following trades should be executed: 851 | buyer | price | size | seller | 852 | party1 | 1000 | 40 | party2 | 853 854 And the accumulated liquidity fees should be "40" for the market "ETH/DEC21" 855 856 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 857 858 Then the liquidity provisions should have the following states: 859 | id | party | market | commitment amount | status | 860 | lp2 | lp2 | ETH/DEC21 | 2000 | STATUS_ACTIVE | 861 And the parties submit the following liquidity provision: 862 | id | party | market id | commitment amount | fee | lp type | 863 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | cancellation | 864 865 Then time is updated to "2019-11-30T00:20:06Z" 866 867 # now all the accumulated fees go to the remaining lp (as the other one cancelled their provision) 868 Then the following transfers should happen: 869 | from | to | from account | to account | market id | amount | asset | 870 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 32 | ETH | 871 872 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 873 874 Scenario: 008, 2 LPs joining at start, unequal commitments, 1 LP joins later , and 1 LP leave 875 876 Given the following network parameters are set: 877 | name | value | 878 | limits.markets.maxPeggedOrders | 10 | 879 | market.liquidity.providersFeeCalculationTimeStep | 1s | 880 | limits.markets.maxPeggedOrders | 612 | 881 # | validators.epoch.length | 1s | 882 883 Given the liquidity sla params named "updated-SLA": 884 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 885 | 1.0 | 0.0 | 1 | 0.0 | 886 And the markets are updated: 887 | id | sla params | linear slippage factor | quadratic slippage factor | 888 | ETH/DEC22 | updated-SLA | 1e0 | 1e0 | 889 890 Given the parties deposit on asset's general account the following amount: 891 | party | asset | amount | 892 | lp1 | ETH | 1000000000 | 893 | lp2 | ETH | 1000000000 | 894 | lp3 | ETH | 1000000000 | 895 | lp4 | ETH | 1000000000 | 896 | lp5 | ETH | 1000000000 | 897 | party1 | ETH | 100000000 | 898 | party2 | ETH | 100000000 | 899 900 And the parties submit the following liquidity provision: 901 | id | party | market id | commitment amount | fee | lp type | 902 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.002 | submission | 903 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.002 | submission | 904 And the parties place the following pegged iceberg orders: 905 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 906 | lp1 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 1 | 907 | lp1 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 1 | 908 And the parties submit the following liquidity provision: 909 | id | party | market id | commitment amount | fee | lp type | 910 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.001 | submission | 911 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.001 | submission | 912 And the parties place the following pegged iceberg orders: 913 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 914 | lp2 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 1 | 915 | lp2 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 1 | 916 Then the parties place the following orders: 917 | party | market id | side | volume | price | resulting trades | type | tif | 918 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 919 | party1 | ETH/DEC21 | buy | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 920 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 921 | party2 | ETH/DEC21 | sell | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 922 923 Then the opening auction period ends for market "ETH/DEC21" 924 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 925 And the target stake should be "9000" for the market "ETH/DEC21" 926 And the supplied stake should be "10000" for the market "ETH/DEC21" 927 And the liquidity fee factor should be "0.002" for the market "ETH/DEC21" 928 929 And the network moves ahead "1" blocks 930 931 And the parties submit the following liquidity provision: 932 | id | party | market id | commitment amount | fee | lp type | 933 | lp3 | lp3 | ETH/DEC21 | 9000 | 0.0015 | submission | 934 | lp3 | lp3 | ETH/DEC21 | 9000 | 0.0015 | submission | 935 And the parties place the following pegged iceberg orders: 936 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 937 | lp3 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 4 | 938 | lp3 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 4 | 939 And the network moves ahead "1" blocks 940 And the liquidity fee factor should be "0.0015" for the market "ETH/DEC21" 941 And the network moves ahead "10" blocks 942 943 And the target stake should be "9000" for the market "ETH/DEC21" 944 And the supplied stake should be "19000" for the market "ETH/DEC21" 945 946 #AC 0042-LIQF-025: lp3 leaves a market that is above target stake when their fee bid is currently being used: fee changes to fee bid by the LP who takes their place in the bidding order 947 And the parties submit the following liquidity provision: 948 | id | party | market id | commitment amount | fee | lp type | 949 | lp3 | lp3 | ETH/DEC21 | 9000 | 0.0015 | cancellation | 950 | lp3 | lp3 | ETH/DEC21 | 9000 | 0.0015 | cancellation | 951 And the network moves ahead "10" blocks 952 And the target stake should be "9000" for the market "ETH/DEC21" 953 And the supplied stake should be "10000" for the market "ETH/DEC21" 954 And the liquidity fee factor should be "0.002" for the market "ETH/DEC21" 955 956 Then the parties place the following orders: 957 | party | market id | side | volume | price | resulting trades | type | tif | 958 | party1 | ETH/DEC21 | buy | 30 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 959 | party2 | ETH/DEC21 | sell | 30 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 960 961 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 962 And the liquidity fee factor should be "0.002" for the market "ETH/DEC21" 963 And the network moves ahead "1" blocks 964 And the target stake should be "12000" for the market "ETH/DEC21" 965 And the supplied stake should be "10000" for the market "ETH/DEC21" 966 #AC 0042-LIQF-020: lp3 joining a market that is below the target stake with a lower fee bid than the current fee: fee doesn't change 967 And the parties submit the following liquidity provision: 968 | id | party | market id | commitment amount | fee | lp type | 969 | lp3 | lp3 | ETH/DEC21 | 1000 | 0.0001 | submission | 970 | lp3 | lp3 | ETH/DEC21 | 1000 | 0.0001 | submission | 971 And the parties place the following pegged iceberg orders: 972 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 973 | lp3 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 4 | 974 | lp3 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 4 | 975 And the liquidity fee factor should be "0.002" for the market "ETH/DEC21" 976 And the network moves ahead "1" blocks 977 And the target stake should be "12000" for the market "ETH/DEC21" 978 And the supplied stake should be "11000" for the market "ETH/DEC21" 979 980 #AC 0042-LIQF-019: lp3 joining a market that is below the target stake with a higher fee bid than the current fee: their fee is used 981 And the parties submit the following liquidity provision: 982 | id | party | market id | commitment amount | fee | lp type | 983 | lp3 | lp3 | ETH/DEC21 | 2000 | 0.003 | amendment | 984 | lp3 | lp3 | ETH/DEC21 | 2000 | 0.003 | amendment | 985 And the parties place the following pegged iceberg orders: 986 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 987 | lp3 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 4 | 988 | lp3 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 4 | 989 And the network moves ahead "2" blocks 990 And the liquidity fee factor should be "0.003" for the market "ETH/DEC21" 991 And the target stake should be "12000" for the market "ETH/DEC21" 992 And the supplied stake should be "12000" for the market "ETH/DEC21" 993 994 #lp4 join when market is below target stake with a large commitment 995 And the parties submit the following liquidity provision: 996 | id | party | market id | commitment amount | fee | lp type | 997 | lp4 | lp4 | ETH/DEC21 | 10000 | 0.004 | submission | 998 | lp4 | lp4 | ETH/DEC21 | 10000 | 0.004 | submission | 999 And the parties place the following pegged iceberg orders: 1000 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1001 | lp4 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 4 | 1002 | lp4 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 4 | 1003 And the liquidity fee factor should be "0.003" for the market "ETH/DEC21" 1004 And the network moves ahead "1" blocks 1005 1006 And the target stake should be "12000" for the market "ETH/DEC21" 1007 And the supplied stake should be "22000" for the market "ETH/DEC21" 1008 1009 # AC 0042-LIQF-028: lp4 leaves a market that is above target stake when their fee bid is higher than the one currently being used: fee doesn't change 1010 And the parties submit the following liquidity provision: 1011 | id | party | market id | commitment amount | fee | lp type | 1012 | lp4 | lp4 | ETH/DEC21 | 10000 | 0.004 | cancellation | 1013 | lp4 | lp4 | ETH/DEC21 | 10000 | 0.004 | cancellation | 1014 And the parties place the following pegged iceberg orders: 1015 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1016 | lp4 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 4 | 1017 | lp4 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 4 | 1018 And the network moves ahead "1" blocks 1019 And the liquidity fee factor should be "0.003" for the market "ETH/DEC21" 1020 And the target stake should be "12000" for the market "ETH/DEC21" 1021 And the supplied stake should be "12000" for the market "ETH/DEC21" 1022 # lp4 join when market is above target stake with a large commitment 1023 And the parties submit the following liquidity provision: 1024 | id | party | market id | commitment amount | fee | lp type | 1025 | lp4 | lp4 | ETH/DEC21 | 4000 | 0.004 | submission | 1026 | lp4 | lp4 | ETH/DEC21 | 4000 | 0.004 | submission | 1027 And the network moves ahead "1" blocks 1028 And the liquidity fee factor should be "0.003" for the market "ETH/DEC21" 1029 And the target stake should be "12000" for the market "ETH/DEC21" 1030 And the supplied stake should be "16000" for the market "ETH/DEC21" 1031 1032 # AC 0042-LIQF-023: An LP joining a market that is above the target stake with a commitment large enough to push one of two higher bids above the target stake, and a lower fee bid than the current fee: the fee changes to the other lower bid 1033 And the parties submit the following liquidity provision: 1034 | id | party | market id | commitment amount | fee | lp type | 1035 | lp5 | lp5 | ETH/DEC21 | 6000 | 0.0015 | submission | 1036 | lp5 | lp5 | ETH/DEC21 | 6000 | 0.0015 | submission | 1037 And the parties place the following pegged iceberg orders: 1038 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1039 | lp5 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 4 | 1040 | lp5 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 4 | 1041 And the network moves ahead "1" blocks 1042 And the liquidity fee factor should be "0.002" for the market "ETH/DEC21" 1043 And the target stake should be "12000" for the market "ETH/DEC21" 1044 And the supplied stake should be "22000" for the market "ETH/DEC21" 1045 1046 #AC 0042-LIQF-026: An LP leaves a market that is above target stake when their fee bid is lower than the one currently being used and their commitment size changes the LP that meets the target stake: fee changes to fee bid by the LP that is now at the place in the bid order to provide the target stake 1047 And the parties submit the following liquidity provision: 1048 | id | party | market id | commitment amount | fee | lp type | 1049 | lp5 | lp5 | ETH/DEC21 | 6000 | 0.0015 | cancellation | 1050 | lp5 | lp5 | ETH/DEC21 | 6000 | 0.0015 | cancellation | 1051 And the network moves ahead "2" blocks 1052 And the liquidity fee factor should be "0.003" for the market "ETH/DEC21" 1053 And the target stake should be "12000" for the market "ETH/DEC21" 1054 And the supplied stake should be "16000" for the market "ETH/DEC21" 1055 1056 And the parties submit the following liquidity provision: 1057 | id | party | market id | commitment amount | fee | lp type | 1058 | lp5 | lp5 | ETH/DEC21 | 1000 | 0.0015 | submission | 1059 | lp5 | lp5 | ETH/DEC21 | 1000 | 0.0015 | submission | 1060 And the parties place the following pegged iceberg orders: 1061 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1062 | lp5 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 4 | 1063 | lp5 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 4 | 1064 And the network moves ahead "1" blocks 1065 And the liquidity fee factor should be "0.003" for the market "ETH/DEC21" 1066 And the target stake should be "12000" for the market "ETH/DEC21" 1067 And the supplied stake should be "17000" for the market "ETH/DEC21" 1068 1069 #AC 0042-LIQF-027: An LP leaves a market that is above target stake when their fee bid is lower than the one currently being used and their commitment size doesn't change the LP that meets the target stake: fee doesn't change 1070 And the parties submit the following liquidity provision: 1071 | id | party | market id | commitment amount | fee | lp type | 1072 | lp5 | lp5 | ETH/DEC21 | 1000 | 0.0015 | cancellation | 1073 | lp5 | lp5 | ETH/DEC21 | 1000 | 0.0015 | cancellation | 1074 And the network moves ahead "1" blocks 1075 And the liquidity fee factor should be "0.003" for the market "ETH/DEC21" 1076 And the target stake should be "12000" for the market "ETH/DEC21" 1077 And the supplied stake should be "16000" for the market "ETH/DEC21" 1078 1079 @FeeRound 1080 Scenario: 005b, 2 LPs joining at start, unequal commitments, 1 LP lp3 joining later, and 4 LPs lp4/5/6/7 with large commitment and low/high fee joins later (0042-LIQF-032) with the fee factor set to 0.5 1081 1082 Given the following network parameters are set: 1083 | name | value | 1084 | market.liquidity.equityLikeShareFeeFraction | 0.5 | 1085 1086 And the following network parameters are set: 1087 | name | value | 1088 | validators.epoch.length | 600s | 1089 1090 Given the parties deposit on asset's general account the following amount: 1091 | party | asset | amount | 1092 | lp1 | ETH | 100000000000 | 1093 | lp2 | ETH | 100000000000 | 1094 | lp3 | ETH | 100000000000 | 1095 | lp4 | ETH | 100000000000 | 1096 | lp5 | ETH | 100000000000 | 1097 | lp6 | ETH | 100000000000 | 1098 | lp7 | ETH | 100000000000 | 1099 | party1 | ETH | 100000000000 | 1100 | party2 | ETH | 100000000000 | 1101 1102 And the parties submit the following liquidity provision: 1103 | id | party | market id | commitment amount | fee | lp type | 1104 | lp1 | lp1 | ETH/DEC21 | 8000 | 0.001 | submission | 1105 And the parties place the following pegged iceberg orders: 1106 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1107 | lp1 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 1108 | lp1 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 1109 And the parties submit the following liquidity provision: 1110 | id | party | market id | commitment amount | fee | lp type | 1111 | lp2 | lp2 | ETH/DEC21 | 2000 | 0.002 | submission | 1112 And the parties place the following pegged iceberg orders: 1113 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1114 | lp2 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 1115 | lp2 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 1116 1117 Then the parties place the following orders: 1118 | party | market id | side | volume | price | resulting trades | type | tif | 1119 | party1 | ETH/DEC21 | buy | 1000 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 1120 | party1 | ETH/DEC21 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1121 | party2 | ETH/DEC21 | sell | 1000 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 1122 | party2 | ETH/DEC21 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1123 1124 Then the opening auction period ends for market "ETH/DEC21" 1125 1126 And the following trades should be executed: 1127 | buyer | price | size | seller | 1128 | party1 | 1000 | 60 | party2 | 1129 1130 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 1131 And the mark price should be "1000" for the market "ETH/DEC21" 1132 And the open interest should be "60" for the market "ETH/DEC21" 1133 And the target stake should be "6000" for the market "ETH/DEC21" 1134 And the supplied stake should be "10000" for the market "ETH/DEC21" 1135 1136 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 1137 | party | equity like share | average entry valuation | 1138 | lp1 | 0.8 | 8000 | 1139 | lp2 | 0.2 | 10000 | 1140 1141 And the price monitoring bounds for the market "ETH/DEC21" should be: 1142 | min bound | max bound | 1143 | 500 | 1500 | 1144 1145 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 1146 1147 # no fees in auction 1148 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 1149 1150 1151 Then the parties place the following orders: 1152 | party | market id | side | volume | price | resulting trades | type | tif | reference | 1153 | party1 | ETH/DEC21 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 1154 | party2 | ETH/DEC21 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 1155 1156 And the following trades should be executed: 1157 | buyer | price | size | seller | 1158 | party2 | 1000 | 20 | party1 | 1159 1160 And the accumulated liquidity fees should be "20" for the market "ETH/DEC21" 1161 1162 # opening auction + time window 1163 Then time is updated to "2019-11-30T00:10:05Z" 1164 1165 # these are different from the tests, but again, we end up with a 2/3 vs 1/3 fee share here. 1166 Then the following transfers should happen: 1167 | from | to | from account | to account | market id | amount | asset | 1168 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 16 | ETH | 1169 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 4 | ETH | 1170 1171 And the accumulated liquidity fees should be "0" for the market "ETH/DEC21" 1172 1173 When time is updated to "2019-11-30T00:15:00Z" 1174 And the parties submit the following liquidity provision: 1175 | id | party | market id | commitment amount | fee | lp type | 1176 | lp3 | lp3 | ETH/DEC21 | 10000 | 0.001 | submission | 1177 And the parties place the following pegged iceberg orders: 1178 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1179 | lp3 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 1180 | lp3 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 1181 Then the network moves ahead "1" blocks" 1182 1183 And the liquidity provider fee shares for the market "ETH/DEC21" should be: 1184 | party | equity like share | average entry valuation | 1185 | lp1 | 0.4 | 8000 | 1186 | lp2 | 0.1 | 10000 | 1187 | lp3 | 0.5 | 20000 | 1188 1189 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 1190 1191 When time is updated to "2019-11-30T00:20:00Z" 1192 Then the parties place the following orders: 1193 | party | market id | side | volume | price | resulting trades | type | tif | 1194 | party1 | ETH/DEC21 | buy | 16 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1195 | party2 | ETH/DEC21 | sell | 16 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 1196 1197 And the following trades should be executed: 1198 | buyer | price | size | seller | 1199 | party1 | 1000 | 16 | party2 | 1200 1201 And the accumulated liquidity fees should be "16" for the market "ETH/DEC21" 1202 1203 When time is updated to "2019-11-30T00:20:06Z" 1204 # lp3 gets lower fee share than indicated by the ELS this fee round as it was later to deploy liquidity (so lower liquidity scores than others had) 1205 Then the following transfers should happen: 1206 | from | to | from account | to account | market id | amount | asset | 1207 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 7 | ETH | 1208 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 4 | ETH | 1209 | market | lp3 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 4 | ETH | 1210 1211 And the accumulated liquidity fees should be "1" for the market "ETH/DEC21" 1212 1213 # make sure we're in the next time window now 1214 When time is updated to "2019-11-30T00:30:07Z" 1215 And the parties place the following orders: 1216 | party | market id | side | volume | price | resulting trades | type | tif | 1217 | party1 | ETH/DEC21 | buy | 16 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1218 | party2 | ETH/DEC21 | sell | 16 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 1219 Then the accumulated liquidity fees should be "17" for the market "ETH/DEC21" 1220 1221 When time is updated to "2019-11-30T00:40:08Z" 1222 Then the following transfers should happen: 1223 | from | to | from account | to account | market id | amount | asset | 1224 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 6 | ETH | 1225 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 1 | ETH | 1226 | market | lp3 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC21 | 8 | ETH | 1227 And the accumulated liquidity fees should be "2" for the market "ETH/DEC21" 1228 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 1229 And the target stake should be "7200" for the market "ETH/DEC21" 1230 And the supplied stake should be "20000" for the market "ETH/DEC21" 1231 #AC 0042-LIQF-024:lp4 joining a market that is above the target stake with a commitment large enough to push one of two higher bids above the target stake, and a higher fee bid than the current fee: the fee doesn't change 1232 And the parties submit the following liquidity provision: 1233 | id | party | market id | commitment amount | fee | lp type | 1234 | lp4 | lp4 | ETH/DEC21 | 20000 | 0.004 | submission | 1235 And the parties place the following pegged iceberg orders: 1236 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1237 | lp4 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 1238 | lp4 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 1239 Then the network moves ahead "2" blocks 1240 When time is updated to "2019-11-30T00:50:09Z" 1241 And the liquidity fee factor should be "0.001" for the market "ETH/DEC21" 1242 #AC 0042-LIQF-029: lp5 joining a market that is above the target stake with a sufficiently large commitment to push ALL higher bids above the target stake and a lower fee bid than the current fee: their fee is used 1243 And the parties submit the following liquidity provision: 1244 | id | party | market id | commitment amount | fee | lp type | 1245 | lp5 | lp5 | ETH/DEC21 | 30000 | 0.0005 | submission | 1246 And the parties place the following pegged iceberg orders: 1247 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1248 | lp5 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 1249 | lp5 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 1250 Then the network moves ahead "2" blocks 1251 When time is updated to "2019-11-30T01:00:10Z" 1252 And the liquidity fee factor should be "0.0005" for the market "ETH/DEC21" 1253 And the target stake should be "7200" for the market "ETH/DEC21" 1254 And the supplied stake should be "70000" for the market "ETH/DEC21" 1255 1256 #AC 0042-LIQF-030: lp6 joining a market that is above the target stake with a commitment not large enough to push any higher bids above the target stake, and a lower fee bid than the current fee: the fee doesn't change 1257 And the parties submit the following liquidity provision: 1258 | id | party | market id | commitment amount | fee | lp type | 1259 | lp6 | lp6 | ETH/DEC21 | 2000 | 0.0001 | submission | 1260 | lp6 | lp6 | ETH/DEC21 | 2000 | 0.0001 | submission | 1261 And the parties place the following pegged iceberg orders: 1262 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1263 | lp6 | ETH/DEC21 | 200 | 1 | buy | BID | 200 | 2 | 1264 | lp6 | ETH/DEC21 | 200 | 1 | sell | ASK | 200 | 2 | 1265 Then the network moves ahead "2" blocks 1266 When time is updated to "2019-11-30T01:10:11Z" 1267 And the liquidity fee factor should be "0.0005" for the market "ETH/DEC21" 1268 1269 @FeeRound 1270 Scenario: 003b, 2 LPs joining at start, equal commitments, unequal offsets with fee fraction set to 0.5 1271 Given the following network parameters are set: 1272 | name | value | 1273 | limits.markets.maxPeggedOrders | 10 | 1274 | market.liquidity.providersFeeCalculationTimeStep | 5s | 1275 | market.liquidity.equityLikeShareFeeFraction | 0.5 | 1276 And the liquidity sla params named "updated-SLA": 1277 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 1278 | 1.0 | 0.5 | 1 | 1.0 | 1279 And the markets are updated: 1280 | id | sla params | linear slippage factor | quadratic slippage factor | 1281 | ETH/DEC22 | updated-SLA | 1e0 | 1e0 | 1282 And the parties deposit on asset's general account the following amount: 1283 | party | asset | amount | 1284 | lp1 | ETH | 100000000000 | 1285 | lp2 | ETH | 100000000000 | 1286 | party1 | ETH | 100000000 | 1287 | party2 | ETH | 100000000 | 1288 And the parties submit the following liquidity provision: 1289 | id | party | market id | commitment amount | fee | lp type | 1290 | lp1 | lp1 | ETH/DEC22 | 40000 | 0.001 | submission | 1291 | lp1 | lp1 | ETH/DEC22 | 40000 | 0.001 | | 1292 | lp2 | lp2 | ETH/DEC22 | 40000 | 0.002 | submission | 1293 | lp2 | lp2 | ETH/DEC22 | 40000 | 0.002 | | 1294 And the parties place the following pegged iceberg orders: 1295 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 1296 | lp1 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 32 | lp1-bids-1 | 1297 | lp1 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 32 | lp1-asks-1 | 1298 | lp2 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 102 | lp2-bids-1 | 1299 | lp2 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 102 | lp2-asks-1 | 1300 When the parties place the following orders: 1301 | party | market id | side | volume | price | resulting trades | type | tif | 1302 | party1 | ETH/DEC22 | buy | 1 | 995 | 0 | TYPE_LIMIT | TIF_GTC | 1303 | party1 | ETH/DEC22 | buy | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1304 | party2 | ETH/DEC22 | sell | 1 | 1005 | 0 | TYPE_LIMIT | TIF_GTC | 1305 | party2 | ETH/DEC22 | sell | 90 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1306 And the opening auction period ends for market "ETH/DEC22" 1307 Then the market data for the market "ETH/DEC22" should be: 1308 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price | 1309 | 1000 | TRADING_MODE_CONTINUOUS | 10000 | 893 | 1120 | 43908 | 80000 | 90 | 995 | 1000 | 1005 | 1310 And the following trades should be executed: 1311 | buyer | price | size | seller | 1312 | party1 | 1000 | 90 | party2 | 1313 And the liquidity provider fee shares for the market "ETH/DEC22" should be: 1314 | party | equity like share | average entry valuation | 1315 | lp1 | 0.5 | 40000 | 1316 | lp2 | 0.5 | 80000 | 1317 And the liquidity fee factor should be "0.002" for the market "ETH/DEC22" 1318 # no fees in auction 1319 And the accumulated liquidity fees should be "0" for the market "ETH/DEC22" 1320 1321 When the parties place the following orders: 1322 | party | market id | side | volume | price | resulting trades | type | tif | 1323 | party1 | ETH/DEC22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1324 | party2 | ETH/DEC22 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 1325 Then the accumulated liquidity fees should be "40" for the market "ETH/DEC22" 1326 1327 When the network moves ahead "6" blocks 1328 1329 Then the accumulated liquidity fees should be "1" for the market "ETH/DEC22" 1330 1331 1332 # observe that lp2 gets lower share of the fees despite the same commitment amount (that is due to their orders being much wider than those of lp1) 1333 Then the following transfers should happen: 1334 | from | to | from account | to account | market id | amount | asset | 1335 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 26 | ETH | 1336 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 13 | ETH | 1337 1338 # modify lp2 orders so that they fall outside the price monitoring bounds 1339 And the parties place the following pegged iceberg orders: 1340 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 1341 | lp2 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 116 | lp2-bids-2 | 1342 | lp2 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 116 | lp2-asks-2 | 1343 And the parties cancel the following orders: 1344 | party | reference | 1345 | lp2 | lp2-bids-1 | 1346 | lp2 | lp2-asks-1 | 1347 And the market data for the market "ETH/DEC22" should be: 1348 | mark price | trading mode | horizon | min bound | max bound | best static bid price | static mid price | best static offer price | 1349 | 1000 | TRADING_MODE_CONTINUOUS | 10000 | 893 | 1120 | 995 | 1000 | 1005 | 1350 And the accumulated liquidity fees should be "1" for the market "ETH/DEC22" 1351 1352 1353 1354 And the parties place the following orders: 1355 | party | market id | side | volume | price | resulting trades | type | tif | 1356 | party2 | ETH/DEC22 | buy | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1357 | party1 | ETH/DEC22 | sell | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 1358 Then the accumulated liquidity fees should be "41" for the market "ETH/DEC22" 1359 1360 When the network moves ahead "6" blocks 1361 1362 # all the fees go to lp2 1363 Then the following transfers should happen: 1364 | from | to | from account | to account | market id | amount | asset | 1365 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 41 | ETH | 1366 # 0 fee transfer is still filtered out to cut down on events. 1367 #| market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 0 | ETH | 1368 1369 # lp2 manually adds some limit orders within PM range, observe automatically deployed orders go down and fee share go up 1370 When clear all events 1371 And the parties place the following orders: 1372 | party | market id | side | volume | price | resulting trades | type | tif | 1373 | lp2 | ETH/DEC22 | buy | 100 | 995 | 0 | TYPE_LIMIT | TIF_GTC | 1374 | lp2 | ETH/DEC22 | sell | 100 | 1005 | 0 | TYPE_LIMIT | TIF_GTC | 1375 1376 1377 When the parties place the following orders: 1378 | party | market id | side | volume | price | resulting trades | type | tif | 1379 | party2 | ETH/DEC22 | buy | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1380 | party1 | ETH/DEC22 | sell | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 1381 Then the accumulated liquidity fees should be "40" for the market "ETH/DEC22" 1382 1383 When the network moves ahead "6" blocks 1384 # lp2 has increased their liquidity score by placing limit orders closer to the mid (and within price monitoring bounds), 1385 # hence their fee share is larger (and no longer 0) now. 1386 Then the following transfers should happen: 1387 | from | to | from account | to account | market id | amount | asset | 1388 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 24 | ETH | 1389 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 15 | ETH | 1390 1391 # lp2 manually adds some pegged orders within PM range, liquidity obligation is now fullfiled by limit and pegged orders so no automatic order deployment takes place 1392 And the parties place the following pegged iceberg orders: 1393 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 1394 | lp2 | ETH/DEC22 | 100 | 50 | buy | BID | 100 | 1 | lp2-bids-3 | 1395 | lp2 | ETH/DEC22 | 100 | 50 | sell | ASK | 100 | 1 | lp2-asks-3 | 1396 1397 When the parties place the following orders: 1398 | party | market id | side | volume | price | resulting trades | type | tif | 1399 | party2 | ETH/DEC22 | buy | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 1400 | party1 | ETH/DEC22 | sell | 20 | 1000 | 1 | TYPE_LIMIT | TIF_FOK | 1401 Then the accumulated liquidity fees should be "41" for the market "ETH/DEC22" 1402 1403 When the network moves ahead "6" blocks 1404 # lp2 has increased their liquidity score by placing pegged orders closer to the mid (and within price monitoring bounds), 1405 # hence their fee share is larger now. 1406 Then the following transfers should happen: 1407 | from | to | from account | to account | market id | amount | asset | 1408 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 22 | ETH | 1409 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/DEC22 | 18 | ETH | 1410 1411