code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0026-AUCT-auction_interaction.feature (about)

     1  Feature: Test interactions between different auction types (0035-LIQM-001)
     2  
     3    # Related spec files:
     4    #  ../spec/0026-auctions.md
     5    #  ../spec/0032-price-monitoring.md
     6    #  ../spec/0035-liquidity-monitoring.md
     7  
     8    Background:
     9      Given the following network parameters are set:
    10        | name                                               | value |
    11        | network.floatingPointUpdates.delay                 | 10s   |
    12        | market.auction.minimumDuration                     | 10    |
    13        | network.markPriceUpdateMaximumFrequency            | 0s    |
    14        | market.liquidity.successorLaunchWindowLength       | 1s    |
    15        | limits.markets.maxPeggedOrders                     | 4     |
    16        | market.liquidity.providersFeeCalculationTimeStep | 1s    |
    17      Given the liquidity monitoring parameters:
    18        | name               | triggering ratio | time window | scaling factor |
    19        | lqm-params         | 0.0              | 24h         | 1.0            |
    20      And the average block duration is "1"
    21      And the simple risk model named "simple-risk-model-1":
    22        | long | short | max move up | min move down | probability of trading |
    23        | 0.1  | 0.1   | 10          | 10            | 0.1                    |
    24      And the log normal risk model named "log-normal-risk-model-1":
    25        | risk aversion | tau                    | mu | r     | sigma |
    26        | 0.001         | 0.00011407711613050422 | 0  | 0.016 | 2.0   |
    27      And the fees configuration named "fees-config-1":
    28        | maker fee | infrastructure fee |
    29        | 0.004     | 0.001              |
    30      And the price monitoring named "price-monitoring-1":
    31        | horizon | probability | auction extension |
    32        | 100     | 0.99        | 300               |
    33      And the price monitoring named "price-monitoring-2":
    34        | horizon | probability | auction extension |
    35        | 2       | 0.999995    | 200               |
    36        | 1       | 0.999999    | 300               |
    37      And the markets:
    38        | id        | quote name | asset | liquidity monitoring    | risk model              | margin calculator         | auction duration | fees          | price monitoring   | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
    39        | ETH/DEC21 | ETH        | ETH   | lqm-params              | simple-risk-model-1     | default-margin-calculator | 10               | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.5                    | 0                         | default-futures |
    40        | ETH/DEC22 | ETH        | ETH   | lqm-params              | log-normal-risk-model-1 | default-margin-calculator | 10               | fees-config-1 | price-monitoring-2 | default-eth-for-future | 0.5                    | 0                         | default-futures |
    41      And the parties deposit on asset's general account the following amount:
    42        | party  | asset | amount     |
    43        | party0 | ETH   | 1000000000 |
    44        | party1 | ETH   | 100000000  |
    45        | party2 | ETH   | 100000000  |
    46        | lpprov | ETH   | 1000000000 |
    47  
    48    Scenario: Assure minimum auction length is respected
    49      Given the following network parameters are set:
    50        | name                           | value |
    51        | market.auction.minimumDuration | 400   |
    52  
    53      When the parties submit the following liquidity provision:
    54        | id  | party  | market id | commitment amount | fee   | lp type    |
    55        | lp1 | party0 | ETH/DEC21 | 4000              | 0.001 | submission |
    56        | lp1 | party0 | ETH/DEC21 | 4000              | 0.001 | submission |
    57        | lp1 | party0 | ETH/DEC21 | 4000              | 0.001 | submission |
    58        | lp1 | party0 | ETH/DEC21 | 4000              | 0.001 | submission |
    59      And the parties place the following pegged iceberg orders:
    60        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    61        | party0 | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1      | 2      |
    62        | party0 | ETH/DEC21 | 2         | 1                    | buy  | MID              | 2      | 1      |
    63        | party0 | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1      | 2      |
    64        | party0 | ETH/DEC21 | 2         | 1                    | sell | MID              | 2      | 1      |
    65  
    66      And the parties place the following orders:
    67        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    68        | party1 | ETH/DEC21 | buy  | 10     | 900   | 0                | TYPE_LIMIT | TIF_GTC |
    69        | party1 | ETH/DEC21 | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
    70        | party1 | ETH/DEC21 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    71        | party2 | ETH/DEC21 | sell | 10     | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    72        | party2 | ETH/DEC21 | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
    73        | party2 | ETH/DEC21 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    74  
    75      When the opening auction period ends for market "ETH/DEC21"
    76      Then the auction ends with a traded volume of "10" at a price of "1000"
    77      And the market data for the market "ETH/DEC21" should be:
    78        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    79        | 1000       | TRADING_MODE_CONTINUOUS | 100     | 990       | 1010      | 1000         | 4000           | 10            |
    80  
    81      When the parties place the following orders with ticks:
    82        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    83        | party2 | ETH/DEC21 | sell | 20     | 1020  | 0                | TYPE_LIMIT | TIF_GTC |
    84        | party1 | ETH/DEC21 | buy  | 20     | 1020  | 0                | TYPE_LIMIT | TIF_GTC |
    85  
    86      Then the market data for the market "ETH/DEC21" should be:
    87        | trading mode                    | auction trigger       |
    88        | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE |
    89  
    90      # try to end price auction (gets extended by min auction length as max(400,300) = 400)
    91      When the network moves ahead "350" blocks
    92  
    93      Then the market data for the market "ETH/DEC21" should be:
    94        | trading mode                    | auction trigger       |
    95        | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE |
    96  
    97      When the network moves ahead "50" blocks
    98      Then the market data for the market "ETH/DEC21" should be:
    99        | trading mode                    | auction trigger       |
   100        | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE |
   101  
   102      When the network moves ahead "1" blocks
   103      Then the market data for the market "ETH/DEC21" should be:
   104        | trading mode            | auction trigger             |
   105        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED |
   106  
   107    Scenario: When trying to exit opening auction liquidity monitoring doesn't get triggered, hence the opening auction uncrosses and market goes into continuous trading mode (0026-AUCT-004)
   108  
   109      Given the parties submit the following liquidity provision:
   110        | id  | party  | market id | commitment amount | fee   | lp type    |
   111        | lp1 | party0 | ETH/DEC21 | 10000             | 0.001 | submission |
   112        | lp1 | party0 | ETH/DEC21 | 10000             | 0.001 | submission |
   113      And the parties place the following pegged iceberg orders:
   114        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   115        | party0 | ETH/DEC21 | 2         | 1                    | buy  | BID              | 500    | 10     |
   116        | party0 | ETH/DEC21 | 2         | 1                    | sell | ASK              | 500    | 10     |
   117  
   118      And the parties place the following orders:
   119        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference  |
   120        | party1 | ETH/DEC21 | buy  | 1      | 900   | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-1  |
   121        | party1 | ETH/DEC21 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-2  |
   122        | party2 | ETH/DEC21 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-1 |
   123        | party2 | ETH/DEC21 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-2 |
   124  
   125      When the opening auction period ends for market "ETH/DEC21"
   126      Then the auction ends with a traded volume of "10" at a price of "1000"
   127  
   128      # target_stake = mark_price x max_oi x target_stake_scaling_factor x max(risk_factor_long, risk_factor_short) = 1000 x 10 x 1 x 0.1
   129      And the market data for the market "ETH/DEC21" should be:
   130        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   131        | 1000       | TRADING_MODE_CONTINUOUS | 100     | 990       | 1010      | 1000         | 10000          | 10            |