code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0014-ORDT-084.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        | party3 | BTC   | 100    |
    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  
    49  
    50    Scenario: Immediate orders, continuous trading Any GTT limit order that [still] resides on the order book at its expiry time is cancelled
    51              and removed from the book before any events are processed that rely on its being present on the book, including any calculation
    52              that incorporates its volume and/or price level. (0014-ORDT-084)
    53  
    54      Given time is updated to "2024-01-01T00:01:00Z"
    55      # Place a GTT order that we are going to expire along with a same price GTC order that will stay around
    56      And the parties place the following orders:
    57        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | expires in |
    58        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTT | sell1     | 60         |
    59        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell2     |            |
    60  
    61      Then the orders should have the following states:
    62        | party  | market id | reference   | side | volume | remaining | price | status        |
    63        | party5 | BTC/ETH   | sell1       | sell | 1      | 1         | 1000  | STATUS_ACTIVE |
    64        | party5 | BTC/ETH   | sell2       | sell | 1      | 1         | 1000  | STATUS_ACTIVE |
    65  
    66      And the order book should have the following volumes for market "BTC/ETH":
    67        | side | price | volume |
    68        | sell | 1000  | 2      |
    69  
    70      # Move the time forward 1 minute to force the GTT order to expire
    71      Given time is updated to "2024-01-01T00:02:00Z"
    72  
    73      # Place an order that would have matched with it
    74      And the parties place the following orders:
    75        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    76        | party1 | BTC/ETH   | buy  | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GTC | buy1      |
    77  
    78      # The order should have expired and the volume will be taken from the book
    79      # resulting in the new buy order only matching with the second sell order that was still active
    80      And the orders should have the following status:
    81        | party  | reference | status         |
    82        | party5 | sell1     | STATUS_EXPIRED |
    83        | party5 | sell2     | STATUS_FILLED  |
    84        | party1 | buy1      | STATUS_ACTIVE  |
    85  
    86      And the order book should have the following volumes for market "BTC/ETH":
    87        | side | price | volume |
    88        | buy  | 1000  | 1      |