code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/negative_price_factor_spot.feature (about) 1 Feature: Simple negative price factor - spot markets 2 3 Test simply checks if an asset and market is configured such that the market 4 decimal places are greater than the asset decimal places, yielding a 5 negative price factor, the market still operates correctly. 6 7 This is validated by checking an LP meets their obligation when their orders 8 are sized and priced correctly. i.e. they are not penalised at the end of 9 the epoch. 10 11 Background: 12 13 Given time is updated to "2024-01-01T00:00:00Z" 14 And the average block duration is "1" 15 And the following network parameters are set: 16 | name | value | 17 | validators.epoch.length | 10s | 18 | market.liquidity.providersFeeCalculationTimeStep | 5s | 19 20 Given the following assets are registered: 21 | id | decimal places | quantum | 22 | USDT.0.1 | 0 | 1 | 23 | BTC.0.1 | 0 | 1 | 24 And the spot markets: 25 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | decimal places | position decimal places | 26 | BTC/USDT | ETH/USDT | BTC.0.1 | USDT.0.1 | default-log-normal-risk-model | 1 | default-none | default-none | default-basic | 2 | -2 | 27 28 29 Given the parties deposit on asset's general account the following amount: 30 | party | asset | amount | 31 | lp1 | USDT.0.1 | 1000000000 | 32 | aux1 | USDT.0.1 | 1000000000 | 33 | aux2 | USDT.0.1 | 1000000000 | 34 | lp1 | BTC.0.1 | 1000000000 | 35 | aux1 | BTC.0.1 | 1000000000 | 36 | aux2 | BTC.0.1 | 1000000000 | 37 38 Given the parties deposit on asset's general account the following amount: 39 | party | asset | amount | 40 | lp1 | USDT.0.1 | 1000000000 | 41 | aux1 | USDT.0.1 | 1000000000 | 42 | aux2 | USDT.0.1 | 1000000000 | 43 44 45 Scenario: Check if a futures / perpetual market operates correctly with a negative price factor 46 47 Given the parties submit the following liquidity provision: 48 | id | party | market id | commitment amount | fee | lp type | 49 | lp1 | lp1 | BTC/USDT | 200 | 0.1 | submission | 50 And the parties place the following orders: 51 | party | market id | side | volume | price | resulting trades | type | tif | 52 | lp1 | BTC/USDT | buy | 2 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 53 | lp1 | BTC/USDT | sell | 1 | 200 | 0 | TYPE_LIMIT | TIF_GTC | 54 When the parties place the following orders: 55 | party | market id | side | volume | price | resulting trades | type | tif | 56 | aux1 | BTC/USDT | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 57 | aux2 | BTC/USDT | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 58 And the opening auction period ends for market "BTC/USDT" 59 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/USDT" 60 61 Given the parties place the following orders: 62 | party | market id | side | volume | price | resulting trades | type | tif | 63 | aux1 | BTC/USDT | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 64 | aux2 | BTC/USDT | sell | 1 | 150 | 1 | TYPE_LIMIT | TIF_GTC | 65 And the network moves ahead "1" blocks 66 When the network moves ahead "1" epochs 67 Then the following transfers should happen: 68 | from | to | from account | to account | market id | amount | asset | 69 | lp1 | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL | BTC/USDT | 10 | USDT.0.1 | 70 71 72 Scenario: Check if a spot market operates correctly with a negative price factor 73 74 Given the parties submit the following liquidity provision: 75 | id | party | market id | commitment amount | fee | lp type | 76 | lp1 | lp1 | BTC/USDT | 200 | 0.1 | submission | 77 And the parties place the following orders: 78 | party | market id | side | volume | price | resulting trades | type | tif | 79 | lp1 | BTC/USDT | buy | 2 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 80 | lp1 | BTC/USDT | sell | 1 | 200 | 0 | TYPE_LIMIT | TIF_GTC | 81 When the parties place the following orders: 82 | party | market id | side | volume | price | resulting trades | type | tif | 83 | aux1 | BTC/USDT | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 84 | aux2 | BTC/USDT | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 85 And the opening auction period ends for market "BTC/USDT" 86 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/USDT" 87 88 Given the parties place the following orders: 89 | party | market id | side | volume | price | resulting trades | type | tif | 90 | aux1 | BTC/USDT | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 91 | aux2 | BTC/USDT | sell | 1 | 150 | 1 | TYPE_LIMIT | TIF_GTC | 92 And the network moves ahead "1" blocks 93 When the network moves ahead "1" epochs 94 Then the following transfers should happen: 95 | from | to | from account | to account | market id | amount | asset | 96 | lp1 | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL | BTC/USDT | 10 | USDT.0.1 |