code.vegaprotocol.io/vega@v0.79.0/core/integration/features/price_monitoring/2681-price-monitoring.feature (about)

     1  Feature: Price monitoring test for issue 2681
     2  
     3    Background:
     4      Given time is updated to "2020-10-16T00:00:00Z"
     5      And the price monitoring named "my-price-monitoring":
     6        | horizon | probability | auction extension |
     7        | 43200   | 0.9999999   | 300               |
     8      And the log normal risk model named "my-log-normal-risk-model":
     9        | risk aversion | tau                    | mu | r     | sigma |
    10        | 0.000001      | 0.00011407711613050422 | 0  | 0.016 | 0.8   |
    11      And the markets:
    12        | id        | quote name | asset | risk model               | margin calculator         | auction duration | fees         | price monitoring    | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
    13        | ETH/DEC20 | ETH        | ETH   | my-log-normal-risk-model | default-margin-calculator | 1                | default-none | my-price-monitoring | default-eth-for-future | 1e-4                   | 1e-4                      | default-futures |
    14      And the following network parameters are set:
    15        | name                                    | value |
    16        | market.auction.minimumDuration          | 1     |
    17        | network.markPriceUpdateMaximumFrequency | 0s    |
    18        | limits.markets.maxPeggedOrders          | 2     |
    19  
    20    Scenario: Upper bound breached
    21      Given the parties deposit on asset's general account the following amount:
    22        | party     | asset | amount       |
    23        | party1    | ETH   | 10000000000  |
    24        | party2    | ETH   | 10000000000  |
    25        | auxiliary | ETH   | 100000000000 |
    26        | aux2      | ETH   | 100000000000 |
    27        | lpprov    | ETH   | 100000000000 |
    28  
    29      When the parties submit the following liquidity provision:
    30        | id  | party  | market id | commitment amount | fee | lp type    |
    31        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
    32        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
    33      And the parties place the following pegged iceberg orders:
    34        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    35        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50         | 100    |
    36        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50         | 100    |
    37   
    38      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
    39      Then the parties place the following orders:
    40        | party     | market id | side | volume | price    | resulting trades | type       | tif     |
    41        | auxiliary | ETH/DEC20 | buy  | 1      | 1        | 0                | TYPE_LIMIT | TIF_GTC |
    42        | auxiliary | ETH/DEC20 | sell | 1      | 10000000 | 0                | TYPE_LIMIT | TIF_GTC |
    43        | aux2      | ETH/DEC20 | buy  | 1      | 5670000  | 0                | TYPE_LIMIT | TIF_GTC |
    44        | auxiliary | ETH/DEC20 | sell | 1      | 5670000  | 0                | TYPE_LIMIT | TIF_GTC |
    45      Then the opening auction period ends for market "ETH/DEC20"
    46      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    47  
    48      When the parties place the following orders with ticks:
    49        | party  | market id | side | volume | price   | resulting trades | type       | tif     | reference |
    50        | party1 | ETH/DEC20 | sell | 1      | 5670000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    51        | party2 | ETH/DEC20 | buy  | 1      | 5670000 | 1                | TYPE_LIMIT | TIF_FOK | ref-2     |
    52  
    53      And the mark price should be "5670000" for the market "ETH/DEC20"
    54  
    55      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    56  
    57      # T0 + 1min - this causes the price for comparison of the bounds to be 567
    58      Then time is updated to "2020-10-16T00:01:00Z"
    59  
    60      When the parties place the following orders with ticks:
    61        | party  | market id | side | volume | price   | resulting trades | type       | tif     | reference |
    62        | party1 | ETH/DEC20 | sell | 1      | 4850000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    63        | party2 | ETH/DEC20 | buy  | 1      | 4850000 | 1                | TYPE_LIMIT | TIF_FOK | ref-2     |
    64  
    65      And the mark price should be "4850000" for the market "ETH/DEC20"
    66  
    67      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    68  
    69      # T0 + 2min
    70      Then time is updated to "2020-10-16T00:02:00Z"
    71  
    72      When the parties place the following orders with ticks:
    73        | party  | market id | side | volume | price   | resulting trades | type       | tif     | reference |
    74        | party1 | ETH/DEC20 | sell | 1      | 6490000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    75        | party2 | ETH/DEC20 | buy  | 1      | 6490000 | 1                | TYPE_LIMIT | TIF_FOK | ref-2     |
    76  
    77      And the mark price should be "6490000" for the market "ETH/DEC20"
    78  
    79      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    80  
    81      # T0 + 3min
    82      # The reference price is still 5670000
    83      Then time is updated to "2020-10-16T00:03:00Z"
    84  
    85      When the parties place the following orders with ticks:
    86        | party  | market id | side | volume | price   | resulting trades | type       | tif     | reference |
    87        | party1 | ETH/DEC20 | sell | 1      | 6635392 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    88        | party2 | ETH/DEC20 | buy  | 1      | 6635392 | 1                | TYPE_LIMIT | TIF_FOK | ref-2     |
    89  
    90      And the mark price should be "6635392" for the market "ETH/DEC20"
    91  
    92      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    93  
    94      When the parties place the following orders with ticks:
    95        | party  | market id | side | volume | price   | resulting trades | type       | tif     | reference |
    96        | party1 | ETH/DEC20 | sell | 1      | 6635393 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    97        | party2 | ETH/DEC20 | buy  | 1      | 6635393 | 0                | TYPE_LIMIT | TIF_GTC | ref-2     |
    98  
    99      And the mark price should be "6635392" for the market "ETH/DEC20"
   100  
   101      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"