code.vegaprotocol.io/vega@v0.79.0/core/integration/features/mark-price/0009-MRKP-016.feature (about) 1 Feature: It is possible to configure a cash settled futures market to use an oracle source for the mark price (0009-MRKP-016) and a perps market (with the oracle source different to that used for the external price in the perps market) (0009-MRKP-017) 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 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 | oracle1 | 21 | 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,0 | 0s,0s,10s,0s | oracle1 | 22 23 Scenario: 001 check mark with oracle 24 Given the parties deposit on asset's general account the following amount: 25 | party | asset | amount | 26 | buySideProvider | USD | 100000000000 | 27 | sellSideProvider | USD | 100000000000 | 28 | party | USD | 48050 | 29 And the parties place the following orders: 30 | party | market id | side | volume | price | resulting trades | type | tif | reference | 31 | buySideProvider | ETH/FEB23 | buy | 10 | 14900 | 0 | TYPE_LIMIT | TIF_GTC | | 32 | buySideProvider | ETH/FEB23 | buy | 1 | 15000 | 0 | TYPE_LIMIT | TIF_GTC | | 33 | buySideProvider | ETH/FEB23 | buy | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 34 | party | ETH/FEB23 | sell | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 35 | sellSideProvider | ETH/FEB23 | sell | 2 | 15920 | 0 | TYPE_LIMIT | TIF_GTC | sell-2 | 36 | sellSideProvider | ETH/FEB23 | sell | 1 | 15940 | 0 | TYPE_LIMIT | TIF_GTC | sell-3 | 37 | sellSideProvider | ETH/FEB23 | sell | 3 | 15960 | 0 | TYPE_LIMIT | TIF_GTC | sell-4 | 38 | sellSideProvider | ETH/FEB23 | sell | 5 | 15990 | 0 | TYPE_LIMIT | TIF_GTC | sell-5 | 39 | sellSideProvider | ETH/FEB23 | sell | 2 | 16000 | 0 | TYPE_LIMIT | TIF_GTC | sell-7 | 40 | sellSideProvider | ETH/FEB23 | sell | 4 | 16020 | 0 | TYPE_LIMIT | TIF_GTC | sell-8 | 41 | sellSideProvider | ETH/FEB23 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | | 42 43 When the network moves ahead "2" blocks 44 Then the mark price should be "15900" for the market "ETH/FEB23" 45 46 And the parties place the following orders: 47 | party | market id | side | volume | price | resulting trades | type | tif | reference | 48 | buySideProvider | ETH/FEB23 | buy | 2 | 15920 | 1 | TYPE_LIMIT | TIF_GTC | | 49 50 When the network moves ahead "1" blocks 51 Then the mark price should be "15900" for the market "ETH/FEB23" 52 53 And the parties place the following orders: 54 | party | market id | side | volume | price | resulting trades | type | tif | reference | 55 | buySideProvider | ETH/FEB23 | buy | 1 | 15940 | 1 | TYPE_LIMIT | TIF_GTC | | 56 57 When the network moves ahead "1" blocks 58 Then the mark price should be "15900" for the market "ETH/FEB23" 59 60 When the network moves ahead "2" blocks 61 Then the mark price should be "15900" for the market "ETH/FEB23" 62 63 # pushing price from oracle 64 Then the oracles broadcast data with block time signed with "0xCAFECAFE1": 65 | name | value | time offset | 66 | price1.USD.value | 16000 | -1s | 67 68 When the network moves ahead "1" blocks 69 # only the first oracle has ticked so mark price is set fully from oracle1 70 Then the mark price should be "16000" for the market "ETH/FEB23" 71 72 # update oracle price 73 Then the oracles broadcast data with block time signed with "0xCAFECAFE1": 74 | name | value | time offset | 75 | price1.USD.value | 15000 | -1s | 76 77 When the network moves ahead "2" blocks 78 Then the oracles broadcast data with block time signed with "0xCAFECAFE1": 79 | name | value | time offset | 80 | price1.USD.value | 15000 | -1s | 81 82 When the network moves ahead "1" blocks 83 Then the mark price should be "15000" for the market "ETH/FEB23"