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

     1  Feature: Test setting of mark price
     2    Background:
     3      Given the following network parameters are set:
     4        | name                                    | value |
     5        | network.markPriceUpdateMaximumFrequency | 4s    |
     6  
     7      And the perpetual oracles from "0xCAFECAFE1":
     8        | name        | asset | settlement property | settlement type | schedule property | schedule type  | margin funding factor | interest rate | clamp lower bound | clamp upper bound | quote name | settlement decimals |
     9        | perp-oracle | USD   | perp.ETH.value      | TYPE_INTEGER    | perp.funding.cue  | TYPE_TIMESTAMP | 0.5                   | 0.05          | 0.1               | 0.9               | ETH        | 18                  |
    10      And the liquidity monitoring parameters:
    11        | name       | triggering ratio | time window | scaling factor |
    12        | lqm-params | 0.00             | 24h         | 1e-9           |
    13      And the price monitoring named "my-price-monitoring":
    14        | horizon | probability | auction extension |
    15        | 43200   | 0.9999999   | 10                |
    16      And the simple risk model named "simple-risk-model":
    17        | long | short | max move up | min move down | probability of trading |
    18        | 0.1  | 0.1   | 100         | -100          | 0.2                    |
    19      And the markets:
    20        | 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 | market type |
    21        | ETH/FEB23 | ETH        | USD   | lqm-params           | simple-risk-model | default-margin-calculator | 1                | default-none | my-price-monitoring | default-eth-for-future | 0.25                   | 0                         | default-futures | weight     | 1            | 1           | 50000000    | 1,0,0,0        | 20s,20s,24h0m0s,1h25m0s    | future      |
    22        | ETH/FEB22 | ETH        | USD   | lqm-params           | simple-risk-model | default-margin-calculator | 1                | default-none | my-price-monitoring | perp-oracle            | 0.25                   | 0                         | default-futures | weight     | 1            | 1           | 50000000    | 1,0,0,0        | 20s,20s,24h0m0s,1h25m0s    | perp        |
    23  
    24    Scenario: 001 check mark price using weight average
    25      Given the parties deposit on asset's general account the following amount:
    26        | party             | asset | amount       |
    27        | buySideProvider   | USD   | 100000000000 |
    28        | sellSideProvider  | USD   | 100000000000 |
    29        | party             | USD   | 48050        |
    30        | buySideProvider1  | USD   | 100000000000 |
    31        | sellSideProvider1 | USD   | 100000000000 |
    32        | party1            | USD   | 48050        |
    33      And the parties place the following orders:
    34        | party             | market id | side | volume | price  | resulting trades | type       | tif     | reference |
    35        | buySideProvider   | ETH/FEB23 | buy  | 5      | 14900  | 0                | TYPE_LIMIT | TIF_GTC |           |
    36        | buySideProvider   | ETH/FEB23 | buy  | 1      | 15000  | 0                | TYPE_LIMIT | TIF_GTC |           |
    37        | buySideProvider   | ETH/FEB23 | buy  | 3      | 15900  | 0                | TYPE_LIMIT | TIF_GTC |           |
    38        | party             | ETH/FEB23 | sell | 3      | 15900  | 0                | TYPE_LIMIT | TIF_GTC |           |
    39        | sellSideProvider  | ETH/FEB23 | sell | 2      | 15920  | 0                | TYPE_LIMIT | TIF_GTC | sell-2    |
    40        | sellSideProvider  | ETH/FEB23 | sell | 1      | 15940  | 0                | TYPE_LIMIT | TIF_GTC | sell-3    |
    41        | sellSideProvider  | ETH/FEB23 | sell | 3      | 17000  | 0                | TYPE_LIMIT | TIF_GTC | sell-4    |
    42        | sellSideProvider  | ETH/FEB23 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |           |
    43        | buySideProvider1  | ETH/FEB22 | buy  | 5      | 14900  | 0                | TYPE_LIMIT | TIF_GTC |           |
    44        | buySideProvider1  | ETH/FEB22 | buy  | 1      | 15000  | 0                | TYPE_LIMIT | TIF_GTC |           |
    45        | buySideProvider1  | ETH/FEB22 | buy  | 3      | 15900  | 0                | TYPE_LIMIT | TIF_GTC |           |
    46        | party1            | ETH/FEB22 | sell | 3      | 15900  | 0                | TYPE_LIMIT | TIF_GTC |           |
    47        | sellSideProvider1 | ETH/FEB22 | sell | 2      | 15920  | 0                | TYPE_LIMIT | TIF_GTC | sell-2    |
    48        | sellSideProvider1 | ETH/FEB22 | sell | 1      | 15940  | 0                | TYPE_LIMIT | TIF_GTC | sell-3    |
    49        | sellSideProvider1 | ETH/FEB22 | sell | 3      | 17000  | 0                | TYPE_LIMIT | TIF_GTC | sell-4    |
    50        | sellSideProvider1 | ETH/FEB22 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |           |
    51  
    52      # AC 0009-MRKP-024
    53      When the network moves ahead "2" blocks
    54      Then the mark price should be "15900" for the market "ETH/FEB23"
    55      Then the mark price should be "15900" for the market "ETH/FEB22"
    56  
    57      Then the market data for the market "ETH/FEB23" should be:
    58        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    59        | 15900      | TRADING_MODE_CONTINUOUS | 43200   | 15801     | 15999     | 0            | 0              | 3             |
    60      Then the market data for the market "ETH/FEB22" should be:
    61        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    62        | 15900      | TRADING_MODE_CONTINUOUS | 43200   | 15801     | 15999     | 0            | 0              | 3             |
    63  
    64      And the parties place the following orders:
    65        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference |
    66        | buySideProvider  | ETH/FEB23 | buy  | 2      | 15920 | 1                | TYPE_LIMIT | TIF_GTC |           |
    67        | buySideProvider1 | ETH/FEB22 | buy  | 2      | 15920 | 1                | TYPE_LIMIT | TIF_GTC |           |
    68      When the network moves ahead "1" blocks
    69      Then the mark price should be "15900" for the market "ETH/FEB23"
    70      Then the mark price should be "15900" for the market "ETH/FEB22"
    71  
    72      And the parties place the following orders:
    73        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference |
    74        | buySideProvider  | ETH/FEB23 | buy  | 1      | 15940 | 1                | TYPE_LIMIT | TIF_GTC |           |
    75        | buySideProvider1 | ETH/FEB22 | buy  | 1      | 15940 | 1                | TYPE_LIMIT | TIF_GTC |           |
    76      When the network moves ahead "2" blocks
    77      Then the mark price should be "15900" for the market "ETH/FEB23"
    78      Then the mark price should be "15900" for the market "ETH/FEB22"
    79  
    80      When the network moves ahead "2" blocks
    81      Then the mark price should be "15940" for the market "ETH/FEB23"
    82      Then the mark price should be "15940" for the market "ETH/FEB22"
    83      And the parties place the following orders:
    84        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference |
    85        | buySideProvider  | ETH/FEB23 | buy  | 3      | 17000 | 0                | TYPE_LIMIT | TIF_GTC |           |
    86        | buySideProvider1 | ETH/FEB22 | buy  | 3      | 17000 | 0                | TYPE_LIMIT | TIF_GTC |           |
    87      When the network moves ahead "2" blocks
    88      Then the mark price should be "15940" for the market "ETH/FEB23"
    89      Then the mark price should be "15940" for the market "ETH/FEB22"
    90      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/FEB23"
    91      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/FEB22"
    92  
    93      When the network moves ahead "9" blocks
    94      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/FEB23"
    95      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/FEB22"
    96      Then the mark price should be "17000" for the market "ETH/FEB23"
    97      Then the mark price should be "17000" for the market "ETH/FEB22"
    98