code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0032-PRIM-024.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 | 3600 | 0.999 | 1 | 25 26 And the spot markets: 27 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | decimal places | position decimal places | sla params | 28 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | 2 | 2 | default-basic | 29 30 # setup accounts 31 Given the parties deposit on asset's general account the following amount: 32 | party | asset | amount | 33 | party1 | ETH | 10000 | 34 | party1 | BTC | 1000 | 35 | party2 | ETH | 10000 | 36 | party4 | BTC | 1000 | 37 | party5 | BTC | 1000 | 38 And the average block duration is "1" 39 40 # Place some orders to get out of auction 41 And the parties place the following orders: 42 | party | market id | side | volume | price | resulting trades | type | tif | 43 | party1 | BTC/ETH | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GFA | 44 | party5 | BTC/ETH | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 45 46 And the opening auction period ends for market "BTC/ETH" 47 When the network moves ahead "1" blocks 48 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 49 And the mark price should be "1000" for the market "BTC/ETH" 50 51 Scenario: The market continues in regular fashion once price protection auction period ends and price monitoring bounds 52 get reset based on last traded price (which may come from the auction itself if it resulted in trades) (0032-PRIM-024) 53 54 # Check that the market price bounds are set 55 And the market data for the market "BTC/ETH" should be: 56 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 57 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 959 | 1042 | 0 | 0 | 0 | 58 59 # Place out of bounds orders to force a price monitoring auction 60 Given the parties place the following orders: 61 | party | market id | side | volume | price | resulting trades | type | tif | reference | error | 62 | party1 | BTC/ETH | buy | 1 | 1050 | 0 | TYPE_LIMIT | TIF_GTC | pr-buy | | 63 | party5 | BTC/ETH | sell | 1 | 1050 | 0 | TYPE_LIMIT | TIF_GTC | pr-sell | | 64 65 When the network moves ahead "1" blocks 66 Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 67 68 # Both orders are still alive inside the auction 69 And the orders should have the following states: 70 | party | market id | reference | side | volume | remaining | price | status | 71 | party1 | BTC/ETH | pr-buy | buy | 1 | 1 | 1050 | STATUS_ACTIVE | 72 | party5 | BTC/ETH | pr-sell | sell | 1 | 1 | 1050 | STATUS_ACTIVE | 73 74 # Cancel all the orders 75 Then the parties cancel the following orders: 76 | party | reference | 77 | party1 | pr-buy | 78 | party5 | pr-sell | 79 80 # Place some orders inside the price range that cross 81 Given the parties place the following orders: 82 | party | market id | side | volume | price | resulting trades | type | tif | reference | error | 83 | party1 | BTC/ETH | buy | 1 | 1030 | 0 | TYPE_LIMIT | TIF_GTC | pr-buy2 | | 84 | party5 | BTC/ETH | sell | 1 | 1030 | 0 | TYPE_LIMIT | TIF_GTC | pr-sell2 | | 85 86 When the network moves ahead "1" blocks 87 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 88 89 # Check that the mark price has moved 90 And the mark price should be "1030" for the market "BTC/ETH" 91 92 And the orders should have the following states: 93 | party | market id | reference | side | volume | remaining | price | status | 94 | party1 | BTC/ETH | pr-buy2 | buy | 1 | 0 | 1030 | STATUS_FILLED | 95 | party5 | BTC/ETH | pr-sell2 | sell | 1 | 0 | 1030 | STATUS_FILLED | 96 97 # Check that the market price bounds are set to higher levels because the mark price has gone up 98 And the market data for the market "BTC/ETH" should be: 99 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 100 | 1030 | TRADING_MODE_CONTINUOUS | 3600 | 988 | 1074 | 0 | 0 | 0 | 101