code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/fcap_liquidations.feature (about) 1 Feature: FCAP liquidations 2 3 vega-market-sim fuzz testing shows parties being liquidated after 4 opening positions with market orders. 5 6 Test replicates behaviour and shows network liquidating party. 7 8 Background: 9 10 # Initialise the network and register the assets 11 Given the average block duration is "1" 12 And the following network parameters are set: 13 | name | value | 14 | market.fee.factors.makerFee | 0 | 15 | market.fee.factors.infrastructureFee | 0 | 16 | network.markPriceUpdateMaximumFrequency | 0s | 17 18 And the following assets are registered: 19 | id | decimal places | quantum | 20 | USD-1-10 | 0 | 1 | 21 22 # Initialise the parties and deposit assets 23 Given the parties deposit on asset's general account the following amount: 24 | party | asset | amount | 25 | lp | USD-1-10 | 100000000000 | 26 | aux1 | USD-1-10 | 100000000000 | 27 | aux2 | USD-1-10 | 100000000000 | 28 29 # Setup the FCAP market in continuous trading 30 Given the price monitoring named "price-monitoring": 31 | horizon | probability | auction extension | 32 | 3600 | 0.99 | 5 | 33 Given the markets: 34 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | position decimal places | max price cap | binary | fully collateralised | 35 | FCAP/USD-1-10 | ETH | USD-1-10 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | 100 | true | true | 36 | FCAP-PM/USD-1-10 | ETH | USD-1-10 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | price-monitoring | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | 100 | true | true | 37 And the parties submit the following liquidity provision: 38 | id | party | market id | commitment amount | fee | lp type | 39 | lp1 | lp | FCAP/USD-1-10 | 1000000 | 0 | submission | 40 And the parties place the following orders: 41 | party | market id | side | volume | price | resulting trades | type | tif | 42 | aux1 | FCAP/USD-1-10 | buy | 1 | 50 | 0 | TYPE_LIMIT | TIF_GTC | 43 | aux2 | FCAP/USD-1-10 | sell | 1 | 50 | 0 | TYPE_LIMIT | TIF_GTC | 44 And the parties submit the following liquidity provision: 45 | id | party | market id | commitment amount | fee | lp type | 46 | lp1 | lp | FCAP-PM/USD-1-10 | 1000000 | 0 | submission | 47 And the parties place the following orders: 48 | party | market id | side | volume | price | resulting trades | type | tif | 49 | aux1 | FCAP-PM/USD-1-10 | buy | 1 | 50 | 0 | TYPE_LIMIT | TIF_GTC | 50 | aux2 | FCAP-PM/USD-1-10 | sell | 1 | 50 | 0 | TYPE_LIMIT | TIF_GTC | 51 When the network moves ahead "2" blocks 52 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "FCAP/USD-1-10" 53 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "FCAP-PM/USD-1-10" 54 55 56 57 @CappedF @NoPerp 58 Scenario: Party opens a short position with a market order and is liquidiated at the next mark to market. 59 60 And the following network parameters are set: 61 | name | value | 62 | network.markPriceUpdateMaximumFrequency | 5s | 63 64 Given the parties deposit on asset's general account the following amount: 65 | party | asset | amount | 66 | trader | USD-1-10 | 50 | 67 68 Given the parties place the following orders: 69 | party | market id | side | volume | price | resulting trades | type | tif | error | 70 | aux1 | FCAP/USD-1-10 | sell | 1 | 60 | 0 | TYPE_LIMIT | TIF_GTC | | 71 | trader | FCAP/USD-1-10 | buy | 1 | 0 | 0 | TYPE_MARKET | TIF_FOK | margin check failed | 72 And the parties should have the following account balances: 73 | party | asset | market id | margin | general | 74 | trader | USD-1-10 | FCAP/USD-1-10 | 0 | 50 | 75 76 77 @CappedF @NoPerp 78 Scenario: Party place a limit order with not enough to cover fes 79 80 And the following network parameters are set: 81 | name | value | 82 | network.markPriceUpdateMaximumFrequency | 5s | 83 | market.fee.factors.infrastructureFee | 0.1 | 84 85 86 Given the parties deposit on asset's general account the following amount: 87 | party | asset | amount | 88 | trader | USD-1-10 | 50 | 89 90 Given the parties place the following orders: 91 | party | market id | side | volume | price | resulting trades | type | tif | 92 | trader | FCAP-PM/USD-1-10 | buy | 1 | 50 | 0 | TYPE_LIMIT | TIF_GTC | 93 When the network moves ahead "1" blocks 94 And the parties should have the following account balances: 95 | party | asset | market id | margin | general | 96 | trader | USD-1-10 | FCAP-PM/USD-1-10 | 50 | 0 | 97 98 And the market data for the market "FCAP-PM/USD-1-10" should be: 99 | mark price | trading mode | horizon | min bound | max bound | 100 | 50 | TRADING_MODE_CONTINUOUS | 3600 | 48 | 52 | 101 Given the parties place the following orders: 102 | party | market id | side | volume | price | resulting trades | type | tif | reference | 103 | aux1 | FCAP-PM/USD-1-10 | buy | 1 | 60 | 0 | TYPE_LIMIT | TIF_GTC | auction-order-aux1 | 104 | aux2 | FCAP-PM/USD-1-10 | sell | 1 | 60 | 0 | TYPE_LIMIT | TIF_GTC | auction-order-aux2 | 105 When the network moves ahead "1" blocks 106 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "FCAP-PM/USD-1-10" 107 Then the parties cancel the following orders: 108 | party | reference | 109 | aux1 | auction-order-aux1 | 110 | aux2 | auction-order-aux2 | 111 Given the parties place the following orders: 112 | party | market id | side | volume | price | resulting trades | type | tif | 113 | aux1 | FCAP-PM/USD-1-10 | sell | 1 | 50 | 0 | TYPE_LIMIT | TIF_GTC | 114 Then the network moves ahead "10" blocks 115 Then debug trades 116 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "FCAP-PM/USD-1-10" 117