code.vegaprotocol.io/vega@v0.79.0/core/integration/features/orders/stoporders_spot-auctions.feature (about) 1 Feature: stop orders 2 Background: 3 Given time is updated to "2020-10-16T00:00:00Z" 4 And the price monitoring named "my-price-monitoring": 5 | horizon | probability | auction extension | 6 | 60 | 0.95 | 240 | 7 | 600 | 0.99 | 360 | 8 And the simple risk model named "my-simple-risk-model": 9 | long | short | max move up | min move down | probability of trading | 10 | 0.11 | 0.1 | 10 | 11 | 0.1 | 11 Given the spot markets: 12 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 13 | BTC/ETH | BTC/ETH | BTC | ETH | my-simple-risk-model | 240 | default-none | my-price-monitoring | default-futures | 14 And the following network parameters are set: 15 | name | value | 16 | market.auction.minimumDuration | 240 | 17 | network.markPriceUpdateMaximumFrequency | 0s | 18 | limits.markets.maxPeggedOrders | 2 | 19 | spam.protection.max.stopOrdersPerMarket | 5 | 20 21 Scenario: A stop order placed either prior to or during an auction will not execute during an auction, nor will it participate in the uncrossing. (0014-ORDT-147) 22 Given the parties deposit on asset's general account the following amount: 23 | party | asset | amount | 24 | party1 | ETH | 10000 | 25 | party2 | ETH | 10000 | 26 | aux | ETH | 100000000000 | 27 | aux2 | ETH | 100000000000 | 28 | lpprov | ETH | 100000000000 | 29 | party1 | BTC | 10000 | 30 | party2 | BTC | 10000 | 31 | aux | BTC | 100000000000 | 32 | aux2 | BTC | 100000000000 | 33 | lpprov | BTC | 100000000000 | 34 35 36 When the parties submit the following liquidity provision: 37 | id | party | market id | commitment amount | fee | lp type | 38 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 39 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 40 41 And the parties place the following pegged iceberg orders: 42 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 43 | lpprov | BTC/ETH | 2 | 1 | buy | BID | 50 | 100 | 44 | lpprov | BTC/ETH | 2 | 1 | sell | ASK | 50 | 100 | 45 46 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 47 Then the parties place the following orders: 48 | party | market id | side | volume | price | resulting trades | type | tif | 49 | aux | BTC/ETH | buy | 1 | 25 | 0 | TYPE_LIMIT | TIF_GTC | 50 | aux | BTC/ETH | sell | 1 | 134 | 0 | TYPE_LIMIT | TIF_GTC | 51 | aux2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 52 | aux | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 53 Then the opening auction period ends for market "BTC/ETH" 54 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 55 And the mark price should be "100" for the market "BTC/ETH" 56 And time is updated to "2020-10-16T00:10:00Z" 57 58 When the parties place the following orders: 59 | party | market id | side | volume | price | resulting trades | type | tif | reference | 60 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 61 | party2 | BTC/ETH | buy | 1 | 100 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 62 63 And the mark price should be "100" for the market "BTC/ETH" 64 65 When the parties place the following orders: 66 | party | market id | side | volume | price | resulting trades | type | tif | reference | 67 | party1 | BTC/ETH | sell | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 68 | party2 | BTC/ETH | buy | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 69 70 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 71 And the mark price should be "100" for the market "BTC/ETH" 72 73 When the parties place the following orders: 74 | party | market id | side | volume | price | resulting trades | type | tif | only | fb trailing | reference | 75 | party1 | BTC/ETH | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_GTC | reduce | 0.05 | tstop | 76 77 # Now we make sure the trailing stop is working correctly 78 Then the stop orders should have the following states 79 | party | market id | status | reference | 80 | party1 | BTC/ETH | STATUS_PENDING | tstop | 81 82 # Now let's move back out of auction 83 When the parties place the following orders: 84 | party | market id | side | volume | price | resulting trades | type | tif | reference | 85 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 86 | party2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 87 88 And time is updated to "2020-10-16T00:15:00Z" 89 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 90 And the mark price should be "105" for the market "BTC/ETH" 91 92 # The stop should still be waiting and has not been triggered 93 Then the stop orders should have the following states 94 | party | market id | status | reference | 95 | party1 | BTC/ETH | STATUS_PENDING | tstop | 96 97 # Move the mark price down by <10% to not trigger the stop orders 98 When the parties place the following orders: 99 | party | market id | side | volume | price | resulting trades | type | tif | 100 | aux2 | BTC/ETH | buy | 1 | 102 | 0 | TYPE_LIMIT | TIF_GTC | 101 | aux | BTC/ETH | sell | 1 | 102 | 1 | TYPE_LIMIT | TIF_GTC | 102 And then the network moves ahead "5" blocks 103 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 104 And the mark price should be "102" for the market "BTC/ETH" 105 106 Then the stop orders should have the following states 107 | party | market id | status | reference | 108 | party1 | BTC/ETH | STATUS_PENDING | tstop | 109 110 # Move the mark price down by 10% to trigger the orders 111 When the parties place the following orders: 112 | party | market id | side | volume | price | resulting trades | type | tif | 113 | aux | BTC/ETH | buy | 2 | 95 | 0 | TYPE_LIMIT | TIF_GTC | 114 | aux2 | BTC/ETH | sell | 2 | 95 | 2 | TYPE_LIMIT | TIF_GTC | 115 And then the network moves ahead "10" blocks 116 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 117 And the mark price should be "95" for the market "BTC/ETH" 118 119 Then the stop orders should have the following states 120 | party | market id | status | reference | 121 | party1 | BTC/ETH | STATUS_TRIGGERED | tstop | 122 123 Scenario: A stop order placed prior to an auction will not execute during an auction, nor will it participate in the uncrossing. (0014-ORDT-149) 124 Given the parties deposit on asset's general account the following amount: 125 | party | asset | amount | 126 | party1 | ETH | 10000 | 127 | party2 | ETH | 10000 | 128 | aux | ETH | 100000000000 | 129 | aux2 | ETH | 100000000000 | 130 | lpprov | ETH | 100000000000 | 131 | party1 | BTC | 10000 | 132 | party2 | BTC | 10000 | 133 | aux | BTC | 100000000000 | 134 | aux2 | BTC | 100000000000 | 135 | lpprov | BTC | 100000000000 | 136 137 When the parties submit the following liquidity provision: 138 | id | party | market id | commitment amount | fee | lp type | 139 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 140 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 141 142 And the parties place the following pegged iceberg orders: 143 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 144 | lpprov | BTC/ETH | 2 | 1 | buy | BID | 50 | 100 | 145 | lpprov | BTC/ETH | 2 | 1 | sell | ASK | 50 | 100 | 146 147 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 148 Then the parties place the following orders: 149 | party | market id | side | volume | price | resulting trades | type | tif | 150 | aux | BTC/ETH | buy | 1 | 25 | 0 | TYPE_LIMIT | TIF_GTC | 151 | aux | BTC/ETH | sell | 1 | 134 | 0 | TYPE_LIMIT | TIF_GTC | 152 | aux2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 153 | aux | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 154 Then the opening auction period ends for market "BTC/ETH" 155 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 156 And the mark price should be "100" for the market "BTC/ETH" 157 And time is updated to "2020-10-16T00:10:00Z" 158 159 When the parties place the following orders: 160 | party | market id | side | volume | price | resulting trades | type | tif | reference | 161 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 162 | party2 | BTC/ETH | buy | 1 | 100 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 163 164 And the mark price should be "100" for the market "BTC/ETH" 165 166 When the parties place the following orders: 167 | party | market id | side | volume | price | resulting trades | type | tif | only | fb trailing | reference | 168 | party1 | BTC/ETH | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_GTC | reduce | 0.05 | tstop | 169 170 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 171 172 When the parties place the following orders: 173 | party | market id | side | volume | price | resulting trades | type | tif | reference | 174 | party1 | BTC/ETH | sell | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 175 | party2 | BTC/ETH | buy | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 176 177 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 178 And the mark price should be "100" for the market "BTC/ETH" 179 180 # Now we make sure the trailing stop is working correctly 181 Then the stop orders should have the following states 182 | party | market id | status | reference | 183 | party1 | BTC/ETH | STATUS_PENDING | tstop | 184 185 # Now let's move back out of auction 186 When the parties place the following orders: 187 | party | market id | side | volume | price | resulting trades | type | tif | reference | 188 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 189 | party2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 190 191 And time is updated to "2020-10-16T00:15:00Z" 192 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 193 And the mark price should be "105" for the market "BTC/ETH" 194 195 # The stop should still be waiting and has not been triggered 196 Then the stop orders should have the following states 197 | party | market id | status | reference | 198 | party1 | BTC/ETH | STATUS_PENDING | tstop | 199 200 # Move the mark price down by <10% to not trigger the stop orders 201 When the parties place the following orders: 202 | party | market id | side | volume | price | resulting trades | type | tif | 203 | aux2 | BTC/ETH | buy | 1 | 102 | 0 | TYPE_LIMIT | TIF_GTC | 204 | aux | BTC/ETH | sell | 1 | 102 | 1 | TYPE_LIMIT | TIF_GTC | 205 And then the network moves ahead "5" blocks 206 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 207 And the mark price should be "102" for the market "BTC/ETH" 208 209 Then the stop orders should have the following states 210 | party | market id | status | reference | 211 | party1 | BTC/ETH | STATUS_PENDING | tstop | 212 213 # Move the mark price down by 10% to trigger the orders 214 When the parties place the following orders: 215 | party | market id | side | volume | price | resulting trades | type | tif | 216 | aux | BTC/ETH | buy | 2 | 95 | 0 | TYPE_LIMIT | TIF_GTC | 217 | aux2 | BTC/ETH | sell | 2 | 95 | 2 | TYPE_LIMIT | TIF_GTC | 218 And then the network moves ahead "10" blocks 219 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 220 And the mark price should be "95" for the market "BTC/ETH" 221 222 Then the stop orders should have the following states 223 | party | market id | status | reference | 224 | party1 | BTC/ETH | STATUS_TRIGGERED | tstop | 225 226 Scenario: A stop order placed during an auction, where the uncrossing price is within the triggering range, will immediately execute following uncrossing. (0014-ORDT-148) 227 Given the parties deposit on asset's general account the following amount: 228 | party | asset | amount | 229 | party1 | ETH | 10000 | 230 | party2 | ETH | 10000 | 231 | aux | ETH | 100000000000 | 232 | aux2 | ETH | 100000000000 | 233 | lpprov | ETH | 100000000000 | 234 | party1 | BTC | 10000 | 235 | party2 | BTC | 10000 | 236 | aux | BTC | 100000000000 | 237 | aux2 | BTC | 100000000000 | 238 | lpprov | BTC | 100000000000 | 239 240 When the parties submit the following liquidity provision: 241 | id | party | market id | commitment amount | fee | lp type | 242 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 243 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 244 245 And the parties place the following pegged iceberg orders: 246 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 247 | lpprov | BTC/ETH | 2 | 1 | buy | BID | 50 | 100 | 248 | lpprov | BTC/ETH | 2 | 1 | sell | ASK | 50 | 100 | 249 250 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 251 Then the parties place the following orders: 252 | party | market id | side | volume | price | resulting trades | type | tif | 253 | aux | BTC/ETH | buy | 1 | 25 | 0 | TYPE_LIMIT | TIF_GTC | 254 | aux | BTC/ETH | sell | 1 | 134 | 0 | TYPE_LIMIT | TIF_GTC | 255 | aux2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 256 | aux | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 257 Then the opening auction period ends for market "BTC/ETH" 258 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 259 And the mark price should be "100" for the market "BTC/ETH" 260 And time is updated to "2020-10-16T00:10:00Z" 261 262 When the parties place the following orders: 263 | party | market id | side | volume | price | resulting trades | type | tif | reference | 264 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 265 | party2 | BTC/ETH | buy | 1 | 100 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 266 267 And the mark price should be "100" for the market "BTC/ETH" 268 269 When the parties place the following orders: 270 | party | market id | side | volume | price | resulting trades | type | tif | reference | 271 | aux | BTC/ETH | sell | 1 | 85 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 272 | aux2 | BTC/ETH | buy | 1 | 85 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 273 274 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 275 And the mark price should be "100" for the market "BTC/ETH" 276 277 When the parties place the following orders: 278 | party | market id | side | volume | price | resulting trades | type | tif | only | fb trailing | reference | 279 | party1 | BTC/ETH | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_IOC | reduce | 0.01 | tstop | 280 281 # Now we make sure the trailing stop is working correctly 282 Then the stop orders should have the following states 283 | party | market id | status | reference | 284 | party1 | BTC/ETH | STATUS_PENDING | tstop | 285 286 # Now let's move back out of auction 287 When the parties place the following orders: 288 | party | market id | side | volume | price | resulting trades | type | tif | reference | 289 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 290 | party2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 291 292 And time is updated to "2020-10-16T00:15:00Z" 293 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 294 And the mark price should be "92" for the market "BTC/ETH" 295 296 # The stop should still be waiting and has not been triggered 297 Then the stop orders should have the following states 298 | party | market id | status | reference | 299 | party1 | BTC/ETH | STATUS_TRIGGERED | tstop | 300 301 # check that the order got submitted (it will be stopped due to self trading) 302 Then the orders should have the following states: 303 | party | market id | side | volume | remaining | price | status | reference | 304 | party1 | BTC/ETH | buy | 1 | 1 | 0 | STATUS_STOPPED | tstop | 305 306 Scenario: A stop order placed prior to an auction, where the uncrossing price is within the triggering range, will immediately execute following uncrossing (0014-ORDT-150) 307 Given the parties deposit on asset's general account the following amount: 308 | party | asset | amount | 309 | party1 | ETH | 10000 | 310 | party2 | ETH | 10000 | 311 | aux | ETH | 100000000000 | 312 | aux2 | ETH | 100000000000 | 313 | lpprov | ETH | 100000000000 | 314 | party1 | BTC | 10000 | 315 | party2 | BTC | 10000 | 316 | aux | BTC | 100000000000 | 317 | aux2 | BTC | 100000000000 | 318 | lpprov | BTC | 100000000000 | 319 320 When the parties submit the following liquidity provision: 321 | id | party | market id | commitment amount | fee | lp type | 322 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 323 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 324 325 And the parties place the following pegged iceberg orders: 326 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 327 | lpprov | BTC/ETH | 2 | 1 | buy | BID | 50 | 100 | 328 | lpprov | BTC/ETH | 2 | 1 | sell | ASK | 50 | 100 | 329 330 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 331 Then the parties place the following orders: 332 | party | market id | side | volume | price | resulting trades | type | tif | 333 | aux | BTC/ETH | buy | 1 | 25 | 0 | TYPE_LIMIT | TIF_GTC | 334 | aux | BTC/ETH | sell | 1 | 134 | 0 | TYPE_LIMIT | TIF_GTC | 335 | aux2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 336 | aux | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 337 Then the opening auction period ends for market "BTC/ETH" 338 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 339 And the mark price should be "100" for the market "BTC/ETH" 340 And time is updated to "2020-10-16T00:10:00Z" 341 342 When the parties place the following orders: 343 | party | market id | side | volume | price | resulting trades | type | tif | only | fb trailing | reference | 344 | party1 | BTC/ETH | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_IOC | reduce | 0.01 | tstop | 345 346 When the parties place the following orders: 347 | party | market id | side | volume | price | resulting trades | type | tif | reference | 348 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 349 | party2 | BTC/ETH | buy | 1 | 100 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 350 351 And the mark price should be "100" for the market "BTC/ETH" 352 353 When the parties place the following orders: 354 | party | market id | side | volume | price | resulting trades | type | tif | reference | 355 | aux | BTC/ETH | sell | 1 | 85 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 356 | aux2 | BTC/ETH | buy | 1 | 85 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 357 358 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 359 And the mark price should be "100" for the market "BTC/ETH" 360 361 # Now we make sure the trailing stop is working correctly 362 Then the stop orders should have the following states 363 | party | market id | status | reference | 364 | party1 | BTC/ETH | STATUS_PENDING | tstop | 365 366 # Now let's move back out of auction 367 When the parties place the following orders: 368 | party | market id | side | volume | price | resulting trades | type | tif | reference | 369 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 370 | party2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 371 372 And time is updated to "2020-10-16T00:15:00Z" 373 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 374 And the mark price should be "92" for the market "BTC/ETH" 375 376 # The stop should still be waiting and has not been triggered 377 Then the stop orders should have the following states 378 | party | market id | status | reference | 379 | party1 | BTC/ETH | STATUS_TRIGGERED | tstop | 380 381 # check that the order got submitted (it will be stopped due to self trading) 382 Then the orders should have the following states: 383 | party | market id | side | volume | remaining | price | status | reference | 384 | party1 | BTC/ETH | buy | 1 | 1 | 0 | STATUS_STOPPED | tstop | 385 386 Scenario: An order with a stop is placed during continuous trading. The market goes into auction. The market exits auction, the condition for triggering the stop is not met. The stop order is still present. (0014-ORDT-151) 387 Given the parties deposit on asset's general account the following amount: 388 | party | asset | amount | 389 | party1 | ETH | 10000 | 390 | party2 | ETH | 10000 | 391 | aux | ETH | 100000000000 | 392 | aux2 | ETH | 100000000000 | 393 | lpprov | ETH | 100000000000 | 394 | party1 | BTC | 10000 | 395 | party2 | BTC | 10000 | 396 | aux | BTC | 100000000000 | 397 | aux2 | BTC | 100000000000 | 398 | lpprov | BTC | 100000000000 | 399 400 When the parties submit the following liquidity provision: 401 | id | party | market id | commitment amount | fee | lp type | 402 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 403 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 404 405 And the parties place the following pegged iceberg orders: 406 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 407 | lpprov | BTC/ETH | 2 | 1 | buy | BID | 50 | 100 | 408 | lpprov | BTC/ETH | 2 | 1 | sell | ASK | 50 | 100 | 409 410 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 411 Then the parties place the following orders: 412 | party | market id | side | volume | price | resulting trades | type | tif | 413 | aux | BTC/ETH | buy | 1 | 25 | 0 | TYPE_LIMIT | TIF_GTC | 414 | aux | BTC/ETH | sell | 1 | 134 | 0 | TYPE_LIMIT | TIF_GTC | 415 | aux2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 416 | aux | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 417 Then the opening auction period ends for market "BTC/ETH" 418 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 419 And the mark price should be "100" for the market "BTC/ETH" 420 And time is updated to "2020-10-16T00:10:00Z" 421 422 When the parties place the following orders: 423 | party | market id | side | volume | price | resulting trades | type | tif | only | fb trailing | reference | 424 | party1 | BTC/ETH | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_GTC | reduce | 0.05 | tstop | 425 426 When the parties place the following orders: 427 | party | market id | side | volume | price | resulting trades | type | tif | reference | 428 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 429 | party2 | BTC/ETH | buy | 1 | 100 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 430 431 And the mark price should be "100" for the market "BTC/ETH" 432 433 When the parties place the following orders: 434 | party | market id | side | volume | price | resulting trades | type | tif | reference | 435 | party1 | BTC/ETH | sell | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 436 | party2 | BTC/ETH | buy | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 437 438 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 439 And the mark price should be "100" for the market "BTC/ETH" 440 441 # Now we make sure the trailing stop is working correctly 442 Then the stop orders should have the following states 443 | party | market id | status | reference | 444 | party1 | BTC/ETH | STATUS_PENDING | tstop | 445 446 # Now let's move back out of auction 447 When the parties place the following orders: 448 | party | market id | side | volume | price | resulting trades | type | tif | reference | 449 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 450 | party2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 451 452 And time is updated to "2020-10-16T00:15:00Z" 453 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 454 And the mark price should be "105" for the market "BTC/ETH" 455 456 # The stop should still be waiting and has not been triggered 457 Then the stop orders should have the following states 458 | party | market id | status | reference | 459 | party1 | BTC/ETH | STATUS_PENDING | tstop | 460 461 Scenario: A stop order placed during the opening auction, will be rejected. For spot products (0014-ORDT-153) 462 Given the parties deposit on asset's general account the following amount: 463 | party | asset | amount | 464 | party1 | ETH | 10000 | 465 466 When the parties place the following orders: 467 | party | market id | side | volume | price | resulting trades | type | tif | only | fb trailing | reference | error | 468 | party1 | BTC/ETH | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_GTC | reduce | 0.05 | tstop | stop orders are not accepted during the opening auction | 469 470 Scenario: A party places a stop order on a market in continuous trading, the market moves to an auction and the party cancels the stop order. When the market exits the auction the party no longer has a stop order. For spot products (0014-ORDT-152) 471 Given the parties deposit on asset's general account the following amount: 472 | party | asset | amount | 473 | party1 | ETH | 10000 | 474 | party2 | ETH | 10000 | 475 | aux | ETH | 100000000000 | 476 | aux2 | ETH | 100000000000 | 477 | lpprov | ETH | 100000000000 | 478 | party1 | BTC | 10000 | 479 | party2 | BTC | 10000 | 480 | aux | BTC | 100000000000 | 481 | aux2 | BTC | 100000000000 | 482 | lpprov | BTC | 100000000000 | 483 484 When the parties submit the following liquidity provision: 485 | id | party | market id | commitment amount | fee | lp type | 486 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 487 | lp1 | lpprov | BTC/ETH | 90000000 | 0.1 | submission | 488 489 And the parties place the following pegged iceberg orders: 490 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 491 | lpprov | BTC/ETH | 2 | 1 | buy | BID | 50 | 100 | 492 | lpprov | BTC/ETH | 2 | 1 | sell | ASK | 50 | 100 | 493 494 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 495 Then the parties place the following orders: 496 | party | market id | side | volume | price | resulting trades | type | tif | 497 | aux | BTC/ETH | buy | 1 | 25 | 0 | TYPE_LIMIT | TIF_GTC | 498 | aux | BTC/ETH | sell | 1 | 134 | 0 | TYPE_LIMIT | TIF_GTC | 499 | aux2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 500 | aux | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 501 Then the opening auction period ends for market "BTC/ETH" 502 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 503 And the mark price should be "100" for the market "BTC/ETH" 504 And time is updated to "2020-10-16T00:10:00Z" 505 506 When the parties place the following orders: 507 | party | market id | side | volume | price | resulting trades | type | tif | only | fb trailing | reference | 508 | party1 | BTC/ETH | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_IOC | reduce | 0.01 | tstop | 509 510 When the parties place the following orders: 511 | party | market id | side | volume | price | resulting trades | type | tif | reference | 512 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 513 | party2 | BTC/ETH | buy | 1 | 100 | 1 | TYPE_LIMIT | TIF_GTC | ref-2 | 514 515 And the mark price should be "100" for the market "BTC/ETH" 516 517 When the parties place the following orders: 518 | party | market id | side | volume | price | resulting trades | type | tif | reference | 519 | aux | BTC/ETH | sell | 1 | 85 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 520 | aux2 | BTC/ETH | buy | 1 | 85 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 521 522 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 523 And the mark price should be "100" for the market "BTC/ETH" 524 525 # Now we make sure the trailing stop is working correctly 526 Then the stop orders should have the following states 527 | party | market id | status | reference | 528 | party1 | BTC/ETH | STATUS_PENDING | tstop | 529 530 # cancel the stop order 531 Then the parties cancel the following stop orders: 532 | party | reference | 533 | party1 | tstop | 534 535 # Now let's move back out of auction 536 When the parties place the following orders: 537 | party | market id | side | volume | price | resulting trades | type | tif | reference | 538 | party1 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-1 | 539 | party2 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | ref-2 | 540 541 And time is updated to "2020-10-16T00:15:00Z" 542 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 543 And the mark price should be "92" for the market "BTC/ETH" 544 545 # The stop should has been cancelled and never triggered 546 Then the stop orders should have the following states 547 | party | market id | status | reference | 548 | party1 | BTC/ETH | STATUS_CANCELLED | tstop |