code.vegaprotocol.io/vega@v0.79.0/core/integration/features/price_monitoring/3362-failing-system-tests.feature (about)

     1  Feature: Replicate failing system tests after changes to price monitoring (not triggering with FOK orders, auction duration)
     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        | 5       | 0.95        | 6                 |
     8        | 10      | 0.99        | 8                 |
     9      And the log normal risk model named "my-log-normal-risk-model":
    10        | risk aversion | tau                    | mu | r     | sigma |
    11        | 0.000001      | 0.00011407711613050422 | 0  | 0.016 | 2.0   |
    12      And the markets:
    13        | id        | quote name | asset | risk model               | margin calculator         | auction duration | fees         | price monitoring    | data source config     | linear slippage factor | quadratic slippage factor | sla params      | 
    14        | ETH/DEC20 | ETH        | ETH   | my-log-normal-risk-model | default-margin-calculator | 1                | default-none | my-price-monitoring | default-eth-for-future | 0.25                   | 0                         | default-futures |
    15      And the following network parameters are set:
    16        | name                           | value |
    17        | market.auction.minimumDuration | 1     |
    18        | limits.markets.maxPeggedOrders | 2     |
    19      And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20"
    20  
    21    Scenario: Replicate test called test_TriggerWithMarketOrder
    22      Given the parties deposit on asset's general account the following amount:
    23        | party   | asset | amount    |
    24        | party1  | ETH   | 100000000 |
    25        | party2  | ETH   | 100000000 |
    26        | party3  | ETH   | 100000000 |
    27        | partyLP | ETH   | 100000000 |
    28        | aux     | ETH   | 100000000 |
    29  
    30      When the parties place the following orders:
    31        | party  | market id | side | volume | price  | resulting trades | type       | tif     |
    32        | party1 | ETH/DEC20 | buy  | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GFA |
    33        | party2 | ETH/DEC20 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GFA |
    34        | party1 | ETH/DEC20 | buy  | 5      | 95000  | 0                | TYPE_LIMIT | TIF_GTC |
    35        | party2 | ETH/DEC20 | sell | 5      | 107000 | 0                | TYPE_LIMIT | TIF_GTC |
    36        | party1 | ETH/DEC20 | buy  | 1      | 95000  | 0                | TYPE_LIMIT | TIF_GTC |
    37        | party2 | ETH/DEC20 | sell | 1      | 107000 | 0                | TYPE_LIMIT | TIF_GTC |
    38      And the parties submit the following liquidity provision:
    39        | id  | party  | market id | commitment amount | fee | lp type    |
    40        | lp1 | party1 | ETH/DEC20 | 16000000          | 0.3 | submission |
    41        | lp1 | party1 | ETH/DEC20 | 16000000          | 0.3 | amendment  |
    42      And the parties place the following pegged iceberg orders:
    43        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    44        | party1 | ETH/DEC20 |  152      | 1                    | buy  | BID              | 152    | 10     |
    45        | party1 | ETH/DEC20 | 150       | 1                    | sell | ASK              | 150    | 10     | 
    46      Then the mark price should be "0" for the market "ETH/DEC20"
    47      And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20"
    48  
    49      When the opening auction period ends for market "ETH/DEC20"
    50      Then the mark price should be "100000" for the market "ETH/DEC20"
    51      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    52  
    53      ## price bounds are 99771 to 100290
    54      When the parties place the following orders:
    55        | party  | market id | side | volume | price  | resulting trades | type       | tif     |
    56        | party1 | ETH/DEC20 | buy  | 1      | 100150 | 0                | TYPE_LIMIT | TIF_GTC |
    57        | party2 | ETH/DEC20 | sell | 1      | 100150 | 1                | TYPE_LIMIT | TIF_GTC |
    58  
    59      Then the market data for the market "ETH/DEC20" should be:
    60        | mark price | last traded price | trading mode            |
    61        | 100000     | 100150            | TRADING_MODE_CONTINUOUS |
    62  
    63      When the parties place the following orders:
    64        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    65        | party1 | ETH/DEC20 | buy  | 1      | 99845 | 0                | TYPE_LIMIT | TIF_GTC |
    66        | party1 | ETH/DEC20 | buy  | 2      | 99844 | 0                | TYPE_LIMIT | TIF_GTC |
    67      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    68      # Now place a FOK order that would trigger a price auction (party 1 has a buy at 95,000 on the book
    69  
    70      And the order book should have the following volumes for market "ETH/DEC20":
    71        | side | price  | volume |
    72        | sell | 107010 | 150    |
    73        | sell | 107000 | 6      |
    74        | buy  | 99845  | 1      |
    75        | buy  | 99844  | 2      |
    76        | buy  | 99835  | 152    |
    77        | buy  | 95000  | 6      |
    78  
    79      And the parties place the following orders:
    80        | party  | market id | side | volume | price | resulting trades | type        | tif     | error                                                       |
    81        | party2 | ETH/DEC20 | sell | 156    | 0     | 0                | TYPE_MARKET | TIF_FOK | OrderError: non-persistent order trades out of price bounds |
    82  
    83      Then the market data for the market "ETH/DEC20" should be:
    84        | mark price | last traded price | trading mode            | horizon | min bound | max bound |
    85        | 100000     | 100150            | TRADING_MODE_CONTINUOUS | 5       | 99845     | 100156    |
    86        | 100000     | 100150            | TRADING_MODE_CONTINUOUS | 10      | 99711     | 100290    |
    87  
    88      # Now set the volume so that the order generates a trade that's still within price monitoring bounds
    89      When the parties place the following orders:
    90        | party  | market id | side | volume | price | resulting trades | type        | tif     |
    91        | party2 | ETH/DEC20 | sell | 1      | 0     | 1                | TYPE_MARKET | TIF_FOK |
    92      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    93  
    94      Then the network moves ahead "10" blocks
    95  
    96      And the mark price should be "99845" for the market "ETH/DEC20"