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

     1  Feature: Composite mark price calculation
     2  
     3    Background:
     4      Given the average block duration is "1"
     5      Given the following network parameters are set:
     6        | name                                    | value |
     7        | network.markPriceUpdateMaximumFrequency | 1s    |
     8      And the liquidity monitoring parameters:
     9        | name       | triggering ratio | time window | scaling factor |
    10        | lqm-params | 0.00             | 24h         | 1e-9           |
    11      And the simple risk model named "simple-risk-model":
    12        | long | short | max move up | min move down | probability of trading |
    13        | 0.1  | 0.1   | 100         | -100          | 0.2                    |
    14      And the composite price oracles from "0xCAFECAFE1":
    15        | name    | price property   | price type   | price decimals |
    16        | oracle1 | price1.USD.value | TYPE_INTEGER | 0              |
    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 | weight     | 0            | 0           | 100         | 1,1,1,0        | 1m0s,1h0m0s,5m0s,0s        | oracle1 |
    20  
    21    Scenario: Composite price composed of last traded, order book, and oracle price (0009-MRKP-022)(0009-MRKP-023)
    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      And the parties place the following orders:
    27        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference |
    28        | buySideProvider  | ETH/FEB23 | buy  | 10     | 14970 | 0                | TYPE_LIMIT | TIF_GTC |           |
    29        | buySideProvider  | ETH/FEB23 | buy  | 1      | 15000 | 0                | TYPE_LIMIT | TIF_GTC |           |
    30        | sellSideProvider | ETH/FEB23 | sell | 1      | 15000 | 0                | TYPE_LIMIT | TIF_GTC |           |
    31        | sellSideProvider | ETH/FEB23 | sell | 10     | 15090 | 0                | TYPE_LIMIT | TIF_GTC |           |
    32      When the opening auction period ends for market "ETH/FEB23"
    33      # the book price at auction uncrossing should be set to the price of the uncrossing trade
    34      Then the mark price should be "15000" for the market "ETH/FEB23"
    35  
    36      # No price sources stale, composite price average of last traded price, book price and oracle price
    37      Given the oracles broadcast data with block time signed with "0xCAFECAFE1":
    38        | name             | value | time offset |
    39        | price1.USD.value | 15060 | 0s          |
    40      When the network moves ahead "2" blocks
    41      Then the mark price should be "15030" for the market "ETH/FEB23"
    42  
    43      # Last traded price stale, composite price average of book price and oracle price
    44      When the network moves ahead "61" blocks
    45      Then the mark price should be "15045" for the market "ETH/FEB23"
    46  
    47      # Last traded and oracle price stale, composite price average of book price
    48      When the network moves ahead "241" blocks
    49      Then the mark price should be "15030" for the market "ETH/FEB23"
    50  
    51  
    52  
    53  
    54  
    55  
    56  
    57