code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0034-PROB-liquidity_TauScaling.feature (about) 1 Feature: Tests impact from change of tau.scaling parameter on probability of trading 2 3 Scenario: 001: set tau.scaling to 1 4 Given the following network parameters are set: 5 | name | value | 6 | market.value.windowLength | 1h | 7 | network.markPriceUpdateMaximumFrequency | 0s | 8 | market.liquidity.probabilityOfTrading.tau.scaling | 1 | 9 | limits.markets.maxPeggedOrders | 4 | 10 | market.liquidity.providersFeeCalculationTimeStep | 600s | 11 Given the liquidity monitoring parameters: 12 | name | triggering ratio | time window | scaling factor | 13 | lqm-params | 0.0 | 24h | 1.0 | 14 And the following assets are registered: 15 | id | decimal places | 16 | USD | 2 | 17 18 And the average block duration is "2" 19 20 And the log normal risk model named "log-normal-risk-model-1": 21 | risk aversion | tau | mu | r | sigma | 22 | 0.000001 | 0.001 | 0 | 0 | 1.0 | 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 | 100000 | 0.99 | 3 | 29 30 And the liquidity sla params named "SLA": 31 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 32 | 100 | 0.5 | 1 | 1.0 | 33 34 And the markets: 35 | 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 | 36 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.001 | 0 | SLA | 37 38 Given the parties deposit on asset's general account the following amount: 39 | party | asset | amount | 40 | lp1 | USD | 100000000000 | 41 | lp2 | USD | 100000000000 | 42 | lp3 | USD | 100000000000 | 43 | party1 | USD | 10000000000 | 44 | party2 | USD | 10000000000 | 45 46 And the parties submit the following liquidity provision: 47 | id | party | market id | commitment amount | fee | lp type | 48 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 49 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 50 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 51 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 52 And the parties place the following pegged iceberg orders: 53 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 54 | lp1 | ETH/MAR22 | 3572 | 1 | buy | BID | 3572 | 200 | 55 | lp1 | ETH/MAR22 | 2778 | 1 | buy | MID | 2777 | 100 | 56 | lp1 | ETH/MAR22 | 1924 | 1 | sell | ASK | 1924 | 200 | 57 | lp1 | ETH/MAR22 | 2273 | 1 | sell | MID | 2273 | 100 | 58 And the parties submit the following liquidity provision: 59 | id | party | market id | commitment amount | fee | lp type | 60 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 61 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 62 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 63 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 64 And the parties place the following pegged iceberg orders: 65 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 66 | lp2 | ETH/MAR22 | 2784 | 1 | buy | BID | 2784 | 2 | 67 | lp2 | ETH/MAR22 | 2502 | 1 | buy | MID | 2502 | 1 | 68 | lp2 | ETH/MAR22 | 2269 | 1 | sell | ASK | 2269 | 2 | 69 | lp2 | ETH/MAR22 | 2498 | 1 | sell | MID | 2498 | 1 | 70 71 Then the parties place the following orders with ticks: 72 | party | market id | side | volume | price | resulting trades | type | tif | 73 | party1 | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 74 | party1 | ETH/MAR22 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 75 | party2 | ETH/MAR22 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 76 | party2 | ETH/MAR22 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 77 78 Then the opening auction period ends for market "ETH/MAR22" 79 And the market data for the market "ETH/MAR22" should be: 80 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 81 | 1000 | TRADING_MODE_CONTINUOUS | 100000 | 864 | 1154 | 1012920 | 1000000000 | 60 | 82 83 84 85 And the order book should have the following volumes for market "ETH/MAR22": 86 | side | price | volume | 87 | buy | 700 | 3572 | 88 | buy | 864 | 0 | 89 | buy | 898 | 2784 | 90 | buy | 900 | 2778 | 91 | buy | 999 | 2502 | 92 | sell | 1001 | 2498 | 93 | sell | 1100 | 2274 | 94 | sell | 1102 | 2269 | 95 | sell | 1154 | 0 | 96 | sell | 1300 | 1924 | 97 98 And the following trades should be executed: 99 | buyer | price | size | seller | 100 | party1 | 1000 | 60 | party2 | 101 102 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 103 And the mark price should be "1000" for the market "ETH/MAR22" 104 105 And the liquidity provider fee shares for the market "ETH/MAR22" should be: 106 | party | equity like share | average entry valuation | 107 | lp1 | 0.5 | 500000000 | 108 | lp2 | 0.5 | 1000000000 | 109 110 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 111 # no fees in auction 112 And the accumulated liquidity fees should be "0" for the market "ETH/MAR22" 113 114 Then the parties place the following orders with ticks: 115 | party | market id | side | volume | price | resulting trades | type | tif | reference | 116 | party1 | ETH/MAR22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 117 | party2 | ETH/MAR22 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 118 Then the parties should have the following profit and loss: 119 | party | volume | unrealised pnl | realised pnl | 120 | party1 | 60 | -294000 | 0 | 121 | party2 | -40 | 196000 | 98000 | 122 | lp1 | 0 | 0 | 0 | 123 | lp2 | -20 | 0 | 0 | 124 125 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 126 And the accumulated liquidity fees should be "1902" for the market "ETH/MAR22" 127 128 # check lp fee distribution 129 Then time is updated to "2019-11-30T00:10:05Z" 130 131 Then the following transfers should happen: 132 | from | to | from account | to account | market id | amount | asset | 133 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 573 | USD | 134 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 1328 | USD | 135 136 Scenario: 002: set tau.scaling to 10 137 Given the following network parameters are set: 138 | name | value | 139 | market.value.windowLength | 1h | 140 | network.markPriceUpdateMaximumFrequency | 0s | 141 | market.liquidity.probabilityOfTrading.tau.scaling | 10 | 142 | limits.markets.maxPeggedOrders | 4 | 143 And the following assets are registered: 144 | id | decimal places | 145 | USD | 2 | 146 147 And the average block duration is "2" 148 149 And the log normal risk model named "log-normal-risk-model-1": 150 | risk aversion | tau | mu | r | sigma | 151 | 0.000001 | 0.001 | 0 | 0 | 1.0 | 152 And the fees configuration named "fees-config-1": 153 | maker fee | infrastructure fee | 154 | 0.0004 | 0.001 | 155 And the price monitoring named "price-monitoring-1": 156 | horizon | probability | auction extension | 157 | 100000 | 0.99 | 3 | 158 159 And the liquidity sla params named "SLA": 160 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 161 | 1.0 | 0.5 | 1 | 1.0 | 162 163 And the markets: 164 | 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 | 165 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.001 | 0 | SLA | 166 167 Given the parties deposit on asset's general account the following amount: 168 | party | asset | amount | 169 | lp1 | USD | 100000000000 | 170 | lp2 | USD | 100000000000 | 171 | lp3 | USD | 100000000000 | 172 | party1 | USD | 10000000000 | 173 | party2 | USD | 10000000000 | 174 175 And the parties submit the following liquidity provision: 176 | id | party | market id | commitment amount | fee | lp type | 177 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 178 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 179 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 180 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 181 And the parties place the following pegged iceberg orders: 182 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 183 | lp1 | ETH/MAR22 | 2 | 1 | buy | BID | 1 | 200 | 184 | lp1 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 100 | 185 | lp1 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 200 | 186 | lp1 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 100 | 187 And the parties submit the following liquidity provision: 188 | id | party | market id | commitment amount | fee | lp type | 189 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 190 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 191 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 192 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 193 And the parties place the following pegged iceberg orders: 194 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 195 | lp2 | ETH/MAR22 | 2 | 1 | buy | BID | 1 | 2 | 196 | lp2 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 1 | 197 | lp2 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 2 | 198 | lp2 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 1 | 199 Then the parties place the following orders with ticks: 200 | party | market id | side | volume | price | resulting trades | type | tif | 201 | party1 | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 202 | party1 | ETH/MAR22 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 203 | party2 | ETH/MAR22 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 204 | party2 | ETH/MAR22 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 205 206 Then the opening auction period ends for market "ETH/MAR22" 207 208 And the following trades should be executed: 209 | buyer | price | size | seller | 210 | party1 | 1000 | 60 | party2 | 211 212 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 213 And the mark price should be "1000" for the market "ETH/MAR22" 214 215 And the liquidity provider fee shares for the market "ETH/MAR22" should be: 216 | party | equity like share | average entry valuation | 217 | lp1 | 0.5 | 500000000 | 218 | lp2 | 0.5 | 1000000000 | 219 220 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 221 # no fees in auction 222 And the accumulated liquidity fees should be "0" for the market "ETH/MAR22" 223 224 Then the parties place the following orders with ticks: 225 | party | market id | side | volume | price | resulting trades | type | tif | reference | 226 | party1 | ETH/MAR22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 227 | party2 | ETH/MAR22 | buy | 20 | 1000 | 2 | TYPE_LIMIT | TIF_GTC | party2-buy | 228 Then the parties should have the following profit and loss: 229 | party | volume | unrealised pnl | realised pnl | 230 | party1 | 41 | 0 | 0 | 231 | party2 | -40 | 0 | 4900 | 232 | lp1 | 0 | 0 | 0 | 233 | lp2 | -1 | -4900 | 0 | 234 235 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 236 And the accumulated liquidity fees should be "1996" for the market "ETH/MAR22" 237 238 # check lp fee distribution 239 Then time is updated to "2019-11-30T00:10:05Z" 240 241 Then the following transfers should happen: 242 | from | to | from account | to account | market id | amount | asset | 243 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 610 | USD | 244 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 1385 | USD | 245 246 Scenario: 003: set tau.scaling to 1000 247 Given the following network parameters are set: 248 | name | value | 249 | market.value.windowLength | 1h | 250 | network.markPriceUpdateMaximumFrequency | 0s | 251 | market.liquidity.probabilityOfTrading.tau.scaling | 1000 | 252 | limits.markets.maxPeggedOrders | 4 | 253 And the following assets are registered: 254 | id | decimal places | 255 | USD | 2 | 256 257 And the average block duration is "2" 258 259 And the log normal risk model named "log-normal-risk-model-1": 260 | risk aversion | tau | mu | r | sigma | 261 | 0.000001 | 0.001 | 0 | 0 | 1.0 | 262 And the fees configuration named "fees-config-1": 263 | maker fee | infrastructure fee | 264 | 0.0004 | 0.001 | 265 And the price monitoring named "price-monitoring-1": 266 | horizon | probability | auction extension | 267 | 100000 | 0.99 | 3 | 268 269 And the liquidity sla params named "SLA": 270 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 271 | 1.0 | 0.5 | 1 | 1.0 | 272 273 And the markets: 274 | 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 | 275 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.001 | 0 | SLA | 276 277 Given the parties deposit on asset's general account the following amount: 278 | party | asset | amount | 279 | lp1 | USD | 100000000000 | 280 | lp2 | USD | 100000000000 | 281 | lp3 | USD | 100000000000 | 282 | party1 | USD | 10000000000 | 283 | party2 | USD | 10000000000 | 284 285 And the parties submit the following liquidity provision: 286 | id | party | market id | commitment amount | fee | lp type | 287 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 288 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 289 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 290 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 291 And the parties place the following pegged iceberg orders: 292 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 293 | lp1 | ETH/MAR22 | 3572 | 1 | buy | BID | 3572 | 200 | 294 | lp1 | ETH/MAR22 | 2778 | 1 | buy | MID | 2777 | 100 | 295 | lp1 | ETH/MAR22 | 1924 | 1 | sell | ASK | 1924 | 200 | 296 | lp1 | ETH/MAR22 | 2273 | 1 | sell | MID | 2273 | 100 | 297 And the parties submit the following liquidity provision: 298 | id | party | market id | commitment amount | fee | lp type | 299 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 300 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 301 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 302 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 303 And the parties place the following pegged iceberg orders: 304 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 305 | lp2 | ETH/MAR22 | 2784 | 1 | buy | BID | 2784 | 2 | 306 | lp2 | ETH/MAR22 | 2502 | 1 | buy | MID | 2502 | 1 | 307 | lp2 | ETH/MAR22 | 2269 | 1 | sell | ASK | 2269 | 2 | 308 | lp2 | ETH/MAR22 | 2498 | 1 | sell | MID | 2498 | 1 | 309 310 Then the parties place the following orders with ticks: 311 | party | market id | side | volume | price | resulting trades | type | tif | 312 | party1 | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 313 | party1 | ETH/MAR22 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 314 | party2 | ETH/MAR22 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 315 | party2 | ETH/MAR22 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 316 317 Then the opening auction period ends for market "ETH/MAR22" 318 319 And the following trades should be executed: 320 | buyer | price | size | seller | 321 | party1 | 1000 | 60 | party2 | 322 323 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 324 And the mark price should be "1000" for the market "ETH/MAR22" 325 326 And the liquidity provider fee shares for the market "ETH/MAR22" should be: 327 | party | equity like share | average entry valuation | 328 | lp1 | 0.5 | 500000000 | 329 | lp2 | 0.5 | 1000000000 | 330 331 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 332 # no fees in auction 333 And the accumulated liquidity fees should be "0" for the market "ETH/MAR22" 334 335 Then the parties place the following orders with ticks: 336 | party | market id | side | volume | price | resulting trades | type | tif | reference | 337 | party1 | ETH/MAR22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 338 | party2 | ETH/MAR22 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-buy | 339 Then the parties should have the following profit and loss: 340 | party | volume | unrealised pnl | realised pnl | 341 | party1 | 60 | -294000 | 0 | 342 | party2 | -40 | 196000 | 98000 | 343 | lp1 | 0 | 0 | 0 | 344 | lp2 | -20 | 0 | 0 | 345 346 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 347 And the accumulated liquidity fees should be "1902" for the market "ETH/MAR22" 348 349 # check lp fee distribution 350 Then time is updated to "2019-11-30T00:10:05Z" 351 352 Then the following transfers should happen: 353 | from | to | from account | to account | market id | amount | asset | 354 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 572 | USD | 355 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 1329 | USD | 356 357 Scenario: 004: set tau.scaling to 1, smaller lp offset 358 Given the following network parameters are set: 359 | name | value | 360 | market.value.windowLength | 1h | 361 | network.markPriceUpdateMaximumFrequency | 0s | 362 | market.liquidity.probabilityOfTrading.tau.scaling | 1 | 363 | limits.markets.maxPeggedOrders | 8 | 364 365 And the following assets are registered: 366 | id | decimal places | 367 | USD | 2 | 368 369 And the average block duration is "2" 370 371 And the log normal risk model named "log-normal-risk-model-1": 372 | risk aversion | tau | mu | r | sigma | 373 | 0.000001 | 0.001 | 0 | 0 | 1.0 | 374 And the fees configuration named "fees-config-1": 375 | maker fee | infrastructure fee | 376 | 0.0004 | 0.001 | 377 And the price monitoring named "price-monitoring-1": 378 | horizon | probability | auction extension | 379 | 100000 | 0.99 | 3 | 380 381 And the liquidity sla params named "SLA": 382 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 383 | 1.0 | 0.5 | 1 | 1.0 | 384 385 And the markets: 386 | 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 | 387 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.001 | 0 | SLA | 388 389 Given the parties deposit on asset's general account the following amount: 390 | party | asset | amount | 391 | lp1 | USD | 100000000000 | 392 | lp2 | USD | 100000000000 | 393 | lp3 | USD | 100000000000 | 394 | party1 | USD | 10000000000 | 395 | party2 | USD | 10000000000 | 396 397 And the parties submit the following liquidity provision: 398 | id | party | market id | commitment amount | fee | lp type | 399 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 400 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 401 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 402 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 403 And the parties place the following pegged iceberg orders: 404 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 405 | lp1 | ETH/MAR22 | 2 | 1 | buy | BID | 1 | 20 | 406 | lp1 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 10 | 407 | lp1 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 20 | 408 | lp1 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 10 | 409 And the parties submit the following liquidity provision: 410 | id | party | market id | commitment amount | fee | lp type | 411 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 412 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 413 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 414 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 415 And the parties place the following pegged iceberg orders: 416 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 417 | lp2 | ETH/MAR22 | 2 | 1 | buy | BID | 1 | 2 | 418 | lp2 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 1 | 419 | lp2 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 2 | 420 | lp2 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 1 | 421 422 Then the parties place the following orders with ticks: 423 | party | market id | side | volume | price | resulting trades | type | tif | 424 | party1 | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 425 | party1 | ETH/MAR22 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 426 | party2 | ETH/MAR22 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 427 | party2 | ETH/MAR22 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 428 429 Then the opening auction period ends for market "ETH/MAR22" 430 431 And the following trades should be executed: 432 | buyer | price | size | seller | 433 | party1 | 1000 | 60 | party2 | 434 435 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 436 And the mark price should be "1000" for the market "ETH/MAR22" 437 438 And the liquidity provider fee shares for the market "ETH/MAR22" should be: 439 | party | equity like share | average entry valuation | 440 | lp1 | 0.5 | 500000000 | 441 | lp2 | 0.5 | 1000000000 | 442 443 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 444 # no fees in auction 445 And the accumulated liquidity fees should be "0" for the market "ETH/MAR22" 446 447 Then the parties place the following orders with ticks: 448 | party | market id | side | volume | price | resulting trades | type | tif | reference | 449 | party1 | ETH/MAR22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 450 | party2 | ETH/MAR22 | buy | 20 | 1000 | 3 | TYPE_LIMIT | TIF_GTC | party2-buy | 451 Then the parties should have the following profit and loss: 452 | party | volume | unrealised pnl | realised pnl | 453 | party1 | 42 | 0 | 0 | 454 | party2 | -40 | 0 | 8900 | 455 | lp1 | -1 | -4000 | 0 | 456 | lp2 | -1 | -4900 | 0 | 457 458 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 459 And the accumulated liquidity fees should be "1992" for the market "ETH/MAR22" 460 461 # check lp fee distribution 462 Then time is updated to "2019-11-30T00:10:05Z" 463 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/MAR22 | 903 | USD | 467 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 1088 | USD | 468 469 Scenario: 005: set tau.scaling to 10, smaller lp offset 470 Given the following network parameters are set: 471 | name | value | 472 | market.value.windowLength | 1h | 473 | network.markPriceUpdateMaximumFrequency | 0s | 474 | market.liquidity.probabilityOfTrading.tau.scaling | 10 | 475 | limits.markets.maxPeggedOrders | 4 | 476 477 And the following assets are registered: 478 | id | decimal places | 479 | USD | 2 | 480 481 And the average block duration is "2" 482 483 And the log normal risk model named "log-normal-risk-model-1": 484 | risk aversion | tau | mu | r | sigma | 485 | 0.000001 | 0.001 | 0 | 0 | 1.0 | 486 And the fees configuration named "fees-config-1": 487 | maker fee | infrastructure fee | 488 | 0.0004 | 0.001 | 489 And the price monitoring named "price-monitoring-1": 490 | horizon | probability | auction extension | 491 | 100000 | 0.99 | 3 | 492 493 And the liquidity sla params named "SLA": 494 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 495 | 1.0 | 0.5 | 1 | 1.0 | 496 497 And the markets: 498 | 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 | 499 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.001 | 0 | SLA | 500 501 Given the parties deposit on asset's general account the following amount: 502 | party | asset | amount | 503 | lp1 | USD | 100000000000 | 504 | lp2 | USD | 100000000000 | 505 | lp3 | USD | 100000000000 | 506 | party1 | USD | 10000000000 | 507 | party2 | USD | 10000000000 | 508 509 And the parties submit the following liquidity provision: 510 | id | party | market id | commitment amount | fee | lp type | 511 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 512 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 513 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 514 | lp1 | lp1 | ETH/MAR22 | 500000000 | 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/MAR22 | 2 | 1 | buy | BID | 1 | 20 | 518 | lp1 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 10 | 519 | lp1 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 20 | 520 | lp1 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 10 | 521 And the parties submit the following liquidity provision: 522 | id | party | market id | commitment amount | fee | lp type | 523 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 524 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 525 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 526 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 527 And the parties place the following pegged iceberg orders: 528 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 529 | lp2 | ETH/MAR22 | 2 | 1 | buy | BID | 1 | 2 | 530 | lp2 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 1 | 531 | lp2 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 2 | 532 | lp2 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 1 | 533 534 Then the parties place the following orders with ticks: 535 | party | market id | side | volume | price | resulting trades | type | tif | 536 | party1 | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 537 | party1 | ETH/MAR22 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 538 | party2 | ETH/MAR22 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 539 | party2 | ETH/MAR22 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 540 541 Then the opening auction period ends for market "ETH/MAR22" 542 543 And the following trades should be executed: 544 | buyer | price | size | seller | 545 | party1 | 1000 | 60 | party2 | 546 547 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 548 And the mark price should be "1000" for the market "ETH/MAR22" 549 550 And the liquidity provider fee shares for the market "ETH/MAR22" should be: 551 | party | equity like share | average entry valuation | 552 | lp1 | 0.5 | 500000000 | 553 | lp2 | 0.5 | 1000000000 | 554 555 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 556 # no fees in auction 557 And the accumulated liquidity fees should be "0" for the market "ETH/MAR22" 558 559 Then the parties place the following orders with ticks: 560 | party | market id | side | volume | price | resulting trades | type | tif | reference | 561 | party1 | ETH/MAR22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 562 | party2 | ETH/MAR22 | buy | 20 | 1000 | 3 | TYPE_LIMIT | TIF_GTC | party2-buy | 563 Then the parties should have the following profit and loss: 564 | party | volume | unrealised pnl | realised pnl | 565 | party1 | 42 | 0 | 0 | 566 | party2 | -40 | 0 | 8900 | 567 | lp1 | -1 | -4000 | 0 | 568 | lp2 | -1 | -4900 | 0 | 569 570 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 571 And the accumulated liquidity fees should be "1992" for the market "ETH/MAR22" 572 573 # check lp fee distribution 574 Then time is updated to "2019-11-30T00:10:05Z" 575 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/MAR22 | 969 | USD | 579 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 1022 | USD | 580 581 Scenario: 006: set tau.scaling to 1000, smaller lp offset 582 Given the following network parameters are set: 583 | name | value | 584 | market.value.windowLength | 1h | 585 | network.markPriceUpdateMaximumFrequency | 0s | 586 | market.liquidity.probabilityOfTrading.tau.scaling | 1000 | 587 | limits.markets.maxPeggedOrders | 4 | 588 And the following assets are registered: 589 | id | decimal places | 590 | USD | 2 | 591 592 And the average block duration is "2" 593 594 And the log normal risk model named "log-normal-risk-model-1": 595 | risk aversion | tau | mu | r | sigma | 596 | 0.000001 | 0.001 | 0 | 0 | 1.0 | 597 And the fees configuration named "fees-config-1": 598 | maker fee | infrastructure fee | 599 | 0.0004 | 0.001 | 600 And the price monitoring named "price-monitoring-1": 601 | horizon | probability | auction extension | 602 | 100000 | 0.99 | 3 | 603 604 And the liquidity sla params named "SLA": 605 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 606 | 1.0 | 0.5 | 1 | 1.0 | 607 608 And the markets: 609 | 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 | 610 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.001 | 0 | SLA | 611 612 Given the parties deposit on asset's general account the following amount: 613 | party | asset | amount | 614 | lp1 | USD | 100000000000 | 615 | lp2 | USD | 100000000000 | 616 | lp3 | USD | 100000000000 | 617 | party1 | USD | 10000000000 | 618 | party2 | USD | 10000000000 | 619 620 And the parties submit the following liquidity provision: 621 | id | party | market id | commitment amount | fee | lp type | 622 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 623 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 624 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 625 | lp1 | lp1 | ETH/MAR22 | 500000000 | 0.001 | submission | 626 And the parties place the following pegged iceberg orders: 627 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 628 | lp1 | ETH/MAR22 | 2 | 1 | buy | BID | 1 | 20 | 629 | lp1 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 10 | 630 | lp1 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 20 | 631 | lp1 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 10 | 632 And the parties submit the following liquidity provision: 633 | id | party | market id | commitment amount | fee | lp type | 634 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 635 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 636 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 637 | lp2 | lp2 | ETH/MAR22 | 500000000 | 0.002 | submission | 638 And the parties place the following pegged iceberg orders: 639 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 640 | lp2 | ETH/MAR22 | 2 | 1 | buy | BID | 1 | 2 | 641 | lp2 | ETH/MAR22 | 2 | 1 | buy | MID | 1 | 1 | 642 | lp2 | ETH/MAR22 | 2 | 1 | sell | ASK | 1 | 2 | 643 | lp2 | ETH/MAR22 | 2 | 1 | sell | MID | 1 | 1 | 644 645 Then the parties place the following orders with ticks: 646 | party | market id | side | volume | price | resulting trades | type | tif | 647 | party1 | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 648 | party1 | ETH/MAR22 | buy | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 649 | party2 | ETH/MAR22 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 650 | party2 | ETH/MAR22 | sell | 60 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 651 652 Then the opening auction period ends for market "ETH/MAR22" 653 654 And the following trades should be executed: 655 | buyer | price | size | seller | 656 | party1 | 1000 | 60 | party2 | 657 658 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 659 And the mark price should be "1000" for the market "ETH/MAR22" 660 661 And the liquidity provider fee shares for the market "ETH/MAR22" should be: 662 | party | equity like share | average entry valuation | 663 | lp1 | 0.5 | 500000000 | 664 | lp2 | 0.5 | 1000000000 | 665 666 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 667 # no fees in auction 668 And the accumulated liquidity fees should be "0" for the market "ETH/MAR22" 669 670 Then the parties place the following orders with ticks: 671 | party | market id | side | volume | price | resulting trades | type | tif | reference | 672 | party1 | ETH/MAR22 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 673 | party2 | ETH/MAR22 | buy | 20 | 1000 | 3 | TYPE_LIMIT | TIF_GTC | party2-buy | 674 Then the parties should have the following profit and loss: 675 | party | volume | unrealised pnl | realised pnl | 676 | party1 | 42 | 0 | 0 | 677 | party2 | -40 | 0 | 8900 | 678 | lp1 | -1 | -4000 | 0 | 679 | lp2 | -1 | -4900 | 0 | 680 681 And the liquidity fee factor should be "0.001" for the market "ETH/MAR22" 682 And the accumulated liquidity fees should be "1992" for the market "ETH/MAR22" 683 684 # check lp fee distribution 685 Then time is updated to "2019-11-30T00:10:05Z" 686 687 Then the following transfers should happen: 688 | from | to | from account | to account | market id | amount | asset | 689 | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 992 | USD | 690 | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 999 | USD | 691 692 693 Scenario: market.liquidity.probabilityOfTrading.tau.scaling updated and commitment competiveness reevaluated (0034-PROB-004) 694 695 Given the following network parameters are set: 696 | name | value | 697 | market.value.windowLength | 1h | 698 | network.markPriceUpdateMaximumFrequency | 0s | 699 | market.liquidity.probabilityOfTrading.tau.scaling | 1 | 700 | limits.markets.maxPeggedOrders | 4 | 701 And the following assets are registered: 702 | id | decimal places | 703 | USD | 2 | 704 And the average block duration is "1" 705 And the liquidity sla params named "SLA": 706 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 707 | 1.0 | 0.5 | 1 | 1.0 | 708 And the markets: 709 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 710 | ETH/MAR22 | ETH | USD | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.001 | 0 | SLA | 711 712 # Initalise the market with 2 LPs with equal commitments but different competiveness 713 Given the parties deposit on asset's general account the following amount: 714 | party | asset | amount | 715 | lp1 | USD | 100000000000 | 716 | lp2 | USD | 100000000000 | 717 | lp3 | USD | 100000000000 | 718 | party1 | USD | 10000000000 | 719 | party2 | USD | 10000000000 | 720 And the parties submit the following liquidity provision: 721 | id | party | market id | commitment amount | fee | lp type | 722 | lp1 | lp1 | ETH/MAR22 | 1000000 | 0.001 | submission | 723 | lp2 | lp2 | ETH/MAR22 | 1000000 | 0.001 | submission | 724 And the parties place the following pegged iceberg orders: 725 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 726 | lp1 | ETH/MAR22 | 2000 | 1000 | buy | BID | 2000 | 1 | 727 | lp1 | ETH/MAR22 | 2000 | 1000 | sell | ASK | 2000 | 1 | 728 | lp2 | ETH/MAR22 | 2000 | 1000 | buy | BID | 2000 | 100 | 729 | lp2 | ETH/MAR22 | 2000 | 1000 | sell | ASK | 2000 | 100 | 730 When the parties place the following orders with ticks: 731 | party | market id | side | volume | price | resulting trades | type | tif | 732 | party1 | ETH/MAR22 | buy | 1 | 999 | 0 | TYPE_LIMIT | TIF_GTC | 733 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 734 | party2 | ETH/MAR22 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 735 | party2 | ETH/MAR22 | sell | 1 | 1001 | 0 | TYPE_LIMIT | TIF_GTC | 736 Then the opening auction period ends for market "ETH/MAR22" 737 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 738 And the mark price should be "1000" for the market "ETH/MAR22" 739 740 # - Check the 'quality' of the supplied liquidity by checking the average score at the end of the epoch. 741 # - Update the network parameter, then check the 'quality' of the supplied liquidity has chnaged. 742 Given the network moves ahead "1" epochs 743 And the liquidity provider fee shares for the market "ETH/MAR22" should be: 744 | party | equity like share | average entry valuation | average score | 745 | lp1 | 0.5 | 1000000 | 0.6249997841 | 746 | lp2 | 0.5 | 2000000 | 0.3750002159 | 747 When the following network parameters are set: 748 | name | value | 749 | market.liquidity.probabilityOfTrading.tau.scaling | 1000 | 750 And the network moves ahead "1" epochs 751 Then the liquidity provider fee shares for the market "ETH/MAR22" should be: 752 | party | equity like share | average entry valuation | average score | 753 | lp1 | 0.5 | 1000000 | 0.5958598141 | 754 | lp2 | 0.5 | 2000000 | 0.4041401859 | 755 756 757