code.vegaprotocol.io/vega@v0.79.0/core/integration/features/margin/0019-MCAL-160.feature (about) 1 Feature: amend the order and it isn't matched and it's all good and it just moves some funds around and it sits in the book and wait 2 Background: 3 # Set liquidity parameters to allow "zero" target-stake which is needed to construct the order-book defined in the ACs 4 Given the following network parameters are set: 5 | name | value | 6 | network.markPriceUpdateMaximumFrequency | 1s | 7 And the liquidity monitoring parameters: 8 | name | triggering ratio | time window | scaling factor | 9 | lqm-params | 0.00 | 24h | 1e-9 | 10 And the simple risk model named "simple-risk-model": 11 | long | short | max move up | min move down | probability of trading | 12 | 0.1 | 0.1 | 100 | -100 | 0.2 | 13 And the markets: 14 | 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 | 15 | ETH/FEB23 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.000125 | 0 | default-futures | 16 17 Scenario: 001 party holds orders only, and party1 holds both orders and positions 18 Given the parties deposit on asset's general account the following amount: 19 | party | asset | amount | 20 | buySideProvider | USD | 100000000000 | 21 | sellSideProvider | USD | 100000000000 | 22 | party | USD | 48050 | 23 | party1 | USD | 48050 | 24 And the parties place the following orders: 25 | party | market id | side | volume | price | resulting trades | type | tif | reference | 26 | buySideProvider | ETH/FEB23 | buy | 10 | 14900 | 0 | TYPE_LIMIT | TIF_GTC | | 27 | buySideProvider | ETH/FEB23 | buy | 1 | 15000 | 0 | TYPE_LIMIT | TIF_GTC | | 28 | buySideProvider | ETH/FEB23 | buy | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 29 | party | ETH/FEB23 | sell | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 30 | party | ETH/FEB23 | sell | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | party-sell | 31 | party1 | ETH/FEB23 | sell | 3 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | party1-sell | 32 | sellSideProvider | ETH/FEB23 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | | 33 | sellSideProvider | ETH/FEB23 | sell | 10 | 100100 | 0 | TYPE_LIMIT | TIF_GTC | | 34 35 When the network moves ahead "2" blocks 36 # Check mark-price matches the specification 37 Then the mark price should be "15900" for the market "ETH/FEB23" 38 39 #AC: 0019-MCAL-160, 0019-MCAL-161 40 And the parties submit update margin mode: 41 | party | market | margin_mode | margin_factor | error | 42 | party | ETH/FEB23 | isolated margin | 0.2 | | 43 | party1 | ETH/FEB23 | isolated margin | 0.2 | | 44 45 #maintenance margin: min(3*(15900-15900),15900*3*0.25)+3*0.1*15900=4770 46 And the parties should have the following margin levels: 47 | party | market id | maintenance | margin mode | margin factor | order | 48 | party | ETH/FEB23 | 4776 | isolated margin | 0.2 | 9540 | 49 | party1 | ETH/FEB23 | 0 | isolated margin | 0.2 | 9540 | 50 51 When the parties amend the following orders: 52 | party | reference | price | size delta | tif | error | 53 | party | party-sell | 16900 | 0 | TIF_GTC | | 54 | party1 | party1-sell | 16900 | 0 | TIF_GTC | | 55 56 When the network moves ahead "2" blocks 57 58 And the order book should have the following volumes for market "ETH/FEB23": 59 | side | price | volume | 60 | sell | 15900 | 0 | 61 | sell | 16900 | 6 | 62 63 And the orders should have the following status: 64 | party | reference | status | 65 | party | party-sell | STATUS_ACTIVE | 66 | party1 | party1-sell | STATUS_ACTIVE | 67 68 # margin should be: min(3*(16900-15900),15900*3*0.25)+3*0.1*15900=7770 69 And the parties should have the following margin levels: 70 | party | market id | maintenance | margin mode | margin factor | order | 71 | party | ETH/FEB23 | 4776 | isolated margin | 0.2 | 10140 | 72 | party1 | ETH/FEB23 | 0 | isolated margin | 0.2 | 10140 | 73 74 #AC: 0019-MCAL-162, 0019-MCAL-163 75 When the parties amend the following orders: 76 | party | reference | price | size delta | tif | error | 77 | party | party-sell | 16900 | 1 | TIF_GTC | | 78 | party1 | party1-sell | 16900 | 1 | TIF_GTC | | 79 When the network moves ahead "2" blocks 80 81 And the order book should have the following volumes for market "ETH/FEB23": 82 | side | price | volume | 83 | sell | 15900 | 0 | 84 | sell | 16900 | 8 | 85 86 And the orders should have the following status: 87 | party | reference | status | 88 | party | party-sell | STATUS_ACTIVE | 89 | party1 | party1-sell | STATUS_ACTIVE | 90 91 #maintenance margin: min(3*(16900-15900),15900*3*0.000125)+3*0.1*15900=4776 92 And the parties should have the following margin levels: 93 | party | market id | maintenance | margin mode | margin factor | order | 94 | party | ETH/FEB23 | 4776 | isolated margin | 0.2 | 13520 | 95 | party1 | ETH/FEB23 | 0 | isolated margin | 0.2 | 13520 | 96 97 Then the mark price should be "15900" for the market "ETH/FEB23"