code.vegaprotocol.io/vega@v0.79.0/core/integration/features/mark-price/0009-MRKP-120.feature (about) 1 Feature: Test setting of mark price 2 Background: 3 Given the average block duration is "1" 4 Given the following network parameters are set: 5 | name | value | 6 | network.markPriceUpdateMaximumFrequency | 4s | 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 simple risk model named "simple-risk-model": 14 | long | short | max move up | min move down | probability of trading | 15 | 0.1 | 0.1 | 100 | -100 | 0.2 | 16 And the markets: 17 | 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 | 18 | 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.5 | 2 | 100 | 0,1,0,0 | 6s,4s,24h0m0s,1h25m0s | future | 19 | 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.5 | 2 | 100 | 0,1,0,0 | 6s,4s,24h0m0s,1h25m0s | perp | 20 21 22 Scenario: 001 check mark price using order price with cash amount 100 USD 23 Given the parties deposit on asset's general account the following amount: 24 | party | asset | amount | 25 | buySideProvider | USD | 100000000000 | 26 | sellSideProvider | USD | 100000000000 | 27 | party | USD | 48050 | 28 | buySideProvider1 | USD | 100000000000 | 29 | sellSideProvider1 | USD | 100000000000 | 30 | party1 | USD | 48050 | 31 And the parties place the following orders: 32 | party | market id | side | volume | price | resulting trades | type | tif | 33 | buySideProvider | ETH/FEB23 | buy | 10 | 14900 | 0 | TYPE_LIMIT | TIF_GTC | 34 | buySideProvider | ETH/FEB23 | buy | 1 | 15000 | 0 | TYPE_LIMIT | TIF_GTC | 35 | buySideProvider | ETH/FEB23 | buy | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | 36 | party | ETH/FEB23 | sell | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | 37 | party | ETH/FEB23 | sell | 2 | 15902 | 0 | TYPE_LIMIT | TIF_GTC | 38 | party | ETH/FEB23 | sell | 1 | 15904 | 0 | TYPE_LIMIT | TIF_GTC | 39 | sellSideProvider | ETH/FEB23 | sell | 10 | 100100 | 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 | party1 | ETH/FEB22 | sell | 2 | 15902 | 0 | TYPE_LIMIT | TIF_GTC | 45 | party1 | ETH/FEB22 | sell | 1 | 15904 | 0 | TYPE_LIMIT | TIF_GTC | 46 | sellSideProvider1 | ETH/FEB22 | sell | 10 | 100100 | 0 | TYPE_LIMIT | TIF_GTC | 47 48 #AC 0009-MRKP-120,0009-MRKP-121, 0009-MRKP-014,0009-MRKP-015 49 When the network moves ahead "2" blocks 50 Then the mark price should be "15900" for the market "ETH/FEB23" 51 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/FEB23" 52 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/FEB22" 53 54 And the parties should have the following margin levels: 55 | party | market id | maintenance | margin mode | 56 | party | ETH/FEB23 | 21465 | cross margin | 57 #margin = 3*15900*(0.25)+3*0.1*15900 + 3*0.1*15900=21465 58 59 Then the parties should have the following account balances: 60 | party | asset | market id | margin | general | 61 | party | USD | ETH/FEB23 | 25758 | 22292 | 62 63 When the network moves ahead "2" blocks 64 Then the mark price should be "15900" for the market "ETH/FEB23" 65 Then the mark price should be "15900" for the market "ETH/FEB22" 66 67 When the network moves ahead "1" blocks 68 Then the mark price should be "15900" for the market "ETH/FEB23" 69 70 When the network moves ahead "1" blocks 71 Then the mark price should be "15900" for the market "ETH/FEB23" 72 73 When the network moves ahead "1" blocks 74 Then the mark price should be "15451" for the market "ETH/FEB23" 75 Then the mark price should be "15451" for the market "ETH/FEB22" 76 77 And the parties place the following orders: 78 | party | market id | side | volume | price | resulting trades | type | tif | reference | 79 | buySideProvider | ETH/FEB23 | buy | 1 | 15904 | 1 | TYPE_LIMIT | TIF_GTC | | 80 | buySideProvider1 | ETH/FEB22 | buy | 1 | 15904 | 1 | TYPE_LIMIT | TIF_GTC | | 81 When the network moves ahead "2" blocks 82 Then the mark price should be "15451" for the market "ETH/FEB23" 83 Then the mark price should be "15451" for the market "ETH/FEB22" 84 85 86 87