code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0014-ORDT-106.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        | 360000  | 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   | 100    |
    36        | party5 | BTC   | 100    |
    37      And the average block duration is "1"
    38  
    39      # Place some orders to get out of auction
    40      And the parties place the following orders:
    41        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    42        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GFA |
    43        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    44  
    45      And the opening auction period ends for market "BTC/ETH"
    46      When the network moves ahead "1" blocks
    47      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    48      And the mark price should be "1000" for the market "BTC/ETH"
    49  
    50    Scenario: An aggressive iceberg order that crosses with an order where volume < iceberg volume. The initial display quantity is
    51              filled and the remaining volume is unfilled. Status of iceberg order is active, the volume remaining = (quantity - initial volume)
    52              and the remaining volume sits on the book. When additional orders are submitted which consume the remaining volume on the iceberg
    53              order, the volume of the iceberg order is refreshed as and when the volume dips below the minimum peak size (0014-ORDT-106)
    54  
    55  
    56      # Add a single order to the book so we can match an iceberg order to it
    57      And the parties place the following orders:
    58        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    59        | party4 | BTC/ETH   | sell | 5      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell1     |
    60  
    61      # Place an iceberg order to match immediately
    62      When the parties place the following iceberg orders:
    63        | party  | market id | side | volume | price | resulting trades | type       | tif     | peak size | minimum visible size | reference |
    64        | party1 | BTC/ETH   | buy  | 20     | 1000  | 1                | TYPE_LIMIT | TIF_GTC | 5         | 1                    | iceberg1  |
    65  
    66      Then the orders should have the following states:
    67        | party  | market id | side | price | remaining | volume | reference | status         |
    68        | party4 | BTC/ETH   | sell | 1000  | 0         | 5      | sell1     | STATUS_FILLED  | 
    69        | party1 | BTC/ETH   | buy  | 1000  | 5         | 20     | iceberg1  | STATUS_ACTIVE  |             
    70  
    71      # Send in more orders to match with the passive iceberg
    72      And the parties place the following orders:
    73        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    74        | party5 | BTC/ETH   | sell | 6      | 1000  | 1                | TYPE_LIMIT | TIF_GTC | sell2     |
    75      Then the orders should have the following states:
    76        | party  | market id | side | price | remaining | volume | reference | status         |
    77        | party5 | BTC/ETH   | sell | 1000  | 0         | 6      | sell2     | STATUS_FILLED  | 
    78        | party1 | BTC/ETH   | buy  | 1000  | 5         | 20     | iceberg1  | STATUS_ACTIVE  |             
    79  
    80      And the parties place the following orders:
    81        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    82        | party4 | BTC/ETH   | sell | 3      | 1000  | 1                | TYPE_LIMIT | TIF_GTC | sell3     |
    83      Then the orders should have the following states:
    84        | party  | market id | side | price | remaining | volume | reference | status         |
    85        | party4 | BTC/ETH   | sell | 1000  | 0         | 3      | sell3     | STATUS_FILLED  | 
    86        | party1 | BTC/ETH   | buy  | 1000  | 2         | 20     | iceberg1  | STATUS_ACTIVE  |             
    87  
    88      And the parties place the following orders:
    89        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    90        | party5 | BTC/ETH   | sell | 6      | 1000  | 1                | TYPE_LIMIT | TIF_GTC | sell4     |
    91      Then the orders should have the following states:
    92        | party  | market id | side | price | remaining | volume | reference | status         |
    93        | party5 | BTC/ETH   | sell | 1000  | 0         | 6      | sell4     | STATUS_FILLED  | 
    94        | party1 | BTC/ETH   | buy  | 1000  | 0         | 20     | iceberg1  | STATUS_FILLED  |           
    95  
    96      # There should be no volume left on the book now
    97      Then the order book should have the following volumes for market "BTC/ETH":
    98        | side | price | volume |
    99        | buy  | 1000  | 0      |
   100        | sell | 1000  | 0      |
   101  
   102