code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/negative_price_factor.feature (about)

     1  Feature: Simple negative price factor - future and perpetual 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        | ETH.0.1  | 0              | 1       |
    24      And the markets:
    25        | id       | quote name | asset    | risk model                    | margin calculator         | auction duration | fees         | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      | decimal places | position decimal places |
    26        | BTC/USDT | USDT       | USDT.0.1 | default-log-normal-risk-model | default-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 1e-3                   | 0                         | default-futures | 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  
    35      Given the parties deposit on asset's general account the following amount:
    36        | party | asset    | amount     |
    37        | lp1   | USDT.0.1 | 1000000000 |
    38        | aux1  | USDT.0.1 | 1000000000 |
    39        | aux2  | USDT.0.1 | 1000000000 |
    40  
    41  
    42    Scenario: Check if a futures / perpetual market operates correctly with a negative price factor
    43  
    44      Given the parties submit the following liquidity provision:
    45        | id  | party | market id | commitment amount | fee | lp type    |
    46        | lp1 | lp1   | BTC/USDT  | 200               | 0.1 | submission |
    47      And the parties place the following orders:
    48        | party | market id | side | volume | price | resulting trades | type       | tif     |
    49        | lp1   | BTC/USDT  | buy  | 2      | 100   | 0                | TYPE_LIMIT | TIF_GTC |
    50        | lp1   | BTC/USDT  | sell | 1      | 200   | 0                | TYPE_LIMIT | TIF_GTC |
    51      When the parties place the following orders:
    52        | party | market id | side | volume | price | resulting trades | type       | tif     |
    53        | aux1  | BTC/USDT  | buy  | 1      | 150   | 0                | TYPE_LIMIT | TIF_GTC |
    54        | aux2  | BTC/USDT  | sell | 1      | 150   | 0                | TYPE_LIMIT | TIF_GTC |
    55      And the opening auction period ends for market "BTC/USDT"
    56      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/USDT"
    57  
    58      Given the parties place the following orders:
    59        | party | market id | side | volume | price | resulting trades | type       | tif     |
    60        | aux1  | BTC/USDT  | buy  | 1      | 150   | 0                | TYPE_LIMIT | TIF_GTC |
    61        | aux2  | BTC/USDT  | sell | 1      | 150   | 1                | TYPE_LIMIT | TIF_GTC |
    62      And the network moves ahead "1" blocks
    63      When the network moves ahead "1" epochs
    64      Then the following transfers should happen:
    65        | from | to  | from account                   | to account           | market id | amount | asset    |
    66        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL | BTC/USDT  | 10     | USDT.0.1 |
    67  
    68  
    69    Scenario: Check if a spot market operates correctly with a negative price factor
    70  
    71      Given the parties submit the following liquidity provision:
    72        | id  | party | market id | commitment amount | fee | lp type    |
    73        | lp1 | lp1   | BTC/USDT  | 200               | 0.1 | submission |
    74      And the parties place the following orders:
    75        | party | market id | side | volume | price | resulting trades | type       | tif     |
    76        | lp1   | BTC/USDT  | buy  | 2      | 100   | 0                | TYPE_LIMIT | TIF_GTC |
    77        | lp1   | BTC/USDT  | sell | 1      | 200   | 0                | TYPE_LIMIT | TIF_GTC |
    78      When the parties place the following orders:
    79        | party | market id | side | volume | price | resulting trades | type       | tif     |
    80        | aux1  | BTC/USDT  | buy  | 1      | 150   | 0                | TYPE_LIMIT | TIF_GTC |
    81        | aux2  | BTC/USDT  | sell | 1      | 150   | 0                | TYPE_LIMIT | TIF_GTC |
    82      And the opening auction period ends for market "BTC/USDT"
    83      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/USDT"
    84  
    85      Given the parties place the following orders:
    86        | party | market id | side | volume | price | resulting trades | type       | tif     |
    87        | aux1  | BTC/USDT  | buy  | 1      | 150   | 0                | TYPE_LIMIT | TIF_GTC |
    88        | aux2  | BTC/USDT  | sell | 1      | 150   | 1                | TYPE_LIMIT | TIF_GTC |
    89      And the network moves ahead "1" blocks
    90      When the network moves ahead "1" epochs
    91      Then the following transfers should happen:
    92        | from | to  | from account                   | to account           | market id | amount | asset    |
    93        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL | BTC/USDT  | 10     | USDT.0.1 |