code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0032-PRIM-028.feature (about)

     1  Feature: Spot market
     2  
     3    Background:
     4      Given time is updated to "2024-01-01T00:00:00Z"
     5  
     6      Given the following network parameters are set:
     7        | name                                                | value |
     8        | network.markPriceUpdateMaximumFrequency             | 0s    |
     9        | market.value.windowLength                           | 1h    |
    10      
    11      Given the following assets are registered:
    12        | id  | decimal places |
    13        | ETH | 2              |
    14        | BTC | 2              |
    15  
    16      Given the fees configuration named "fees-config-1":
    17        | maker fee | infrastructure fee |
    18        | 0.01      | 0.03               |
    19      Given the log normal risk model named "lognormal-risk-model-1":
    20        | risk aversion | tau  | mu | r   | sigma |
    21        | 0.001         | 0.01 | 0  | 0.0 | 1.2   |
    22      And the price monitoring named "price-monitoring-1":
    23        | horizon | probability | auction extension |
    24        | 30      | 0.999       | 100               |
    25        | 60      | 0.999       | 100               |
    26        | 120     | 0.9995      | 500               |
    27  
    28      And the spot markets:
    29        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | decimal places | position decimal places | sla params    |
    30        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | 2              | 2                       | default-basic |
    31  
    32      # setup accounts
    33      Given the parties deposit on asset's general account the following amount:
    34        | party  | asset | amount |
    35        | party1 | ETH   | 10000  |
    36        | party1 | BTC   | 1000   |
    37        | party2 | ETH   | 10000  |
    38        | party4 | BTC   | 1000   |
    39        | party5 | BTC   | 1000   |
    40      And the average block duration is "1"
    41  
    42      # Place some orders to get out of auction
    43      And the parties place the following orders:
    44        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    45        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GFA |
    46        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    47  
    48      And the opening auction period ends for market "BTC/ETH"
    49      When the network moves ahead "1" blocks
    50      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    51      And the mark price should be "1000" for the market "BTC/ETH"
    52  
    53    Scenario: If the cumulative extensions period of various chained auctions is more than the "time horizon" in a given triplet
    54              then there is no relevant reference price and this triplet is ignored. (0032-PRIM-028)
    55  
    56      # Check that the market price bounds are set 
    57      And the market data for the market "BTC/ETH" should be:
    58        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    59        | 1000       | TRADING_MODE_CONTINUOUS | 30      | 997       | 1003      | 0            | 0              | 0             |
    60        | 1000       | TRADING_MODE_CONTINUOUS | 60      | 995       | 1005      | 0            | 0              | 0             |
    61        | 1000       | TRADING_MODE_CONTINUOUS | 120     | 992       | 1008      | 0            | 0              | 0             |
    62  
    63      # Place persistent orders to breach the first 2 trigger level (995->1005)
    64      And the parties place the following orders:
    65        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    66        | party1 | BTC/ETH   | buy  | 1      | 1006  | 0                | TYPE_LIMIT | TIF_GTC |
    67        | party5 | BTC/ETH   | sell | 1      | 1006  | 0                | TYPE_LIMIT | TIF_GTC |
    68  
    69      # We should be in auction for a combined time of 100+100 blocks
    70      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH"
    71  
    72      # Place crossing orders that would trigger the third level (992->1008)
    73      And the parties place the following orders:
    74        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    75        | party1 | BTC/ETH   | buy  | 1      | 1009  | 0                | TYPE_LIMIT | TIF_GTC |
    76        | party5 | BTC/ETH   | sell | 1      | 1009  | 0                | TYPE_LIMIT | TIF_GTC |
    77  
    78      # Because the current auction length is greater than the time horizon for the third level,
    79      # the 500 block extension is not applied
    80  
    81      # Move forward 201 blocks should end the auction
    82      When the network moves ahead "201" blocks
    83      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    84