code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0068-MATC-077.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        | 3600    | 0.999       | 10                |
    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        | party1 | BTC   | 1000   |
    35        | party2 | ETH   | 10000  |
    36        | party2 | BTC   | 1000   |
    37        | party5 | ETH   | 10000  |
    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      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    45        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    46  
    47      And the opening auction period ends for market "BTC/ETH"
    48      When the network moves ahead "1" blocks
    49      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    50      And the mark price should be "1000" for the market "BTC/ETH"
    51  
    52      And the market data for the market "BTC/ETH" should be:
    53        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    54        | 1000       | TRADING_MODE_CONTINUOUS | 3600    | 959       | 1042      | 0            | 0              | 0             |
    55  
    56      Scenario: For Good 'Til Time (GTT) orders: All attempts to self trade are prevented and the aggressive
    57                side is STOPPED even if partially filled. The passive side is left untouched. (0068-MATC-077)
    58  
    59        # Place some orders and try to self trade
    60        And the parties place the following orders:
    61          | party  | market id | side | volume | price | resulting trades | type       | tif     | expires in | reference |
    62          | party2 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |            | sell-gtc1 |
    63          | party1 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |            | sell-gtc2 |
    64          | party2 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTT | 3600       | buy-gtt1  |
    65          | party1 | BTC/ETH   | buy  | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GTT | 3600       | buy-gtt2  |
    66  
    67        Then the orders should have the following status:
    68          | party  | reference  | status                  |
    69          | party2 | sell-gtc1  | STATUS_FILLED           |
    70          | party1 | sell-gtc2  | STATUS_ACTIVE           |
    71          | party2 | buy-gtt1   | STATUS_STOPPED          |
    72          | party1 | buy-gtt2   | STATUS_PARTIALLY_FILLED |
    73  
    74  
    75      Scenario: For Good 'Till Cancelled (GTC) orders: All attempts to self trade are prevented and the aggressive
    76                side is STOPPED even if partially filled. The passive side is left untouched. (0068-MATC-077)
    77  
    78        # Place some orders and try to self trade
    79        And the parties place the following orders:
    80          | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    81          | party2 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell-gtc1 |
    82          | party1 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell-gtc2 |
    83          | party2 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | buy-gtc1  |
    84          | party1 | BTC/ETH   | buy  | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GTC | buy-gtc2  |
    85  
    86        Then the orders should have the following status:
    87          | party  | reference  | status                  |
    88          | party2 | sell-gtc1  | STATUS_FILLED           |
    89          | party1 | sell-gtc2  | STATUS_ACTIVE           |
    90          | party2 | buy-gtc1   | STATUS_STOPPED          |
    91          | party1 | buy-gtc2   | STATUS_PARTIALLY_FILLED |
    92  
    93  
    94      Scenario: For Good For Normal (GFN) orders: All attempts to self trade are prevented and the aggressive
    95                side is STOPPED even if partially filled. The passive side is left untouched. (0068-MATC-077)
    96  
    97        # Place some orders and try to self trade
    98        And the parties place the following orders:
    99          | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
   100          | party2 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell-gtc1 |
   101          | party1 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell-gtc2 |
   102          | party2 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GFN | buy-gfn1  |
   103          | party1 | BTC/ETH   | buy  | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GFN | buy-gfn2  |
   104  
   105        Then the orders should have the following status:
   106          | party  | reference  | status                  |
   107          | party2 | sell-gtc1  | STATUS_FILLED           |
   108          | party1 | sell-gtc2  | STATUS_ACTIVE           |
   109          | party2 | buy-gfn1   | STATUS_STOPPED          |
   110          | party1 | buy-gfn2   | STATUS_PARTIALLY_FILLED |