code.vegaprotocol.io/vega@v0.79.0/core/integration/features/price_monitoring/0032-PRIM-014.feature (about)

     1  Feature: When market is in price monitoring auction, change of a risk model or any of its parameters doesn't affect the previously calculated
     2           auction end time, any remaining price monitoring bounds cannot extend the auction further. Upon uncrossing price monitoring bounds get
     3           reset using the updated parameter values. (0032-PRIM-014)
     4  
     5    Background:
     6        Given time is updated to "2024-01-01T00:00:00Z"
     7  
     8        Given the following assets are registered:
     9        | id  | decimal places |
    10        | ETH | 2              |
    11  
    12      And the price monitoring named "my-price-monitoring":
    13        | horizon | probability | auction extension |
    14        | 30      | 0.999       | 10                |
    15        | 60      | 0.999       | 20                |
    16        | 90      | 0.999       | 40                |
    17        | 120     | 0.999       | 80                |
    18  
    19      And the log normal risk model named "my-log-normal-risk-model":
    20        | risk aversion | tau                    | mu | r     | sigma |
    21        | 0.000001      | 0.00011407711613050422 | 0  | 0.016 | 2.0   |
    22  
    23      And the log normal risk model named "my-log-normal-risk-model-2":
    24        | risk aversion | tau                    | mu | r     | sigma |
    25        | 0.000001      | 0.00011407711613050421 | 0  | 0.016 | 2.0   |
    26      
    27      And the markets:
    28        | id        | quote name | asset | risk model                    | margin calculator         | auction duration | fees         | price monitoring      | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
    29        | ETH/DEC24 | ETH        | ETH   | default-log-normal-risk-model | default-margin-calculator | 1                | default-none | my-price-monitoring   | default-eth-for-future | 0.01                   | 0                         | default-futures |
    30      
    31      And the following network parameters are set:
    32        | name                                    | value |
    33        | market.auction.minimumDuration          | 10    |
    34        | limits.markets.maxPeggedOrders          | 2     |
    35        | network.markPriceUpdateMaximumFrequency | 0s    |
    36        | market.value.windowLength               | 1h    |
    37  
    38      Given the parties deposit on asset's general account the following amount:
    39        | party  | asset | amount       |
    40        | party1 | ETH   | 10000000000  |
    41        | party5 | ETH   | 10000000000  |
    42        | lp1    | ETH   | 10000000000  |
    43        | lp2    | ETH   | 10000000000  |
    44  
    45      When the parties submit the following liquidity provision:
    46        | id  | party  | market id | commitment amount | fee | lp type    |
    47        | lpp1 | lp1 | ETH/DEC24 | 90000000          | 0.1 | submission |
    48        | lpp2 | lp2 | ETH/DEC24 | 90000000          | 0.1 | submission |
    49  
    50      And the parties place the following pegged iceberg orders:
    51        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    52        | lp1 | ETH/DEC24 | 2         | 1                    | buy  | BID              | 50         | 500    |
    53        | lp2 | ETH/DEC24 | 2         | 1                    | sell | ASK              | 50         | 500    |
    54  
    55    Scenario: 
    56  
    57      # Place some orders to get out of auction
    58      And the parties place the following orders:
    59        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    60        | party1 | ETH/DEC24 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GFA |
    61        | party5 | ETH/DEC24 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    62  
    63      And the opening auction period ends for market "ETH/DEC24"
    64      When the network moves ahead "1" blocks
    65      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC24"
    66      And the mark price should be "1000" for the market "ETH/DEC24"
    67  
    68      # Check that the market price bounds are set 
    69      And the market data for the market "ETH/DEC24" should be:
    70        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest | auction start | auction end |
    71        | 1000       | TRADING_MODE_CONTINUOUS | 30      | 994       | 1006      | 74340        | 180000000      | 1             | 0             | 0           |
    72        | 1000       | TRADING_MODE_CONTINUOUS | 60      | 991       | 1009      | 74340        | 180000000      | 1             | 0             | 0           |
    73        | 1000       | TRADING_MODE_CONTINUOUS | 90      | 989       | 1011      | 74340        | 180000000      | 1             | 0             | 0           |
    74        | 1000       | TRADING_MODE_CONTINUOUS | 120     | 988       | 1012      | 74340        | 180000000      | 1             | 0             | 0           |
    75  
    76      # Place 2 persistent orders that are outside all of the price bounds
    77      And the parties place the following orders:
    78        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    79        | party1 | ETH/DEC24 | buy  | 1      | 1013  | 0                | TYPE_LIMIT | TIF_GTC | buy1      |
    80        | party5 | ETH/DEC24 | sell | 1      | 1013  | 0                | TYPE_LIMIT | TIF_GTC | sell1     |
    81  
    82      When the network moves ahead "1" blocks
    83  
    84      # Check we have been placed in auction
    85      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC24"
    86  
    87      And the starting auction time for market "ETH/DEC24" is "1704067221000000000"
    88      And the ending auction time for market "ETH/DEC24" is "1704067231000000000"
    89  
    90      # Check we know the auction time
    91      And the market data for the market "ETH/DEC24" should be:
    92        | mark price | trading mode                    | horizon | min bound | max bound | target stake | supplied stake | open interest | auction start       | auction end         |
    93        | 1000       | TRADING_MODE_MONITORING_AUCTION | 60      | 991       | 1009      | 150612       | 180000000      | 1             | 1704067221000000000 | 1704067231000000000 |
    94        | 1000       | TRADING_MODE_MONITORING_AUCTION | 90      | 989       | 1011      | 150612       | 180000000      | 1             | 1704067221000000000 | 1704067231000000000 |
    95        | 1000       | TRADING_MODE_MONITORING_AUCTION | 120     | 988       | 1012      | 150612       | 180000000      | 1             | 1704067221000000000 | 1704067231000000000 |
    96  
    97      # Now update the risk model to deactivate all pending price bounds
    98      Then the markets are updated:
    99        | id        | risk model                 |
   100        | ETH/DEC24 | my-log-normal-risk-model-2 |
   101  
   102      # If we move ahead 10 blocks we should come out of auction instead of it being extended
   103      When the network moves ahead "15" blocks
   104  
   105  
   106      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC24"
   107  
   108      And the market data for the market "ETH/DEC24" should be:
   109        | mark price | trading mode                    | horizon | min bound | max bound | target stake | supplied stake | open interest | auction start | auction end |
   110        | 1013       | TRADING_MODE_CONTINUOUS         | 30      | 1007      | 1019      | 225372       | 180000000      | 2             | 0             | 0           |
   111        | 1013       | TRADING_MODE_CONTINUOUS         | 60      | 1004      | 1022      | 225372       | 180000000      | 2             | 0             | 0           |
   112        | 1013       | TRADING_MODE_CONTINUOUS         | 90      | 1002      | 1024      | 225372       | 180000000      | 2             | 0             | 0           |
   113        | 1013       | TRADING_MODE_CONTINUOUS         | 120     | 1001      | 1026      | 225372       | 180000000      | 2             | 0             | 0           |
   114  
   115  
   116      # The mark price should show the orders have traded
   117      And the mark price should be "1013" for the market "ETH/DEC24"
   118  
   119     And the orders should have the following states:
   120      | party  | market id | reference | side | volume | remaining | price | status         |
   121      | party1 | ETH/DEC24   | buy1      | buy  | 1      | 0         | 1013  | STATUS_FILLED  |
   122      | party5 | ETH/DEC24   | sell1     | sell | 1      | 0         | 1013  | STATUS_FILLED  |
   123