code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0026-AUCT-024.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        | 60      | 0.999       | 1                 |
    25  
    26      And the spot markets:
    27        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | decimal places | position decimal places | sla params    |
    28        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | 2              | 2                       | default-basic |
    29  
    30      # setup accounts
    31      Given the parties deposit on asset's general account the following amount:
    32        | party  | asset | amount |
    33        | party1 | ETH   | 10000  |
    34        | party2 | ETH   | 10000  |
    35        | party4 | BTC   | 1000   |
    36        | party5 | BTC   | 1000   |
    37      And the average block duration is "1"
    38  
    39    Scenario: As the Vega network, in auction mode, all orders are placed in the book but never uncross
    40              until the end of the auction period. (0026-AUCT-024)
    41  
    42      # Place some orders that cross
    43      And the parties place the following orders:
    44        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    45        | party1 | BTC/ETH   | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GFA | buy1      |
    46        | party2 | BTC/ETH   | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | buy2      |
    47        | party4 | BTC/ETH   | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell1     |
    48        | party5 | BTC/ETH   | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GFA | sell2     |
    49  
    50      When the network moves ahead "1" blocks
    51  
    52      # Check that nothing has traded
    53    And the orders should have the following states:
    54      | party  | market id | reference | side | volume | remaining | price | status        |
    55      | party1 | BTC/ETH   | buy1      | buy  | 10     | 10        | 1000  | STATUS_ACTIVE |
    56      | party2 | BTC/ETH   | buy2      | buy  | 10     | 10        | 1000  | STATUS_ACTIVE |
    57      | party4 | BTC/ETH   | sell1     | sell | 10     | 10        | 1000  | STATUS_ACTIVE |
    58      | party5 | BTC/ETH   | sell2     | sell | 10     | 10        | 1000  | STATUS_ACTIVE |
    59  
    60      And the opening auction period ends for market "BTC/ETH"
    61      When the network moves ahead "1" blocks
    62      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    63      And the mark price should be "1000" for the market "BTC/ETH"
    64  
    65    # Now we have moved out of auction, check the trades have taken place
    66    Then the following trades should be executed:
    67      | buyer  | seller | price | size |
    68      | party1 | party4 | 1000  | 10   |
    69      | party2 | party5 | 1000  | 10   |
    70  
    71      And the market data for the market "BTC/ETH" should be:
    72        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    73        | 1000       | TRADING_MODE_CONTINUOUS | 60      | 995       | 1005      | 0            | 0              | 0             |
    74  
    75  
    76    # Now move into a price monitoring auction
    77      And the parties place the following orders:
    78        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    79        | party1 | BTC/ETH   | buy  | 10     | 990   | 0                | TYPE_LIMIT | TIF_GTC | buy3      |
    80        | party5 | BTC/ETH   | sell | 10     | 1010  | 0                | TYPE_LIMIT | TIF_GTC | sell3     |
    81        | party2 | BTC/ETH   | buy  | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC | buy4      |
    82   
    83      When the network moves ahead "1" blocks
    84      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH"
    85  
    86    # Place some crossing orders and make sure they do not trade
    87      And the parties place the following orders:
    88        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    89        | party1 | BTC/ETH   | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | buy5      |
    90        | party5 | BTC/ETH   | sell | 11     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell5     |
    91    
    92    Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH"
    93    
    94    And the orders should have the following states:
    95      | party  | market id | reference | side | volume | remaining | price | status        |
    96      | party1 | BTC/ETH   | buy5      | buy  | 10     | 10        | 1000  | STATUS_ACTIVE |
    97      | party5 | BTC/ETH   | sell5     | sell | 11     | 11        | 1000  | STATUS_ACTIVE |
    98      | party1 | BTC/ETH   | buy3      | buy  | 10     | 10        | 990   | STATUS_ACTIVE |
    99      | party5 | BTC/ETH   | sell3     | sell | 10     | 10        | 1010  | STATUS_ACTIVE |
   100      | party2 | BTC/ETH   | buy4      | buy  | 1      | 1         | 1010  | STATUS_ACTIVE |
   101  
   102    # Now move forward until we come out of auction and make sure the crossed orders are matched and trade correctly
   103  
   104    When the network moves ahead "5" blocks
   105    Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   106  
   107    And the orders should have the following states:
   108      | party  | market id | reference | side | volume | remaining | price | status        |
   109      | party1 | BTC/ETH   | buy5      | buy  | 10     | 0         | 1000  | STATUS_FILLED |
   110      | party5 | BTC/ETH   | sell5     | sell | 11     | 0         | 1000  | STATUS_FILLED |
   111  
   112