code.vegaprotocol.io/vega@v0.79.0/core/integration/features/mark-price/0009-MRKP-034.feature (about)

     1  Feature: Test It is possible to configure a cash settled futures and perps market to use median
     2    Background:
     3      Given the following network parameters are set:
     4        | name                                    | value |
     5        | network.markPriceUpdateMaximumFrequency | 4s    |
     6      And the liquidity monitoring parameters:
     7        | name       | triggering ratio | time window | scaling factor |
     8        | lqm-params | 0.00             | 24h         | 1e-9           |
     9      And the simple risk model named "simple-risk-model":
    10        | long | short | max move up | min move down | probability of trading |
    11        | 0.1  | 0.1   | 100         | -100          | 0.2                    |
    12  
    13      And the composite price oracles from "0xCAFECAFE1":
    14        | name    | price property   | price type   | price decimals |
    15        | oracle1 | price1.USD.value | TYPE_INTEGER | 0              |
    16  
    17      And the markets:
    18        | id        | quote name | asset | liquidity monitoring | risk model        | margin calculator         | auction duration | fees         | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      | price type | decay weight | decay power | cash amount | source weights | source staleness tolerance | oracle1 |
    19        | ETH/FEB23 | ETH        | USD   | lqm-params           | simple-risk-model | default-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 0.25                   | 0                         | default-futures | median     | 0            | 1           | 2000        | 1,0,0,0        | 5s,20s,20s,1h25m0s         | oracle1 |
    20  
    21    Scenario: 001 check mark price using median with traded mark price and book mark price, 0009-MRKP-034, 0009-MRKP-035
    22      Given the parties deposit on asset's general account the following amount:
    23        | party            | asset | amount       |
    24        | buySideProvider  | USD   | 100000000000 |
    25        | sellSideProvider | USD   | 100000000000 |
    26        | party            | USD   | 48050        |
    27      And the parties place the following orders:
    28        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference |
    29        | buySideProvider  | ETH/FEB23 | buy  | 3      | 15900 | 0                | TYPE_LIMIT | TIF_GTC |           |
    30        | party            | ETH/FEB23 | sell | 3      | 15900 | 0                | TYPE_LIMIT | TIF_GTC |           |
    31        | sellSideProvider | ETH/FEB23 | sell | 1      | 15920 | 0                | TYPE_LIMIT | TIF_GTC |           |
    32        | sellSideProvider | ETH/FEB23 | sell | 1      | 15990 | 0                | TYPE_LIMIT | TIF_GTC |           |
    33  
    34      When the network moves ahead "2" blocks
    35      # leaving opening auction
    36      # mark price calcualted from the trade price
    37      Then the mark price should be "15900" for the market "ETH/FEB23"
    38  
    39      And the parties place the following orders:
    40        | party           | market id | side | volume | price | resulting trades | type       | tif     | reference |
    41        | buySideProvider | ETH/FEB23 | buy  | 2      | 15920 | 1                | TYPE_LIMIT | TIF_GTC |           |
    42  
    43      When the network moves ahead "5" blocks
    44      # we have:
    45      # price from trades = 15920
    46      # price from book = 15955 - since the opening auction there are no orders on the sell side so not updating but still not stale
    47      # markprice = median(15920,15955)=15937
    48      Then the mark price should be "15937" for the market "ETH/FEB23"
    49      And the parties place the following orders:
    50        | party           | market id | side | volume | price | resulting trades | type       | tif     | reference |
    51        | buySideProvider | ETH/FEB23 | buy  | 1      | 15990 | 1                | TYPE_LIMIT | TIF_GTC |           |
    52  
    53      When the network moves ahead "1" blocks
    54      Then the mark price should be "15937" for the market "ETH/FEB23"
    55  
    56      # markprice = median(15990,15955)=15972 (mark price from trades 15920 is stale)
    57      When the network moves ahead "3" blocks
    58      Then the mark price should be "15972" for the market "ETH/FEB23"
    59