code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/liquidity-provision-bond-account-dp.feature (about) 1 Feature: Check that bond slashing works with non-default asset decimals, market decimals, position decimals. 2 3 Background: 4 5 Given the log normal risk model named "log-normal-risk-model-1": 6 | risk aversion | tau | mu | r | sigma | 7 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 8 And the following assets are registered: 9 | id | decimal places | 10 | USD | 3 | 11 And the fees configuration named "fees-config-1": 12 | maker fee | infrastructure fee | 13 | 0.004 | 0.001 | 14 And the price monitoring named "price-monitoring-1": 15 | horizon | probability | auction extension | 16 | 1 | 0.99 | 300 | 17 And the following network parameters are set: 18 | name | value | 19 | market.liquidity.bondPenaltyParameter | 0.1 | 20 | limits.markets.maxPeggedOrders | 2 | 21 | validators.epoch.length | 5s | 22 Given the liquidity monitoring parameters: 23 | name | triggering ratio | time window | scaling factor | 24 | lqm-params | 0.24 | 24h | 1.0 | 25 26 And the markets: 27 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | decimal places | position decimal places | linear slippage factor | quadratic slippage factor | sla params | 28 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 1 | 2 | 0.05 | 0 | default-futures | 29 And the parties deposit on asset's general account the following amount: 30 | party | asset | amount | 31 | party0 | USD | 2700000 | 32 | party1 | USD | 100000000 | 33 | party2 | USD | 100000000 | 34 | party3 | USD | 100000000 | 35 | party4 | USD | 100000000 | 36 | party5 | USD | 100000000 | 37 And the following network parameters are set: 38 | name | value | 39 | network.markPriceUpdateMaximumFrequency | 0s | 40 And the average block duration is "1" 41 42 @Now 43 Scenario: Bond slashing on LP (0044-LIME-002, 0035-LIQM-004, 0044-LIME-009 ) 44 45 Given the average block duration is "1" 46 47 And the parties submit the following liquidity provision: 48 | id | party | market id | commitment amount | fee | lp type | 49 | lp1 | party0 | ETH/MAR22 | 500000 | 0 | submission | 50 | lp1 | party0 | ETH/MAR22 | 500000 | 0 | amendment | 51 And the parties place the following pegged iceberg orders: 52 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 53 | party0 | ETH/MAR22 | 49 | 1 | sell | ASK | 500 | 20 | 54 | party0 | ETH/MAR22 | 52 | 1 | buy | BID | 500 | 20 | 55 56 And the parties place the following orders: 57 | party | market id | side | volume | price | resulting trades | type | tif | reference | 58 | party4 | ETH/MAR22 | buy | 100 | 850 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-4 | 59 | party1 | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-1 | 60 | party1 | ETH/MAR22 | buy | 1 | 990 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-1 | 61 | party1 | ETH/MAR22 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-2 | 62 | party2 | ETH/MAR22 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-3 | 63 | party2 | ETH/MAR22 | sell | 1 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-1 | 64 | party2 | ETH/MAR22 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-2 | 65 | party5 | ETH/MAR22 | sell | 100 | 1200 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-5 | 66 67 When the opening auction period ends for market "ETH/MAR22" 68 Then the auction ends with a traded volume of "10" at a price of "1000" 69 70 And the insurance pool balance should be "0" for the market "ETH/MAR22" 71 And the market data for the market "ETH/MAR22" should be: 72 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 73 | 1000 | TRADING_MODE_CONTINUOUS | 1 | 1000 | 1000 | 35569 | 500000 | 10 | 74 75 #check the volume on the order book 76 Then the order book should have the following volumes for market "ETH/MAR22": 77 | side | price | volume | 78 | sell | 1100 | 1 | 79 | sell | 1030 | 49 | 80 | sell | 1010 | 1 | 81 | buy | 990 | 1 | 82 | buy | 970 | 52 | 83 | buy | 900 | 1 | 84 85 # check the requried balances 86 And the parties should have the following account balances: 87 | party | asset | market id | margin | general | bond | 88 | party0 | USD | ETH/MAR22 | 2134142 | 65858 | 500000 | 89 | party1 | USD | ETH/MAR22 | 11425 | 99988575 | | 90 | party2 | USD | ETH/MAR22 | 51690 | 99948310 | | 91 #check the margin levels 92 Then the parties should have the following margin levels: 93 | party | market id | maintenance | 94 | party0 | ETH/MAR22 | 1778452 | 95 | party1 | ETH/MAR22 | 10109 | 96 | party2 | ETH/MAR22 | 43183 | 97 #check position (party0 has no position) 98 Then the parties should have the following profit and loss: 99 | party | volume | unrealised pnl | realised pnl | 100 | party1 | 10 | 0 | 0 | 101 | party2 | -10 | 0 | 0 | 102 103 When the parties place the following orders: 104 | party | market id | side | volume | price | resulting trades | type | tif | reference | 105 | party3 | ETH/MAR22 | buy | 30 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party3-buy-1 | 106 107 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22" 108 109 When the parties place the following orders: 110 | party | market id | side | volume | price | resulting trades | type | tif | reference | 111 | party2 | ETH/MAR22 | sell | 50 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | party2-sell-4 | 112 113 And the market data for the market "ETH/MAR22" should be: 114 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 115 | 1000 | TRADING_MODE_CONTINUOUS | 1 | 1000 | 1000 | 142276 | 500000 | 40 | 116 117 And the parties should have the following account balances: 118 | party | asset | market id | margin | general | bond | 119 | party0 | USD | ETH/MAR22 | 2134142 | 65858 | 500000 | 120 | party1 | USD | ETH/MAR22 | 11425 | 99988575 | | 121 | party2 | USD | ETH/MAR22 | 265234 | 99734616 | | 122 123 And the insurance pool balance should be "0" for the market "ETH/MAR22" 124 125 When the parties place the following orders: 126 | party | market id | side | volume | price | resulting trades | type | tif | reference | 127 | party0 | ETH/MAR22 | sell | 110 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | party0-sell-3 | 128 | party1 | ETH/MAR22 | buy | 110 | 1000 | 2 | TYPE_LIMIT | TIF_GTC | party1-buy-4 | 129 130 # extra margin for party0 131 # bond slashed 132 And the market data for the market "ETH/MAR22" should be: 133 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 134 | 1000 | TRADING_MODE_CONTINUOUS | 1 | 1000 | 1000 | 533535 | 500000 | 150 | 135 136 And the insurance pool balance should be "40365" for the market "ETH/MAR22" 137 138 # check the requried balances 139 And the parties should have the following account balances: 140 | party | asset | market id | margin | general | bond | 141 | party0 | USD | ETH/MAR22 | 2603654 | 360 | 55981 | 142 | party1 | USD | ETH/MAR22 | 117826 | 99881624 | | 143 | party2 | USD | ETH/MAR22 | 265234 | 99734696 | | 144 | party3 | USD | ETH/MAR22 | 28826 | 99971294 | | 145 146 Then the parties should have the following margin levels: 147 | party | market id | maintenance | 148 | party0 | ETH/MAR22 | 2169712 | 149 | party1 | ETH/MAR22 | 98189 | 150 | party2 | ETH/MAR22 | 221029 |