code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0068-MATC-075.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       | 10                |
    25        | 60      | 0.999       | 10                |
    26  
    27      And the spot markets:
    28        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | decimal places | position decimal places | sla params    |
    29        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | 2              | 2                       | default-basic |
    30  
    31      # setup accounts
    32      Given the parties deposit on asset's general account the following amount:
    33        | party  | asset | amount |
    34        | party1 | ETH   | 10000  |
    35        | party1 | BTC   | 1000   |
    36        | party2 | ETH   | 10000  |
    37        | party4 | BTC   | 1000   |
    38        | party5 | BTC   | 1000   |
    39      And the average block duration is "1"
    40  
    41      # Place some orders to get out of auction
    42      And the parties place the following orders:
    43        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    44        | party1 | BTC/ETH   | buy  | 1      | 998   | 0                | TYPE_LIMIT | TIF_GTC |
    45        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    46        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    47        | party5 | BTC/ETH   | sell | 1      | 1002  | 0                | TYPE_LIMIT | TIF_GTC |
    48  
    49      And the opening auction period ends for market "BTC/ETH"
    50      When the network moves ahead "1" blocks
    51      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    52      And the mark price should be "1000" for the market "BTC/ETH"
    53  
    54      Scenario: For Good 'Til Time (GTT) / Good 'Till Cancelled (GTC) / Good For Normal (GFN) orders:
    55                Incoming LIMIT: POST-ONLY TRUE An order partially crossing with an existing order on
    56                the book will be STOPPED in full with none executed. (0068-MATC-075) 
    57  
    58      And the parties place the following orders:
    59        | party  | market id | side | volume | price | resulting trades | type       | tif     | expires in | reference | only | error                                   |
    60        | party1 | BTC/ETH   | buy  | 2      | 1002  | 0                | TYPE_LIMIT | TIF_GTT | 3600       | buy-gtt   | post | OrderError: post only order would trade |
    61        | party1 | BTC/ETH   | buy  | 2      | 1002  | 0                | TYPE_LIMIT | TIF_GTC |            | buy-gtc   | post | OrderError: post only order would trade |
    62        | party1 | BTC/ETH   | buy  | 2      | 1002  | 0                | TYPE_LIMIT | TIF_GFN |            | buy-gfn   | post | OrderError: post only order would trade |
    63        | party5 | BTC/ETH   | sell | 2      | 998   | 0                | TYPE_LIMIT | TIF_GTT | 3600       | sell-gtt  | post | OrderError: post only order would trade |
    64        | party5 | BTC/ETH   | sell | 2      | 998   | 0                | TYPE_LIMIT | TIF_GTC |            | sell-gtc  | post | OrderError: post only order would trade |
    65        | party5 | BTC/ETH   | sell | 2      | 998   | 0                | TYPE_LIMIT | TIF_GFN |            | sell-gfn  | post | OrderError: post only order would trade |
    66  
    67      Then the orders should have the following states:
    68        | party  | market id | side | volume | remaining | price | status         | reference |
    69        | party1 | BTC/ETH   | buy  | 2      | 2         | 1002  | STATUS_STOPPED | buy-gtt   |
    70        | party1 | BTC/ETH   | buy  | 2      | 2         | 1002  | STATUS_STOPPED | buy-gtc   |
    71        | party1 | BTC/ETH   | buy  | 2      | 2         | 1002  | STATUS_STOPPED | buy-gfn   |
    72        | party5 | BTC/ETH   | sell | 2      | 2         | 998   | STATUS_STOPPED | sell-gtt  |
    73        | party5 | BTC/ETH   | sell | 2      | 2         | 998   | STATUS_STOPPED | sell-gtc  |
    74        | party5 | BTC/ETH   | sell | 2      | 2         | 998   | STATUS_STOPPED | sell-gfn  |
    75  
    76      Then the orders should have the following status:
    77        | party  | reference  | status         |
    78        | party1 | buy-gtt    | STATUS_STOPPED |
    79        | party1 | buy-gtc    | STATUS_STOPPED |
    80        | party1 | buy-gfn    | STATUS_STOPPED |
    81        | party5 | sell-gtt   | STATUS_STOPPED |
    82        | party5 | sell-gtc   | STATUS_STOPPED |
    83        | party5 | sell-gfn   | STATUS_STOPPED |
    84