code.vegaprotocol.io/vega@v0.79.0/core/integration/features/mark-price/0009-MRKP-132.feature (about) 1 Feature: Test setting of mark price from oracles with one getting stale (AC 0009-MRKP-132) 2 Background: 3 Given the following network parameters are set: 4 | name | value | 5 | network.markPriceUpdateMaximumFrequency | 1s | 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 # this is just an example of setting up oracles 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 | oracle2 | price2.USD.value | TYPE_INTEGER | 0 | 18 | oracle3 | price3.USD.value | TYPE_INTEGER | 0 | 19 20 And the markets: 21 | 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 | oracle2 | oracle3 | 22 | 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 | 1 | 1 | 0 | 0,0,1,1,1,0 | 0s,0s,0s,0s,0s,0s | oracle1 | oracle2 | oracle3 | 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 And the parties place the following orders: 31 | party | market id | side | volume | price | resulting trades | type | tif | reference | 32 | buySideProvider | ETH/FEB23 | buy | 10 | 14900 | 0 | TYPE_LIMIT | TIF_GTC | | 33 | buySideProvider | ETH/FEB23 | buy | 1 | 15000 | 0 | TYPE_LIMIT | TIF_GTC | | 34 | buySideProvider | ETH/FEB23 | buy | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 35 | party | ETH/FEB23 | sell | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 36 | sellSideProvider | ETH/FEB23 | sell | 2 | 15920 | 0 | TYPE_LIMIT | TIF_GTC | sell-2 | 37 | sellSideProvider | ETH/FEB23 | sell | 1 | 15940 | 0 | TYPE_LIMIT | TIF_GTC | sell-3 | 38 | sellSideProvider | ETH/FEB23 | sell | 3 | 15960 | 0 | TYPE_LIMIT | TIF_GTC | sell-4 | 39 | sellSideProvider | ETH/FEB23 | sell | 5 | 15990 | 0 | TYPE_LIMIT | TIF_GTC | sell-5 | 40 | sellSideProvider | ETH/FEB23 | sell | 2 | 16000 | 0 | TYPE_LIMIT | TIF_GTC | sell-7 | 41 | sellSideProvider | ETH/FEB23 | sell | 4 | 16020 | 0 | TYPE_LIMIT | TIF_GTC | sell-8 | 42 | sellSideProvider | ETH/FEB23 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | | 43 44 # AC 0009-MRKP-012 45 When the network moves ahead "2" blocks 46 Then the mark price should be "15900" for the market "ETH/FEB23" 47 48 And the parties place the following orders: 49 | party | market id | side | volume | price | resulting trades | type | tif | reference | 50 | buySideProvider | ETH/FEB23 | buy | 2 | 15920 | 1 | TYPE_LIMIT | TIF_GTC | | 51 52 When the network moves ahead "1" blocks 53 Then the mark price should be "15900" for the market "ETH/FEB23" 54 55 And the parties place the following orders: 56 | party | market id | side | volume | price | resulting trades | type | tif | reference | 57 | buySideProvider | ETH/FEB23 | buy | 1 | 15940 | 1 | TYPE_LIMIT | TIF_GTC | | 58 59 When the network moves ahead "1" blocks 60 Then the mark price should be "15900" for the market "ETH/FEB23" 61 62 When the network moves ahead "2" blocks 63 Then the mark price should be "15900" for the market "ETH/FEB23" 64 65 # example of pushing oracle prices 66 Then the oracles broadcast data with block time signed with "0xCAFECAFE1": 67 | name | value | time offset | 68 | price1.USD.value | 16000 | -1s | 69 | price2.USD.value | 15900 | -1s | 70 | price3.USD.value | 15940 | -1s | 71 72 73 When the network moves ahead "1" blocks 74 Then the mark price should be "15946" for the market "ETH/FEB23" 75 76 Then the oracles broadcast data with block time signed with "0xCAFECAFE1": 77 | name | value | time offset | 78 | price1.USD.value | 16000 | -1s | 79 | price2.USD.value | 17000 | -1s | 80 81 When the network moves ahead "1" blocks 82 Then the mark price should be "16500" for the market "ETH/FEB23"