code.vegaprotocol.io/vega@v0.79.0/core/integration/features/price_monitoring/price-monitoring-lognormal2.feature (about) 1 Feature: Price monitoring test using forward risk model (bounds for the valid price moves around price of 100000 for the two horizons are: [95878,104251], [90497,110401]) 2 3 Background: 4 Given time is updated to "2020-10-16T00:00:00Z" 5 And the price monitoring named "my-price-monitoring": 6 | horizon | probability | auction extension | 7 | 3600 | 0.95 | 240 | 8 | 7200 | 0.999 | 360 | 9 And the log normal risk model named "my-log-normal-risk-model": 10 | risk aversion | tau | mu | r | sigma | 11 | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 12 And the markets: 13 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 14 | ETH/DEC20 | ETH | ETH | my-log-normal-risk-model | default-margin-calculator | 3600 | default-none | my-price-monitoring | default-eth-for-future | 1E-4 | 1E-4 | default-futures | 15 And the following network parameters are set: 16 | name | value | 17 | market.auction.minimumDuration | 100 | 18 | network.markPriceUpdateMaximumFrequency | 0s | 19 | limits.markets.maxPeggedOrders | 2 | 20 21 Scenario: Auction triggered by 1st trigger (lower bound breached) 22 Given the parties deposit on asset's general account the following amount: 23 | party | asset | amount | 24 | party1 | ETH | 10000000000 | 25 | party2 | ETH | 10000000000 | 26 | party3 | ETH | 10000000000 | 27 | party4 | ETH | 10000000000 | 28 | aux | ETH | 100000000000 | 29 | aux2 | ETH | 100000000000 | 30 | lpprov | ETH | 100000000000 | 31 32 When the parties submit the following liquidity provision: 33 | id | party | market id | commitment amount | fee | lp type | 34 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 35 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 36 And the parties place the following pegged iceberg orders: 37 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 38 | lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 39 | lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 40 41 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 42 When the parties place the following orders: 43 | party | market id | side | volume | price | resulting trades | type | tif | 44 | aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 45 | aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | 46 47 # Trigger an auction to set the mark price 48 Then the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 49 When the parties place the following orders: 50 | party | market id | side | volume | price | resulting trades | type | tif | reference | 51 | party3 | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 52 | party4 | ETH/DEC20 | buy | 1 | 80000 | 0 | TYPE_LIMIT | TIF_GTC | party4-1 | 53 | party3 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party3-2 | 54 | party4 | ETH/DEC20 | buy | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party4-2 | 55 Then the opening auction period ends for market "ETH/DEC20" 56 And the mark price should be "100000" for the market "ETH/DEC20" 57 58 When the parties cancel the following orders: 59 | party | reference | 60 | party3 | party3-1 | 61 | party4 | party4-1 | 62 63 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 64 And the mark price should be "100000" for the market "ETH/DEC20" 65 66 When the parties place the following orders: 67 | party | market id | side | volume | price | resulting trades | type | tif | reference | 68 | party1 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 69 | party2 | ETH/DEC20 | buy | 1 | 100000 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 70 71 Then the mark price should be "100000" for the market "ETH/DEC20" 72 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 73 74 When the parties place the following orders: 75 | party | market id | side | volume | price | resulting trades | type | tif | reference | 76 | party1 | ETH/DEC20 | sell | 1 | 95878 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 77 | party2 | ETH/DEC20 | buy | 1 | 95878 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 78 79 Then the market data for the market "ETH/DEC20" should be: 80 | mark price | last traded price | trading mode | 81 | 100000 | 95878 | TRADING_MODE_CONTINUOUS | 82 83 When the parties place the following orders: 84 | party | market id | side | volume | price | resulting trades | type | tif | reference | 85 | party1 | ETH/DEC20 | sell | 1 | 104251 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 86 | party2 | ETH/DEC20 | buy | 1 | 104251 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 87 88 Then the market data for the market "ETH/DEC20" should be: 89 | mark price | last traded price | trading mode | 90 | 100000 | 104251 | TRADING_MODE_CONTINUOUS | 91 92 And the market data for the market "ETH/DEC20" should be: 93 | mark price | trading mode | horizon | min bound | max bound | 94 | 100000 | TRADING_MODE_CONTINUOUS | 3600 | 95878 | 104251 | 95 | 100000 | TRADING_MODE_CONTINUOUS | 7200 | 90497 | 110401 | 96 97 # T0 98 Then time is updated to "2020-10-16T02:00:00Z" 99 100 When the parties place the following orders: 101 | party | market id | side | volume | price | resulting trades | type | tif | reference | 102 | party1 | ETH/DEC20 | sell | 1 | 95877 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 103 | party2 | ETH/DEC20 | buy | 1 | 95877 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 104 105 And the mark price should be "104251" for the market "ETH/DEC20" 106 107 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 108 109 #T0 + 4min 110 Then time is updated to "2020-10-16T02:04:00Z" 111 112 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 113 114 #T0 + 4min + 1 second 115 Then time is updated to "2020-10-16T02:04:01Z" 116 117 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 118 119 And the mark price should be "95877" for the market "ETH/DEC20" 120 121 Scenario: Auction triggered by 1st trigger, upper bound 122 Given the parties deposit on asset's general account the following amount: 123 | party | asset | amount | 124 | party1 | ETH | 10000000000 | 125 | party2 | ETH | 10000000000 | 126 | party3 | ETH | 10000000000 | 127 | party4 | ETH | 10000000000 | 128 | aux | ETH | 100000000000 | 129 | lpprov | ETH | 100000000000 | 130 131 When the parties submit the following liquidity provision: 132 | id | party | market id | commitment amount | fee | lp type | 133 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 134 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 135 And the parties place the following pegged iceberg orders: 136 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 137 | lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 138 | lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 139 140 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 141 When the parties place the following orders: 142 | party | market id | side | volume | price | resulting trades | type | tif | 143 | aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 144 | aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | 145 146 # Trigger an auction to set the mark price 147 Then the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 148 149 When the parties place the following orders: 150 | party | market id | side | volume | price | resulting trades | type | tif | reference | 151 | party3 | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 152 | party4 | ETH/DEC20 | buy | 1 | 80000 | 0 | TYPE_LIMIT | TIF_GTC | party4-1 | 153 | party3 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party3-2 | 154 | party4 | ETH/DEC20 | buy | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party4-2 | 155 Then the opening auction period ends for market "ETH/DEC20" 156 And the mark price should be "100000" for the market "ETH/DEC20" 157 158 When the parties cancel the following orders: 159 | party | reference | 160 | party3 | party3-1 | 161 | party4 | party4-1 | 162 163 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 164 165 # T0 166 Then time is updated to "2020-10-16T02:00:00Z" 167 168 When the parties place the following orders: 169 | party | market id | side | volume | price | resulting trades | type | tif | reference | 170 | party1 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 171 | party2 | ETH/DEC20 | buy | 1 | 100000 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 172 Then the mark price should be "100000" for the market "ETH/DEC20" 173 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 174 175 When the parties place the following orders: 176 | party | market id | side | volume | price | resulting trades | type | tif | reference | 177 | party1 | ETH/DEC20 | sell | 1 | 95878 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 178 | party2 | ETH/DEC20 | buy | 1 | 95878 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 179 180 Then the market data for the market "ETH/DEC20" should be: 181 | mark price | last traded price | trading mode | 182 | 100000 | 95878 | TRADING_MODE_CONTINUOUS | 183 184 When the parties place the following orders: 185 | party | market id | side | volume | price | resulting trades | type | tif | reference | 186 | party1 | ETH/DEC20 | sell | 1 | 104251 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 187 | party2 | ETH/DEC20 | buy | 1 | 104251 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 188 189 Then the market data for the market "ETH/DEC20" should be: 190 | mark price | last traded price | trading mode | 191 | 100000 | 104251 | TRADING_MODE_CONTINUOUS | 192 193 And the market data for the market "ETH/DEC20" should be: 194 | mark price | trading mode | horizon | min bound | max bound | 195 | 100000 | TRADING_MODE_CONTINUOUS | 3600 | 95878 | 104251 | 196 | 100000 | TRADING_MODE_CONTINUOUS | 7200 | 90497 | 110401 | 197 198 When the parties place the following orders: 199 | party | market id | side | volume | price | resulting trades | type | tif | reference | 200 | party1 | ETH/DEC20 | sell | 1 | 104252 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 201 | party2 | ETH/DEC20 | buy | 1 | 104252 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 202 203 Then the market data for the market "ETH/DEC20" should be: 204 | mark price | last traded price | trading mode | 205 | 100000 | 104251 | TRADING_MODE_MONITORING_AUCTION | 206 207 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 208 209 #T0 + 4min 210 Then time is updated to "2020-10-16T02:04:00Z" 211 212 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 213 214 #T0 + 4min04s 215 Then time is updated to "2020-10-16T03:04:04Z" 216 217 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 218 219 Then the market data for the market "ETH/DEC20" should be: 220 | mark price | last traded price | trading mode | 221 | 104252 | 104252 | TRADING_MODE_CONTINUOUS | 222 223 Scenario: Non-opening auction can end with wash trades 224 Given the parties deposit on asset's general account the following amount: 225 | party | asset | amount | 226 | party1 | ETH | 10000000000 | 227 | party2 | ETH | 10000000000 | 228 | party3 | ETH | 10000000000 | 229 | party4 | ETH | 10000000000 | 230 | aux | ETH | 100000000000 | 231 | lpprov | ETH | 100000000000 | 232 233 When the parties submit the following liquidity provision: 234 | id | party | market id | commitment amount | fee | lp type | 235 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 236 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 237 And the parties place the following pegged iceberg orders: 238 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 239 | lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 240 | lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 241 242 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 243 When the parties place the following orders: 244 | party | market id | side | volume | price | resulting trades | type | tif | 245 | aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 246 | aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | 247 248 # Trigger an auction to set the mark price 249 Then the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 250 251 When the parties place the following orders with ticks: 252 | party | market id | side | volume | price | resulting trades | type | tif | reference | 253 | party3 | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 254 | party4 | ETH/DEC20 | buy | 1 | 80000 | 0 | TYPE_LIMIT | TIF_GTC | party4-1 | 255 | party3 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party3-2 | 256 | party4 | ETH/DEC20 | buy | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party4-2 | 257 Then the opening auction period ends for market "ETH/DEC20" 258 And the mark price should be "100000" for the market "ETH/DEC20" 259 260 When the parties cancel the following orders: 261 | party | reference | 262 | party3 | party3-1 | 263 | party4 | party4-1 | 264 265 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 266 267 # T0 268 Then time is updated to "2020-10-16T02:00:00Z" 269 270 When the parties place the following orders with ticks: 271 | party | market id | side | volume | price | resulting trades | type | tif | reference | 272 | party1 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 273 | party2 | ETH/DEC20 | buy | 1 | 100000 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 274 Then the mark price should be "100000" for the market "ETH/DEC20" 275 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 276 277 When the parties place the following orders with ticks: 278 | party | market id | side | volume | price | resulting trades | type | tif | reference | 279 | party1 | ETH/DEC20 | sell | 1 | 95878 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 280 | party2 | ETH/DEC20 | buy | 1 | 95878 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 281 282 Then the market data for the market "ETH/DEC20" should be: 283 | mark price | last traded price | trading mode | 284 | 95878 | 95878 | TRADING_MODE_CONTINUOUS | 285 286 When the parties place the following orders with ticks: 287 | party | market id | side | volume | price | resulting trades | type | tif | reference | 288 | party1 | ETH/DEC20 | sell | 1 | 104251 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 289 | party2 | ETH/DEC20 | buy | 1 | 104251 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 290 Then the mark price should be "104251" for the market "ETH/DEC20" 291 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 292 And the market data for the market "ETH/DEC20" should be: 293 | mark price | trading mode | horizon | min bound | max bound | 294 | 104251 | TRADING_MODE_CONTINUOUS | 3600 | 95878 | 104251 | 295 | 104251 | TRADING_MODE_CONTINUOUS | 7200 | 90497 | 110401 | 296 297 When the parties place the following orders with ticks: 298 | party | market id | side | volume | price | resulting trades | type | tif | reference | 299 | party1 | ETH/DEC20 | sell | 1 | 104252 | 0 | TYPE_LIMIT | TIF_GTC | ref-3 | 300 | party2 | ETH/DEC20 | buy | 1 | 104252 | 0 | TYPE_LIMIT | TIF_GTC | ref-4 | 301 302 Then the parties cancel the following orders: 303 | party | reference | 304 | party2 | ref-4 | 305 306 And the market data for the market "ETH/DEC20" should be: 307 | mark price | trading mode | auction trigger | open interest | 308 | 104251 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 4 | 309 310 #T0 + 4min 311 Then time is updated to "2020-10-16T02:04:00Z" 312 313 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 314 315 # Assure no change in target stake due to wash trade 316 And the market data for the market "ETH/DEC20" should be: 317 | mark price | trading mode | auction trigger | open interest | 318 | 104251 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 4 | 319 320 321 # Submit trade so that auction uncrosses with wash trade 322 And the parties place the following orders with ticks: 323 | party | market id | side | volume | price | resulting trades | type | tif | reference | 324 | party1 | ETH/DEC20 | buy | 1 | 104252 | 0 | TYPE_LIMIT | TIF_GTC | ref-5 | 325 326 # Assure no change in target stake due to wash trade 327 And the market data for the market "ETH/DEC20" should be: 328 | mark price | trading mode | auction trigger | open interest | 329 | 104251 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 4 | 330 331 Then the parties should have the following profit and loss: 332 | party | volume | unrealised pnl | realised pnl | 333 | party1 | -3 | -12624 | 0 | 334 | party2 | 3 | 12624 | 0 | 335 | party3 | -1 | -4251 | 0 | 336 | party4 | 1 | 4251 | 0 | 337 | aux | 0 | 0 | 0 | 338 339 #T0 + 4min04s 340 Then time is updated to "2020-10-16T03:04:04Z" 341 342 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 343 344 # Assure uncrossing trade was indeed a wash trade 345 And the following trades should be executed: 346 | buyer | price | size | seller | 347 | party1 | 104252 | 1 | party1 | 348 349 Then the parties should have the following profit and loss: 350 | party | volume | unrealised pnl | realised pnl | 351 | party1 | -3 | -8418 | -4209 | 352 | party2 | 3 | 12627 | 0 | 353 | party3 | -1 | -4252 | 0 | 354 | party4 | 1 | 4252 | 0 | 355 | aux | 0 | 0 | 0 | 356 357 And the mark price should be "104252" for the market "ETH/DEC20" 358 359 Scenario: Auction triggered by 1 trigger (upper bound breached) 360 Given the parties deposit on asset's general account the following amount: 361 | party | asset | amount | 362 | party1 | ETH | 10000000000 | 363 | party2 | ETH | 10000000000 | 364 | party3 | ETH | 10000000000 | 365 | party4 | ETH | 10000000000 | 366 | aux | ETH | 100000000000 | 367 | lpprov | ETH | 100000000000 | 368 369 When the parties submit the following liquidity provision: 370 | id | party | market id | commitment amount | fee | lp type | 371 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 372 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 373 And the parties place the following pegged iceberg orders: 374 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 375 | lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 376 | lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 377 378 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 379 Then the parties place the following orders: 380 | party | market id | side | volume | price | resulting trades | type | tif | 381 | aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 382 | aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | 383 384 # Trigger an auction to set the mark price 385 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 386 When the parties place the following orders: 387 | party | market id | side | volume | price | resulting trades | type | tif | reference | 388 | party3 | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 389 | party4 | ETH/DEC20 | buy | 1 | 80000 | 0 | TYPE_LIMIT | TIF_GTC | party4-1 | 390 | party3 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party3-2 | 391 | party4 | ETH/DEC20 | buy | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party4-2 | 392 Then the opening auction period ends for market "ETH/DEC20" 393 And the mark price should be "100000" for the market "ETH/DEC20" 394 Then the parties cancel the following orders: 395 | party | reference | 396 | party3 | party3-1 | 397 | party4 | party4-1 | 398 399 When the parties place the following orders: 400 | party | market id | side | volume | price | resulting trades | type | tif | reference | 401 | party1 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 402 | party2 | ETH/DEC20 | buy | 1 | 100000 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 403 404 And the mark price should be "100000" for the market "ETH/DEC20" 405 406 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 407 408 When the parties place the following orders: 409 | party | market id | side | volume | price | resulting trades | type | tif | reference | 410 | party1 | ETH/DEC20 | sell | 1 | 95878 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 411 | party2 | ETH/DEC20 | buy | 1 | 95878 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 412 413 And the mark price should be "100000" for the market "ETH/DEC20" 414 415 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 416 417 When the parties place the following orders: 418 | party | market id | side | volume | price | resulting trades | type | tif | reference | 419 | party1 | ETH/DEC20 | sell | 1 | 104251 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 420 | party2 | ETH/DEC20 | buy | 1 | 104251 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 421 422 And the mark price should be "100000" for the market "ETH/DEC20" 423 424 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 425 426 When the parties place the following orders: 427 | party | market id | side | volume | price | resulting trades | type | tif | reference | 428 | party1 | ETH/DEC20 | sell | 1 | 104253 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 429 | party2 | ETH/DEC20 | buy | 1 | 104253 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 430 431 And the mark price should be "100000" for the market "ETH/DEC20" 432 433 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 434 435 #T0 + 4min 436 Then time is updated to "2020-10-16T02:04:00Z" 437 438 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 439 440 #T0 + 4min01s 441 Then time is updated to "2020-10-16T03:04:01Z" 442 443 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 444 445 And the mark price should be "104253" for the market "ETH/DEC20" 446 447 Scenario: Auction triggered by both triggers (lower bound breached) 448 Given the parties deposit on asset's general account the following amount: 449 | party | asset | amount | 450 | party1 | ETH | 10000000000 | 451 | party2 | ETH | 10000000000 | 452 | party3 | ETH | 10000000000 | 453 | party4 | ETH | 10000000000 | 454 | aux | ETH | 100000000000 | 455 | lpprov | ETH | 100000000000 | 456 457 When the parties submit the following liquidity provision: 458 | id | party | market id | commitment amount | fee | lp type | 459 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 460 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 461 And the parties place the following pegged iceberg orders: 462 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 463 | lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 464 | lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 465 466 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 467 Then the parties place the following orders: 468 | party | market id | side | volume | price | resulting trades | type | tif | 469 | aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 470 | aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | 471 472 # Trigger an auction to set the mark price 473 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 474 When the parties place the following orders: 475 | party | market id | side | volume | price | resulting trades | type | tif | reference | 476 | party3 | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 477 | party4 | ETH/DEC20 | buy | 1 | 80000 | 0 | TYPE_LIMIT | TIF_GTC | party4-1 | 478 | party3 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party3-2 | 479 | party4 | ETH/DEC20 | buy | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party4-2 | 480 Then the opening auction period ends for market "ETH/DEC20" 481 And the mark price should be "100000" for the market "ETH/DEC20" 482 483 #T0 484 Then time is updated to "2020-10-16T02:00:00Z" 485 486 Then the parties cancel the following orders: 487 | party | reference | 488 | party3 | party3-1 | 489 | party4 | party4-1 | 490 491 When the parties place the following orders: 492 | party | market id | side | volume | price | resulting trades | type | tif | reference | 493 | party1 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 494 | party2 | ETH/DEC20 | buy | 1 | 100000 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 495 496 And the mark price should be "100000" for the market "ETH/DEC20" 497 498 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 499 500 When the parties place the following orders: 501 | party | market id | side | volume | price | resulting trades | type | tif | reference | 502 | party1 | ETH/DEC20 | sell | 1 | 95878 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 503 | party2 | ETH/DEC20 | buy | 1 | 95878 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 504 505 And the mark price should be "100000" for the market "ETH/DEC20" 506 507 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 508 509 When the parties place the following orders: 510 | party | market id | side | volume | price | resulting trades | type | tif | reference | 511 | party1 | ETH/DEC20 | sell | 1 | 104251 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 512 | party2 | ETH/DEC20 | buy | 1 | 104251 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 513 514 And the mark price should be "100000" for the market "ETH/DEC20" 515 516 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 517 518 When the parties place the following orders: 519 | party | market id | side | volume | price | resulting trades | type | tif | reference | 520 | party1 | ETH/DEC20 | sell | 1 | 90496 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 521 | party2 | ETH/DEC20 | buy | 1 | 90496 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 522 523 And the mark price should be "100000" for the market "ETH/DEC20" 524 525 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 526 527 #T0 + 4min 528 Then time is updated to "2020-10-16T02:04:00Z" 529 530 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 531 532 #T0 + 4min01s 533 Then time is updated to "2020-10-16T02:04:01Z" 534 535 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 536 537 And the mark price should be "100000" for the market "ETH/DEC20" 538 539 #T0 + 10min 540 Then time is updated to "2020-10-16T02:10:00Z" 541 542 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 543 544 #T0 + 10min01s 545 Then time is updated to "2020-10-16T02:10:01Z" 546 547 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 548 549 And the mark price should be "90496" for the market "ETH/DEC20" 550 551 Scenario: Auction triggered by both triggers, upper bound 552 Given the parties deposit on asset's general account the following amount: 553 | party | asset | amount | 554 | party1 | ETH | 10000000000 | 555 | party2 | ETH | 10000000000 | 556 | party3 | ETH | 10000000000 | 557 | party4 | ETH | 10000000000 | 558 | aux | ETH | 100000000000 | 559 | lpprov | ETH | 100000000000 | 560 561 When the parties submit the following liquidity provision: 562 | id | party | market id | commitment amount | fee | lp type | 563 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 564 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 565 And the parties place the following pegged iceberg orders: 566 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 567 | lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 568 | lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 569 570 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 571 Then the parties place the following orders: 572 | party | market id | side | volume | price | resulting trades | type | tif | 573 | aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 574 | aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | 575 576 # Trigger an auction to set the mark price 577 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 578 When the parties place the following orders: 579 | party | market id | side | volume | price | resulting trades | type | tif | reference | 580 | party3 | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 581 | party4 | ETH/DEC20 | buy | 1 | 80000 | 0 | TYPE_LIMIT | TIF_GTC | party4-1 | 582 | party3 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party3-2 | 583 | party4 | ETH/DEC20 | buy | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party4-2 | 584 Then the opening auction period ends for market "ETH/DEC20" 585 And the mark price should be "100000" for the market "ETH/DEC20" 586 587 #T0 588 Then time is updated to "2020-10-16T02:00:00Z" 589 590 Then the parties cancel the following orders: 591 | party | reference | 592 | party3 | party3-1 | 593 | party4 | party4-1 | 594 595 When the parties place the following orders: 596 | party | market id | side | volume | price | resulting trades | type | tif | reference | 597 | party1 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 598 | party2 | ETH/DEC20 | buy | 1 | 100000 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 599 600 And the mark price should be "100000" for the market "ETH/DEC20" 601 602 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 603 604 When the parties place the following orders: 605 | party | market id | side | volume | price | resulting trades | type | tif | reference | 606 | party1 | ETH/DEC20 | sell | 1 | 95878 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 607 | party2 | ETH/DEC20 | buy | 1 | 95878 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 608 609 And the mark price should be "100000" for the market "ETH/DEC20" 610 611 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 612 613 When the parties place the following orders: 614 | party | market id | side | volume | price | resulting trades | type | tif | reference | 615 | party1 | ETH/DEC20 | sell | 1 | 104251 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 616 | party2 | ETH/DEC20 | buy | 1 | 104251 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 617 618 And the mark price should be "100000" for the market "ETH/DEC20" 619 620 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 621 622 And the market data for the market "ETH/DEC20" should be: 623 | horizon | min bound | max bound | 624 | 3600 | 95878 | 104251 | 625 | 7200 | 90497 | 110401 | 626 627 When the parties place the following orders: 628 | party | market id | side | volume | price | resulting trades | type | tif | reference | 629 | party1 | ETH/DEC20 | sell | 1 | 110437 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 630 | party2 | ETH/DEC20 | buy | 1 | 110437 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 631 632 And the mark price should be "100000" for the market "ETH/DEC20" 633 634 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 635 636 #T0 + 4min 637 Then time is updated to "2020-10-16T02:04:00Z" 638 639 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 640 641 And the market data for the market "ETH/DEC20" should be: 642 | horizon | min bound | max bound | 643 | 7200 | 90497 | 110401 | 644 645 #T0 + 4min01s 646 Then time is updated to "2020-10-16T02:04:01Z" 647 648 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 649 650 And the mark price should be "100000" for the market "ETH/DEC20" 651 652 #T0 + 10min 653 Then time is updated to "2020-10-16T02:10:00Z" 654 655 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 656 657 #T0 + 10min01s 658 Then time is updated to "2020-10-16T03:10:01Z" 659 660 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 661 662 And the mark price should be "110437" for the market "ETH/DEC20" 663 664 Scenario: Auction triggered by 1st trigger (lower bound breached), extended by second (upper bound) 665 Given the parties deposit on asset's general account the following amount: 666 | party | asset | amount | 667 | party1 | ETH | 10000000000 | 668 | party2 | ETH | 10000000000 | 669 | party3 | ETH | 10000000000 | 670 | party4 | ETH | 10000000000 | 671 | aux | ETH | 100000000000 | 672 | lpprov | ETH | 100000000000 | 673 674 When the parties submit the following liquidity provision: 675 | id | party | market id | commitment amount | fee | lp type | 676 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 677 | lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission | 678 And the parties place the following pegged iceberg orders: 679 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 680 | lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 681 | lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 682 683 Then the parties submit the following liquidity provision: 684 | id | party | market id | commitment amount | fee | lp type | 685 | lp1 | aux | ETH/DEC20 | 614212 | 0.001 | submission | 686 | lp1 | aux | ETH/DEC20 | 614212 | 0.001 | amendment | 687 And the parties place the following pegged iceberg orders: 688 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 689 | aux | ETH/DEC20 | 2 | 1 | buy | BID | 1 | 10 | 690 | aux | ETH/DEC20 | 2 | 1 | sell | ASK | 1 | 10 | 691 692 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 693 Then the parties place the following orders: 694 | party | market id | side | volume | price | resulting trades | type | tif | 695 | aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 696 | aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | 697 698 # Trigger an auction to set the mark price 699 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 700 When the parties place the following orders: 701 | party | market id | side | volume | price | resulting trades | type | tif | reference | 702 | party3 | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 703 | party4 | ETH/DEC20 | buy | 1 | 80000 | 0 | TYPE_LIMIT | TIF_GTC | party4-1 | 704 | party3 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party3-2 | 705 | party4 | ETH/DEC20 | buy | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GFA | party4-2 | 706 Then the opening auction period ends for market "ETH/DEC20" 707 And the mark price should be "100000" for the market "ETH/DEC20" 708 Then the parties cancel the following orders: 709 | party | reference | 710 | party3 | party3-1 | 711 | party4 | party4-1 | 712 713 When the parties place the following orders: 714 | party | market id | side | volume | price | resulting trades | type | tif | reference | 715 | party1 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 716 | party2 | ETH/DEC20 | buy | 1 | 100000 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 717 718 And the mark price should be "100000" for the market "ETH/DEC20" 719 720 Then time is updated to "2020-10-16T02:00:02Z" 721 722 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 723 724 When the parties place the following orders: 725 | party | market id | side | volume | price | resulting trades | type | tif | reference | 726 | party1 | ETH/DEC20 | sell | 1 | 95878 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 727 | party2 | ETH/DEC20 | buy | 1 | 95878 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 728 729 And the mark price should be "100000" for the market "ETH/DEC20" 730 731 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 732 733 When the parties place the following orders: 734 | party | market id | side | volume | price | resulting trades | type | tif | reference | 735 | party1 | ETH/DEC20 | sell | 1 | 104251 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 736 | party2 | ETH/DEC20 | buy | 1 | 104251 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 737 738 And the mark price should be "100000" for the market "ETH/DEC20" 739 And the market data for the market "ETH/DEC20" should be: 740 | mark price | trading mode | horizon | min bound | max bound | 741 | 100000 | TRADING_MODE_CONTINUOUS | 3600 | 95878 | 104251 | 742 | 100000 | TRADING_MODE_CONTINUOUS | 7200 | 90497 | 110401 | 743 744 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 745 746 When the parties place the following orders: 747 | party | market id | side | volume | price | resulting trades | type | tif | reference | 748 | party1 | ETH/DEC20 | sell | 1 | 95877 | 0 | TYPE_LIMIT | TIF_GTC | cancel-me | 749 | party2 | ETH/DEC20 | buy | 1 | 95877 | 0 | TYPE_LIMIT | TIF_GTC | | 750 751 And the mark price should be "100000" for the market "ETH/DEC20" 752 753 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 754 755 #T0 + 4min 756 Then time is updated to "2020-10-16T02:04:02Z" 757 758 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 759 760 Then the parties cancel the following orders: 761 | party | reference | 762 | party1 | cancel-me | 763 764 # Additional sell volume prevents liquidity extension 765 When the parties place the following orders: 766 | party | market id | side | volume | price | resulting trades | type | tif | reference | 767 | party1 | ETH/DEC20 | sell | 1 | 110431 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 768 | party1 | ETH/DEC20 | sell | 1 | 110430 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 769 | party2 | ETH/DEC20 | buy | 1 | 110430 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 770 771 #T0 + 4min01s 772 Then time is updated to "2020-10-16T02:04:03Z" 773 774 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 775 776 And the mark price should be "100000" for the market "ETH/DEC20" 777 778 #T0 + 10min 779 Then time is updated to "2020-10-16T02:10:02Z" 780 781 Then the market data for the market "ETH/DEC20" should be: 782 | mark price | trading mode | auction trigger | extension trigger | target stake | supplied stake | open interest | 783 | 100000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | AUCTION_TRIGGER_PRICE | 614211 | 90614212 | 4 | 784 785 #T0 + 10min01sec 786 Then time is updated to "2020-10-16T02:10:03Z" 787 788 Then the market data for the market "ETH/DEC20" should be: 789 | mark price | trading mode | auction trigger | extension trigger | target stake | supplied stake | open interest | 790 | 110430 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | AUCTION_TRIGGER_UNSPECIFIED | 614211 | 90614212 | 5 |