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

     1  Feature: Indicative price within bounds but mark price outside bounds
     2  
     3    Scenario:
     4  
     5  
     6      Given the average block duration is "1"
     7  
     8      And the following network parameters are set:
     9        | name                                    | value |
    10        | network.markPriceUpdateMaximumFrequency | 0s    |
    11  
    12      And the following assets are registered:
    13        | id       | decimal places | quantum |
    14        | USDT.0.1 | 0              | 1       |
    15  
    16      Given the price monitoring named "pm":
    17        | horizon | probability | auction extension |
    18        | 60      | 0.999999999 | 5                 |
    19        | 60      | 0.999999999 | 5                 |
    20        | 120     | 0.999999999 | 10                |
    21        | 120     | 0.999999999 | 10                |
    22  
    23  
    24  
    25      And the composite price oracles from "0xCAFECAFE1":
    26        | name    | price property  | price type   | price decimals |
    27        | oracle1 | price.USD.value | TYPE_INTEGER | 0              |
    28      And the markets:
    29        | 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 | price type | decay weight | decay power | cash amount | source weights | source staleness tolerance | oracle1 |
    30        | ETH/USDT | USDT       | USDT.0.1 | default-log-normal-risk-model | default-margin-calculator | 1                | default-none | pm               | default-eth-for-future | 1e-3                   | 0                         | default-futures | 0              | 0                       | weight     | 1            | 1           | 0           | 0,0,1,0        | 1m0s,1m0s,1m0s,1m0s        | oracle1 |
    31  
    32  
    33      Given the parties deposit on asset's general account the following amount:
    34        | party  | asset    | amount   |
    35        | aux1   | USDT.0.1 | 10000000 |
    36        | aux2   | USDT.0.1 | 10000000 |
    37        | party1 | USDT.0.1 | 10000000 |
    38        | party2 | USDT.0.1 | 10000000 |
    39  
    40      Given the parties place the following orders:
    41        | party | market id | side | volume | price | resulting trades | type       | tif     |
    42        | aux1  | ETH/USDT  | buy  | 100    | 999   | 0                | TYPE_LIMIT | TIF_GTC |
    43        | aux1  | ETH/USDT  | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    44        | aux2  | ETH/USDT  | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    45        | aux2  | ETH/USDT  | sell | 100    | 1001  | 0                | TYPE_LIMIT | TIF_GTC |
    46      Then the opening auction period ends for market "ETH/USDT"
    47      And the market data for the market "ETH/USDT" should be:
    48        | mark price | trading mode                    | horizon | min bound | max bound |
    49        | 1000       | TRADING_MODE_CONTINUOUS         | 60      | 984       | 1016      |
    50        | 1000       | TRADING_MODE_MONITORING_AUCTION | 120     | 977       | 1024      |
    51        | 1000       | TRADING_MODE_MONITORING_AUCTION | 120     | 977       | 1024      |
    52  
    53      Then the oracles broadcast data with block time signed with "0xCAFECAFE1":
    54        | name            | value | time offset |
    55        | price.USD.value | 800   | 0s          |
    56  
    57  
    58      Given the network moves ahead "1" blocks
    59      # And the parties place the following orders:
    60      #   | party  | market id | side | volume | price | resulting trades | type       | tif     |
    61      #   | party1 | ETH/USDT  | buy  | 1      | 1001  | 0                | TYPE_LIMIT | TIF_GTC |
    62      And the market data for the market "ETH/USDT" should be:
    63        | mark price | trading mode                    | horizon | min bound | max bound | indicative price | timestamp           | auction start       | auction end         |
    64        | 1000       | TRADING_MODE_MONITORING_AUCTION | 60      | 984       | 1016      | 0                | 1575072003000000000 | 1575072002000000000 | 1575072007000000000 |
    65        | 1000       | TRADING_MODE_MONITORING_AUCTION | 120     | 977       | 1024      | 0                | 1575072003000000000 | 1575072002000000000 | 1575072007000000000 |
    66        | 1000       | TRADING_MODE_MONITORING_AUCTION | 120     | 977       | 1024      | 0                | 1575072003000000000 | 1575072002000000000 | 1575072007000000000 |
    67  
    68      # Advance 5 seconds to end of auction
    69      Given the network moves ahead "5" blocks
    70      # Auction ends at indicative price, trades excecuted
    71      # And the following trades should be executed:
    72      #   | buyer  | price | size | seller |
    73      #   | party1 | 1001  | 1    | aux2   |
    74      # Market instantly reenters auction as latest price from oracle is outside bounds
    75      And the market data for the market "ETH/USDT" should be:
    76        | mark price | trading mode                    | horizon | min bound | max bound | indicative price | timestamp           | auction start       | auction end         |
    77        | 1000       | TRADING_MODE_MONITORING_AUCTION | 60      | 984       | 1016      | 0                | 1575072008000000000 | 1575072008000000000 | 1575072013000000000 |
    78        | 1000       | TRADING_MODE_MONITORING_AUCTION | 120     | 977       | 1024      | 0                | 1575072008000000000 | 1575072008000000000 | 1575072013000000000 |
    79        | 1000       | TRADING_MODE_MONITORING_AUCTION | 120     | 977       | 1024      | 0                | 1575072008000000000 | 1575072008000000000 | 1575072013000000000 |
    80  
    81  
    82  
    83  
    84