code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0032-PRIM-027.feature (about) 1 Feature: Spot market 2 3 Background: 4 Given time is updated to "2024-01-01T00:00:00Z" 5 6 Given the following network parameters are set: 7 | name | value | 8 | network.markPriceUpdateMaximumFrequency | 0s | 9 | market.value.windowLength | 1h | 10 11 Given the following assets are registered: 12 | id | decimal places | 13 | ETH | 2 | 14 | BTC | 2 | 15 16 Given the fees configuration named "fees-config-1": 17 | maker fee | infrastructure fee | 18 | 0.01 | 0.03 | 19 Given the log normal risk model named "lognormal-risk-model-1": 20 | risk aversion | tau | mu | r | sigma | 21 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 22 And the price monitoring named "price-monitoring-1": 23 | horizon | probability | auction extension | 24 | 60 | 0.999 | 10 | 25 | 120 | 0.9995 | 5 | 26 27 And the spot markets: 28 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | decimal places | position decimal places | sla params | 29 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | 2 | 2 | default-basic | 30 31 # setup accounts 32 Given the parties deposit on asset's general account the following amount: 33 | party | asset | amount | 34 | party1 | ETH | 10000 | 35 | party1 | BTC | 1000 | 36 | party2 | ETH | 10000 | 37 | party4 | BTC | 1000 | 38 | party5 | BTC | 1000 | 39 And the average block duration is "1" 40 41 # Place some orders to get out of auction 42 And the parties place the following orders: 43 | party | market id | side | volume | price | resulting trades | type | tif | 44 | party1 | BTC/ETH | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GFA | 45 | party5 | BTC/ETH | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 46 47 And the opening auction period ends for market "BTC/ETH" 48 When the network moves ahead "1" blocks 49 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 50 And the mark price should be "1000" for the market "BTC/ETH" 51 52 Scenario: Persistent order results in an auction (1 out of 2 triggers breached), orders placed during auction result in trade 53 with indicative price outside the price monitoring bounds of the 2nd trigger, hence auction get extended (by extension 54 period specified for the 2nd trigger), additional orders resulting in more trades (indicative price still outside the 55 2nd trigger bounds) placed, auction concludes. (0032-PRIM-027) 56 57 # Check that the market price bounds are set 58 And the market data for the market "BTC/ETH" should be: 59 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 60 | 1000 | TRADING_MODE_CONTINUOUS | 60 | 995 | 1005 | 0 | 0 | 0 | 61 | 1000 | TRADING_MODE_CONTINUOUS | 120 | 992 | 1008 | 0 | 0 | 0 | 62 63 # Place persistent orders to breach the first trigger level (995->1005) 64 And the parties place the following orders: 65 | party | market id | side | volume | price | resulting trades | type | tif | 66 | party1 | BTC/ETH | buy | 1 | 1006 | 0 | TYPE_LIMIT | TIF_GTC | 67 | party5 | BTC/ETH | sell | 1 | 1006 | 0 | TYPE_LIMIT | TIF_GTC | 68 69 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 70 71 # We are in auction, place crossing orders outside the level of the second trigger (992->1008) 72 # This should trigger an auction extension for 10 more blocks 73 And the parties place the following orders: 74 | party | market id | side | volume | price | resulting trades | type | tif | 75 | party1 | BTC/ETH | buy | 1 | 1009 | 0 | TYPE_LIMIT | TIF_GTC | 76 | party5 | BTC/ETH | sell | 1 | 1009 | 0 | TYPE_LIMIT | TIF_GTC | 77 78 # Move forward 5 blocks should not end the auction due to the extension 79 When the network moves ahead "5" blocks 80 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 81 82 # Add some more order that will match at uncrossing time 83 And the parties place the following orders: 84 | party | market id | side | volume | price | resulting trades | type | tif | 85 | party1 | BTC/ETH | buy | 1 | 1007 | 0 | TYPE_LIMIT | TIF_GTC | 86 | party5 | BTC/ETH | sell | 1 | 1007 | 0 | TYPE_LIMIT | TIF_GTC | 87 88 # Move forward 10 blocks should end the auction 89 When the network moves ahead "10" blocks 90 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 91