code.vegaprotocol.io/vega@v0.79.0/core/integration/features/auctions/0094-PRAC-008.feature (about) 1 Feature: When a market's trigger and extension_trigger are set to represent that the market went into auction due to the price monitoring mechanism and was later extended by the same mechanism and the auction is meant to finish at 11am, but now a long block auction is being triggered so that it ends at 10am then this market is unaffected in any way. (0094-PRAC-008) When market is in a price monitoring auction which is meant to finish at 10am, but prior to that time a long block auction finishing at 11am gets triggered then the market stays in auction till 11am, it's auction trigger is listed as price monitoring auction and it's extension trigger is listed as long block auction. (0094-PRAC-006). 2 3 4 Background: 5 Given the following assets are registered: 6 | id | decimal places | 7 | ETH | 5 | 8 And the long block duration table is: 9 | threshold | duration | 10 | 3s | 1m | 11 | 40s | 10m | 12 | 2m | 1h | 13 And the price monitoring named "my-price-monitoring-2": 14 | horizon | probability | auction extension | 15 | 360 | 0.95 | 3600 | 16 And the price monitoring named "my-price-monitoring": 17 | horizon | probability | auction extension | 18 | 360 | 0.95 | 61 | 19 And the log normal risk model named "my-log-normal-risk-model": 20 | risk aversion | tau | mu | r | sigma | 21 | 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 | 22 And the simple risk model named "my-simple-risk-model": 23 | long | short | max move up | min move down | probability of trading | 24 | 0.08628781058136630000 | 0.09370922348428490000 | -1 | -1 | 0.2 | 25 And the fees configuration named "my-fees-config": 26 | maker fee | infrastructure fee | 27 | 0.004 | 0.001 | 28 # create 2 markets 29 And the markets: 30 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | decimal places | linear slippage factor | quadratic slippage factor | sla params | 31 | ETH/DEC19 | ETH | ETH | my-simple-risk-model | default-margin-calculator | 1 | my-fees-config | my-price-monitoring-2 | default-eth-for-future | 2 | 0.25 | 0 | default-futures | 32 | ETH/DEC20 | ETH | ETH | my-simple-risk-model | default-margin-calculator | 1 | my-fees-config | my-price-monitoring | default-eth-for-future | 2 | 0.25 | 0 | default-futures | 33 And the following network parameters are set: 34 | name | value | 35 | limits.markets.maxPeggedOrders | 2 | 36 And the average block duration is "1" 37 And the parties deposit on asset's general account the following amount: 38 | party | asset | amount | 39 | party1 | ETH | 1000000000000 | 40 | party2 | ETH | 1000000000000 | 41 | party3 | ETH | 1000000000000 | 42 | party4 | ETH | 1000000000000 | 43 | party5 | ETH | 1000000000000 | 44 | party6 | ETH | 1000000000000 | 45 | lpprov1 | ETH | 1000000000000 | 46 | lpprov2 | ETH | 1000000000000 | 47 And the parties submit the following liquidity provision: 48 | id | party | market id | commitment amount | fee | lp type | 49 | lp1 | lpprov1 | ETH/DEC20 | 1873996252 | 0.1 | submission | 50 | lp2 | lpprov2 | ETH/DEC19 | 1873996252 | 0.1 | submission | 51 And the parties place the following pegged iceberg orders: 52 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 53 | lpprov1 | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 | 54 | lpprov1 | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 | 55 | lpprov2 | ETH/DEC19 | 2 | 1 | buy | MID | 50 | 100 | 56 | lpprov2 | ETH/DEC19 | 2 | 1 | sell | MID | 50 | 100 | 57 58 @LBA 59 Scenario: When market is in a price monitoring auction which is meant to finish at 10am, but prior to that time a long block auction finishing at 11am gets triggered then the market stays in auction till 11am, it's auction trigger is listed as price monitoring auction and it's extension trigger is listed as long block auction. (0094-PRAC-006). 0094-PRAC-008: Long block auction exceeds the price monitoring auction duration, the auction gets extended. 60 # place orders and generate trades - slippage 100 61 When the parties place the following orders: 62 | party | market id | side | volume | price | resulting trades | type | tif | reference | 63 | party1 | ETH/DEC20 | buy | 1 | 999500 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-1 | 64 | party1 | ETH/DEC20 | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-2 | 65 | party2 | ETH/DEC20 | sell | 2 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 66 | party3 | ETH/DEC19 | buy | 1 | 999500 | 0 | TYPE_LIMIT | TIF_GTC | t3-b-1 | 67 | party3 | ETH/DEC19 | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t3-b-2 | 68 | party4 | ETH/DEC19 | sell | 2 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t4-s-1 | 69 Then the market data for the market "ETH/DEC20" should be: 70 | trading mode | supplied stake | target stake | 71 | TRADING_MODE_OPENING_AUCTION | 1873996252 | 937000000 | 72 And the market data for the market "ETH/DEC19" should be: 73 | trading mode | supplied stake | target stake | 74 | TRADING_MODE_OPENING_AUCTION | 1873996252 | 937000000 | 75 76 When the network moves ahead "2" blocks 77 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 78 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 79 #And debug detailed orderbook volumes for market "ETH/DEC20" 80 And the order book should have the following volumes for market "ETH/DEC20": 81 | volume | price | side | 82 | 2 | 999400 | buy | 83 | 1 | 999500 | buy | 84 | 1 | 1000000 | sell | 85 | 2 | 1000100 | sell | 86 #And debug detailed orderbook volumes for market "ETH/DEC19" 87 And the order book should have the following volumes for market "ETH/DEC19": 88 | volume | price | side | 89 | 1 | 999500 | buy | 90 | 2 | 999650 | buy | 91 | 2 | 999850 | sell | 92 | 1 | 1000000 | sell | 93 94 And the following trades should be executed: 95 | buyer | price | size | seller | 96 | party1 | 1000000 | 1 | party2 | 97 | party3 | 1000000 | 1 | party4 | 98 And the mark price should be "1000000" for the market "ETH/DEC19" 99 And the market data for the market "ETH/DEC20" should be: 100 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 101 | 1000000 | TRADING_MODE_CONTINUOUS | 360 | 1000000 | 999999 | 937000000 | 1873996252 | 1 | 102 103 When the network moves ahead "10" blocks 104 Then the parties place the following orders: 105 | party | market id | side | volume | price | resulting trades | type | tif | reference | 106 | party5 | ETH/DEC20 | buy | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t5-b-1 | 107 | party6 | ETH/DEC20 | sell | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t6-s-1 | 108 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 109 And the market data for the market "ETH/DEC20" should be: 110 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | auction end | 111 | 1000000 | TRADING_MODE_MONITORING_AUCTION | 360 | 1000000 | 999999 | 1873996252 | 1873996252 | 1 | 61 | 112 113 When the network moves ahead "2" blocks 114 Then the market data for the market "ETH/DEC20" should be: 115 | mark price | trading mode | target stake | supplied stake | open interest | auction end | 116 | 1000000 | TRADING_MODE_MONITORING_AUCTION | 1873996252 | 1873996252 | 1 | 61 | 117 118 When the previous block duration was "90s" 119 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 120 And the trading mode should be "TRADING_MODE_LONG_BLOCK_AUCTION" for the market "ETH/DEC19" 121 122 # We know what the volume on the books look like, but let's submit some orders that will trade regardless 123 # And we'll see no trades happen 124 When the parties place the following orders: 125 | party | market id | side | volume | price | resulting trades | type | tif | reference | 126 | party1 | ETH/DEC20 | buy | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-3 | 127 | party2 | ETH/DEC20 | sell | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-2 | 128 129 # ETH/DEC19 - demonstrates 0094-PRAC-008 130 # ETH/DEC20 - demonstrates 0094-PRAC-006 131 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 132 And the trading mode should be "TRADING_MODE_LONG_BLOCK_AUCTION" for the market "ETH/DEC19" 133 And the market data for the market "ETH/DEC20" should be: 134 | mark price | trading mode | target stake | supplied stake | open interest | auction end | extension trigger | 135 | 1000000 | TRADING_MODE_MONITORING_AUCTION | 2810994378 | 1873996252 | 1 | 602 | AUCTION_TRIGGER_LONG_BLOCK | 136 137 # move ahead another minute 138 When the network moves ahead "1" blocks 139 # This is strange, it looks as though the trade went through at the end of the auction, but in doing so triggered a second auction? 140 Then the market data for the market "ETH/DEC20" should be: 141 | mark price | trading mode | target stake | supplied stake | open interest | extension trigger | 142 | 1000000 | TRADING_MODE_MONITORING_AUCTION | 2810994378 | 1873996252 | 1 | AUCTION_TRIGGER_LONG_BLOCK | 143 144 When the network moves ahead "9m50s" with block duration of "2s" 145 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 146 And the trading mode should be "TRADING_MODE_LONG_BLOCK_AUCTION" for the market "ETH/DEC19" 147 148 # still in auction, but if we move ahead... 149 When the network moves ahead "11" blocks 150 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 151 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20" 152 # now move further ahead to leave price auction 153 # We have moved 1 blocks + 9m50s (9m51) + 11 blocks for a total of 10m2s, the total auction duration 154 # was 602s, or 10m2s. Leaving the auction will trigger an extension of another 61 seconds 155 # So the total time in auction would be 11m2s. At this point we're still 61s short. 156 When the network moves ahead "61" blocks 157 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 158 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 159 And the following trades should be executed: 160 | buyer | price | size | seller | 161 | party5 | 999998 | 1 | party6 | 162 | party1 | 999998 | 1 | party2 | 163 164 165 @LBA 166 Scenario: 0094-PRAC-008: Long block auction does not exceed the price monitoring auction duration, the auction does not get extended. 167 # place orders and generate trades - slippage 100 168 When the parties place the following orders: 169 | party | market id | side | volume | price | resulting trades | type | tif | reference | 170 | party1 | ETH/DEC20 | buy | 1 | 999500 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-1 | 171 | party1 | ETH/DEC20 | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-2 | 172 | party2 | ETH/DEC20 | sell | 2 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 173 | party3 | ETH/DEC19 | buy | 1 | 999500 | 0 | TYPE_LIMIT | TIF_GTC | t3-b-1 | 174 | party3 | ETH/DEC19 | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t3-b-2 | 175 | party4 | ETH/DEC19 | sell | 2 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t4-s-1 | 176 Then the market data for the market "ETH/DEC20" should be: 177 | trading mode | supplied stake | target stake | 178 | TRADING_MODE_OPENING_AUCTION | 1873996252 | 937000000 | 179 And the market data for the market "ETH/DEC19" should be: 180 | trading mode | supplied stake | target stake | 181 | TRADING_MODE_OPENING_AUCTION | 1873996252 | 937000000 | 182 183 When the network moves ahead "2" blocks 184 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 185 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 186 #And debug detailed orderbook volumes for market "ETH/DEC20" 187 And the order book should have the following volumes for market "ETH/DEC20": 188 | volume | price | side | 189 | 2 | 999400 | buy | 190 | 1 | 999500 | buy | 191 | 1 | 1000000 | sell | 192 | 2 | 1000100 | sell | 193 #And debug detailed orderbook volumes for market "ETH/DEC19" 194 And the order book should have the following volumes for market "ETH/DEC19": 195 | volume | price | side | 196 | 1 | 999500 | buy | 197 | 2 | 999650 | buy | 198 | 2 | 999850 | sell | 199 | 1 | 1000000 | sell | 200 201 And the following trades should be executed: 202 | buyer | price | size | seller | 203 | party1 | 1000000 | 1 | party2 | 204 | party3 | 1000000 | 1 | party4 | 205 And the mark price should be "1000000" for the market "ETH/DEC20" 206 And the market data for the market "ETH/DEC19" should be: 207 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 208 | 1000000 | TRADING_MODE_CONTINUOUS | 360 | 1000000 | 999999 | 937000000 | 1873996252 | 1 | 209 210 When the network moves ahead "10" blocks 211 Then the parties place the following orders: 212 | party | market id | side | volume | price | resulting trades | type | tif | reference | 213 | party5 | ETH/DEC19 | buy | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t5-b-1 | 214 | party6 | ETH/DEC19 | sell | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t6-s-1 | 215 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC19" 216 And the market data for the market "ETH/DEC19" should be: 217 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | auction end | 218 | 1000000 | TRADING_MODE_MONITORING_AUCTION | 360 | 1000000 | 999999 | 1873996252 | 1873996252 | 1 | 3600 | 219 220 When the network moves ahead "2" blocks 221 Then the market data for the market "ETH/DEC19" should be: 222 | mark price | trading mode | target stake | supplied stake | open interest | auction end | 223 | 1000000 | TRADING_MODE_MONITORING_AUCTION | 1873996252 | 1873996252 | 1 | 3600 | 224 225 When the previous block duration was "40s" 226 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC19" 227 And the trading mode should be "TRADING_MODE_LONG_BLOCK_AUCTION" for the market "ETH/DEC20" 228 229 # We know what the volume on the books look like, but let's submit some orders that will trade regardless 230 # And we'll see no trades happen 231 When the parties place the following orders: 232 | party | market id | side | volume | price | resulting trades | type | tif | reference | 233 | party1 | ETH/DEC19 | buy | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-3 | 234 | party2 | ETH/DEC19 | sell | 1 | 999998 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-2 | 235 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC19" 236 And the trading mode should be "TRADING_MODE_LONG_BLOCK_AUCTION" for the market "ETH/DEC20" 237 238 # the monitoring auction is not extended 239 When the network moves ahead "1" blocks 240 Then the market data for the market "ETH/DEC19" should be: 241 | mark price | trading mode | target stake | supplied stake | open interest | auction end | extension trigger | 242 | 1000000 | TRADING_MODE_MONITORING_AUCTION | 2810994378 | 1873996252 | 1 | 3600 | AUCTION_TRIGGER_UNSPECIFIED | 243 244 When the network moves ahead "9m50s" with block duration of "2s" 245 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC19" 246 And the trading mode should be "TRADING_MODE_LONG_BLOCK_AUCTION" for the market "ETH/DEC20" 247 248 # still in auction, 1m10 seconds later, though: 249 When the network moves ahead "71" blocks 250 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC19" 251 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 252 253 # we still have to leave the monitoring auction, so let's move ahead a bit 254 When the network moves ahead "2h" with block duration of "10m" 255 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 256 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 257 And the following trades should be executed: 258 | buyer | price | size | seller | 259 | party5 | 999998 | 1 | party6 | 260 | party1 | 999998 | 1 | party2 | 261