code.vegaprotocol.io/vega@v0.79.0/core/integration/features/mark-price/0008-TRAD-008.feature (about)

     1  Feature: Mark price move after trades complete in a spot market (0008-TRAD-008)
     2  
     3    Background:
     4      Given the following network parameters are set:
     5        | name                                    | value |
     6        | network.markPriceUpdateMaximumFrequency | 0s    |
     7      And the average block duration is "1"
     8  
     9      Given the fees configuration named "fees-config-1":
    10        | maker fee | infrastructure fee |
    11        | 0.005     | 0.05               |
    12      
    13      And the simple risk model named "my-simple-risk-model":
    14        | long | short | max move up | min move down | probability of trading |
    15        | 0.01 | 0.01  | 10          | -10           | 0.2                    |
    16  
    17      And the price monitoring named "price-monitoring":
    18        | horizon | probability | auction extension |
    19        | 3600    | 0.95        | 3                 |
    20  
    21      And the spot markets:
    22        | id      | name    | base asset | quote asset | risk model           | auction duration | fees          | price monitoring | sla params    |
    23        | BTC/ETH | BTC/ETH | BTC        | ETH         | my-simple-risk-model | 1                | fees-config-1 | price-monitoring | default-basic |
    24  
    25    Scenario: Following all of the matching of trades resulting from a single order or the acceptance of an order onto the order book,
    26              there may be a change to the Mark Price (0008-TRAD-008).
    27  
    28      # setup accounts
    29      Given the parties deposit on asset's general account the following amount:
    30        | party  | asset | amount |
    31        | party1 | ETH   | 20000  |
    32        | party2 | BTC   | 100    |
    33        | party3 | ETH   | 1200   |
    34        
    35      # place orders and generate trades
    36      And the parties place the following orders:
    37        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    38        | party1 | BTC/ETH   | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GFA | t1-b-1    |
    39        | party2 | BTC/ETH   | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC | t2-s-1    |
    40        | party3 | BTC/ETH   | buy  | 10     | 100   | 0                | TYPE_LIMIT | TIF_GTC | bla-bla   |
    41  
    42      Then the opening auction period ends for market "BTC/ETH"
    43      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    44      And the mark price should be "100" for the market "BTC/ETH"
    45      When the network moves ahead "1" blocks
    46  
    47      # Placing an order above the current mark price that does not match with anything will not change the mark price
    48      And the parties place the following orders:
    49        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    50        | party1 | BTC/ETH   | buy  | 1      | 101   | 0                | TYPE_LIMIT | TIF_GTC | 
    51      When the network moves ahead "1" blocks
    52      And the mark price should be "100" for the market "BTC/ETH"
    53  
    54      # Placing an order that fills with an existing order will move the mark price to the matched price (101)
    55      And the parties place the following orders:
    56        | party  | market id | side | volume | price | resulting trades | type        | tif     | 
    57        | party2 | BTC/ETH   | sell | 1      | 101   | 1                | TYPE_MARKET | TIF_IOC | 
    58      When the network moves ahead "1" blocks
    59      And the mark price should be "101" for the market "BTC/ETH"
    60  
    61      # An unmatched order does not move the mark price
    62      And the parties place the following orders:
    63        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    64        | party1 | BTC/ETH   | buy  | 1      | 102   | 0                | TYPE_LIMIT | TIF_GTC | 
    65      When the network moves ahead "1" blocks
    66      And the mark price should be "101" for the market "BTC/ETH"
    67  
    68      # This order matches and moves the mark price (102)
    69      And the parties place the following orders:
    70        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    71        | party2 | BTC/ETH   | sell | 1      | 102   | 1                | TYPE_LIMIT | TIF_GTC | 
    72      When the network moves ahead "1" blocks
    73      And the mark price should be "102" for the market "BTC/ETH"
    74  
    75      # Placing an order below the current mark price does not move it
    76      And the parties place the following orders:
    77        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    78        | party1 | BTC/ETH   | buy  | 1      | 101   | 0                | TYPE_LIMIT | TIF_GTC | 
    79      When the network moves ahead "1" blocks
    80      And the mark price should be "102" for the market "BTC/ETH"
    81  
    82      # Matching with the order below the current mark price will move the mark price (101)
    83      And the parties place the following orders:
    84        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    85        | party2 | BTC/ETH   | sell | 1      | 101   | 1                | TYPE_LIMIT | TIF_GTC | 
    86      When the network moves ahead "1" blocks
    87      And the mark price should be "101" for the market "BTC/ETH"