code.vegaprotocol.io/vega@v0.79.0/core/integration/features/margin/0019-MCAL-176.feature (about) 1 Feature: amend the order and it gets partially matched and you have cover for the trade but not for the remaining order - the trade is done but all of your remaining orders are cancelled 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 And the markets: 13 | 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 | 14 | ETH/FEB23 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.35 | 0 | default-futures | 15 16 Scenario: 001 party and party1 both orders and positions 17 Given the parties deposit on asset's general account the following amount: 18 | party | asset | amount | 19 | buySideProvider | USD | 100000000000 | 20 | sellSideProvider | USD | 100000000000 | 21 | party | USD | 113040 | 22 | party1 | USD | 264400 | 23 And the parties place the following orders: 24 | party | market id | side | volume | price | resulting trades | type | tif | reference | 25 | buySideProvider | ETH/FEB23 | buy | 10 | 14900 | 0 | TYPE_LIMIT | TIF_GTC | | 26 | buySideProvider | ETH/FEB23 | buy | 2 | 15300 | 0 | TYPE_LIMIT | TIF_GTC | | 27 | party | ETH/FEB23 | buy | 6 | 15500 | 0 | TYPE_LIMIT | TIF_GTC | party-buy | 28 | buySideProvider | ETH/FEB23 | buy | 6 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 29 | party | ETH/FEB23 | sell | 6 | 15900 | 0 | TYPE_LIMIT | TIF_GTC | | 30 | party1 | ETH/FEB23 | sell | 4 | 16900 | 0 | TYPE_LIMIT | TIF_GTC | | 31 | sellSideProvider | ETH/FEB23 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | | 32 | sellSideProvider | ETH/FEB23 | sell | 10 | 100100 | 0 | TYPE_LIMIT | TIF_GTC | | 33 34 When the network moves ahead "2" blocks 35 Then the mark price should be "15900" for the market "ETH/FEB23" 36 37 And the order book should have the following volumes for market "ETH/FEB23": 38 | side | price | volume | 39 | buy | 15500 | 6 | 40 | sell | 16900 | 4 | 41 42 And the parties submit update margin mode: 43 | party | market | margin_mode | margin_factor | error | 44 | party | ETH/FEB23 | isolated margin | 0.6 | | 45 46 And the parties should have the following margin levels: 47 | party | market id | maintenance | search | initial | release | margin mode | margin factor | order | 48 | party | ETH/FEB23 | 42930 | 0 | 51516 | 0 | isolated margin | 0.6 | 0 | 49 50 Then the parties should have the following account balances: 51 | party | asset | market id | margin | general | order margin | 52 | party | USD | ETH/FEB23 | 57240 | 0 | 55800 | 53 54 #add additional order to reduce exit_price, hence slippage 55 And the parties place the following orders: 56 | party | market id | side | volume | price | resulting trades | type | tif | reference | 57 | sellSideProvider | ETH/FEB23 | sell | 10 | 16000 | 0 | TYPE_LIMIT | TIF_GTC | s-liq | 58 59 #AC: 0019-MCAL-176, amend order price so order get filled/partially filled 60 When the parties amend the following orders: 61 | party | reference | price | size delta | tif | error | 62 | party | party-buy | 16900 | 0 | TIF_GTC | | 63 64 And the orders should have the following status: 65 | party | reference | status | 66 | party | party-buy | STATUS_FILLED | 67 68 And the order book should have the following volumes for market "ETH/FEB23": 69 | side | price | volume | 70 | buy | 15500 | 0 | 71 72 When the network moves ahead "2" blocks 73 74 #party's order is closed 75 And the parties should have the following margin levels: 76 | party | market id | maintenance | search | initial | release | margin mode | margin factor | order | 77 | party | ETH/FEB23 | 0 | 0 | 0 | 0 | isolated margin | 0.6 | 0 | 78 79 Then the parties should have the following account balances: 80 | party | asset | market id | margin | general | order margin | 81 | party | USD | ETH/FEB23 | 0 | 113040 | 0 | 82 83