code.vegaprotocol.io/vega@v0.79.0/core/integration/features/mark-price/0009-MRKP-110.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 And the perpetual oracles from "0xCAFECAFE1": 7 | 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 | 8 | perp-oracle | USD | perp.ETH.value | TYPE_INTEGER | perp.funding.cue | TYPE_TIMESTAMP | 0.5 | 0.05 | 0.1 | 0.9 | ETH | 18 | 9 And the liquidity monitoring parameters: 10 | name | triggering ratio | time window | scaling factor | 11 | lqm-params | 0.00 | 24h | 1e-9 | 12 And the simple risk model named "simple-risk-model": 13 | long | short | max move up | min move down | probability of trading | 14 | 0.1 | 0.1 | 100 | -100 | 0.2 | 15 And the markets: 16 | 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 | 17 | 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 | 1 | 0 | 1,0,0,0 | 5s,5s,24h0m0s,1h25m0s | future | 18 | ETH/FEB22 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | default-none | perp-oracle | 0.25 | 0 | default-futures | weight | 0 | 1 | 0 | 1,0,0,0 | 5s,5s,24h0m0s,1h25m0s | perp | 19 20 Scenario: 001 check mark price using weight average 21 Given the parties deposit on asset's general account the following amount: 22 | party | asset | amount | 23 | buySideProvider | USD | 100000000000 | 24 | sellSideProvider | USD | 100000000000 | 25 | party | USD | 48050 | 26 | buySideProvider1 | USD | 100000000000 | 27 | sellSideProvider1 | USD | 100000000000 | 28 | party1 | 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 | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | | 40 | buySideProvider1 | ETH/FEB22 | buy | 10 | 14900 | 0 | TYPE_LIMIT | TIF_GTC | | 41 | buySideProvider1 | ETH/FEB22 | buy | 1 | 15000 | 0 | TYPE_LIMIT | TIF_GTC | | 42 | buySideProvider1 | ETH/FEB22 | buy | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 43 | party1 | ETH/FEB22 | sell | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 44 | sellSideProvider1 | ETH/FEB22 | sell | 2 | 15920 | 0 | TYPE_LIMIT | TIF_GTC | sell-2 | 45 | sellSideProvider1 | ETH/FEB22 | sell | 1 | 15940 | 0 | TYPE_LIMIT | TIF_GTC | sell-3 | 46 | sellSideProvider1 | ETH/FEB22 | sell | 3 | 15960 | 0 | TYPE_LIMIT | TIF_GTC | sell-4 | 47 | sellSideProvider1 | ETH/FEB22 | sell | 5 | 15990 | 0 | TYPE_LIMIT | TIF_GTC | sell-5 | 48 | sellSideProvider1 | ETH/FEB22 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | | 49 50 # AC 0009-MRKP-110, 0009-MRKP-111 51 When the network moves ahead "2" blocks 52 Then the mark price should be "15900" for the market "ETH/FEB23" 53 Then the mark price should be "15900" for the market "ETH/FEB22" 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 | 2 | 15920 | 1 | TYPE_LIMIT | TIF_GTC | | 58 | buySideProvider1 | ETH/FEB22 | buy | 2 | 15920 | 1 | TYPE_LIMIT | TIF_GTC | | 59 60 When the network moves ahead "1" blocks 61 Then the mark price should be "15900" for the market "ETH/FEB23" 62 Then the mark price should be "15900" for the market "ETH/FEB22" 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 | 1 | 15940 | 1 | TYPE_LIMIT | TIF_GTC | | 67 | buySideProvider1 | ETH/FEB22 | buy | 1 | 15940 | 1 | TYPE_LIMIT | TIF_GTC | | 68 69 When the network moves ahead "1" blocks 70 Then the mark price should be "15900" for the market "ETH/FEB23" 71 Then the mark price should be "15900" for the market "ETH/FEB22" 72 73 And the parties place the following orders: 74 | party | market id | side | volume | price | resulting trades | type | tif | reference | 75 | buySideProvider | ETH/FEB23 | buy | 3 | 15960 | 1 | TYPE_LIMIT | TIF_GTC | | 76 | buySideProvider1 | ETH/FEB22 | buy | 3 | 15960 | 1 | TYPE_LIMIT | TIF_GTC | | 77 78 When the network moves ahead "1" blocks 79 Then the mark price should be "15900" for the market "ETH/FEB23" 80 Then the mark price should be "15900" for the market "ETH/FEB22" 81 82 And the parties place the following orders: 83 | party | market id | side | volume | price | resulting trades | type | tif | reference | 84 | buySideProvider | ETH/FEB23 | buy | 5 | 15990 | 1 | TYPE_LIMIT | TIF_GTC | | 85 | buySideProvider1 | ETH/FEB22 | buy | 5 | 15990 | 1 | TYPE_LIMIT | TIF_GTC | | 86 87 When the network moves ahead "1" blocks 88 Then the mark price should be "15900" for the market "ETH/FEB23" 89 Then the mark price should be "15900" for the market "ETH/FEB22" 90 91 #decay weight is 0, so no time weight, mark price is: (15920*2+15940*1+15960*3+15990*5)/11=15964 92 When the network moves ahead "1" blocks 93 Then the mark price should be "15964" for the market "ETH/FEB23" 94 Then the mark price should be "15964" for the market "ETH/FEB22" 95 96 97 98 99 100