code.vegaprotocol.io/vega@v0.79.0/core/integration/features/amm/0090-VAMM-004.feature (about) 1 Feature: Test vAMM submission works as expected (invalid submission) 2 3 Background: 4 Given the average block duration is "1" 5 And the margin calculator named "margin-calculator-1": 6 | search factor | initial factor | release factor | 7 | 1.2 | 1.5 | 1.7 | 8 And the log normal risk model named "log-normal-risk-model": 9 | risk aversion | tau | mu | r | sigma | 10 | 0.001 | 0.0011407711613050422 | 0 | 0.9 | 3.0 | 11 And the liquidity monitoring parameters: 12 | name | triggering ratio | time window | scaling factor | 13 | lqm-params | 1.00 | 20s | 1 | 14 15 And the following network parameters are set: 16 | name | value | 17 | market.value.windowLength | 60s | 18 | network.markPriceUpdateMaximumFrequency | 0s | 19 | limits.markets.maxPeggedOrders | 6 | 20 | market.auction.minimumDuration | 1 | 21 | market.fee.factors.infrastructureFee | 0.001 | 22 | market.fee.factors.makerFee | 0.004 | 23 | spam.protection.max.stopOrdersPerMarket | 5 | 24 | market.liquidity.equityLikeShareFeeFraction | 1 | 25 | market.amm.minCommitmentQuantum | 1 | 26 | market.liquidity.bondPenaltyParameter | 0.2 | 27 | market.liquidity.stakeToCcyVolume | 1 | 28 | market.liquidity.successorLaunchWindowLength | 1h | 29 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.1 | 30 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.6 | 31 | validators.epoch.length | 10s | 32 | market.liquidity.earlyExitPenalty | 0.25 | 33 | market.liquidity.maximumLiquidityFeeFactorLevel | 0.25 | 34 #risk factor short:3.5569036 35 #risk factor long:0.801225765 36 And the following assets are registered: 37 | id | decimal places | 38 | USD | 0 | 39 And the fees configuration named "fees-config-1": 40 | maker fee | infrastructure fee | 41 | 0.0004 | 0.001 | 42 And the price monitoring named "price-monitoring": 43 | horizon | probability | auction extension | 44 | 3600 | 0.95 | 3 | 45 46 And the liquidity sla params named "SLA-22": 47 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 48 | 0.5 | 0.6 | 1 | 1.0 | 49 50 And the markets: 51 | 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 | 52 | ETH/MAR22 | USD | USD | lqm-params | log-normal-risk-model | margin-calculator-1 | 2 | fees-config-1 | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA-22 | 53 54 @VAMM 55 Scenario: 0090-VAMM-004: When market.amm.minCommitmentQuantum is 1, mid price of the market 100, a user with 100 USDT is unable to create a vAMM with commitment 1000, and any other combination of settings. 56 Given the parties deposit on asset's general account the following amount: 57 | party | asset | amount | 58 | lp1 | USD | 100000 | 59 | lp2 | USD | 100000 | 60 | lp3 | USD | 100000 | 61 | party1 | USD | 100000 | 62 | party2 | USD | 100000 | 63 | party3 | USD | 100000 | 64 | vamm1 | USD | 100000 | 65 66 When the parties submit the following liquidity provision: 67 | id | party | market id | commitment amount | fee | lp type | 68 | lp_1 | lp1 | ETH/MAR22 | 600 | 0.02 | submission | 69 | lp_2 | lp2 | ETH/MAR22 | 400 | 0.015 | submission | 70 Then the network moves ahead "4" blocks 71 And the current epoch is "0" 72 73 And the parties place the following orders: 74 | party | market id | side | volume | price | resulting trades | type | tif | reference | 75 | party3 | ETH/MAR22 | buy | 10 | 85 | 0 | TYPE_LIMIT | TIF_GTC | | 76 | party1 | ETH/MAR22 | buy | 10 | 90 | 0 | TYPE_LIMIT | TIF_GTC | | 77 | party1 | ETH/MAR22 | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | | 78 | party2 | ETH/MAR22 | sell | 10 | 110 | 0 | TYPE_LIMIT | TIF_GTC | | 79 | party2 | ETH/MAR22 | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | | 80 | party3 | ETH/MAR22 | sell | 1 | 120 | 0 | TYPE_LIMIT | TIF_GTC | | 81 | lp1 | ETH/MAR22 | buy | 10 | 95 | 0 | TYPE_LIMIT | TIF_GTC | lp1-b | 82 | lp1 | ETH/MAR22 | sell | 10 | 105 | 0 | TYPE_LIMIT | TIF_GTC | lp1-s | 83 When the opening auction period ends for market "ETH/MAR22" 84 Then the following trades should be executed: 85 | buyer | price | size | seller | 86 | party1 | 100 | 1 | party2 | 87 88 And the market data for the market "ETH/MAR22" should be: 89 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | ref price | mid price | static mid price | 90 | 100 | TRADING_MODE_CONTINUOUS | 3600 | 94 | 106 | 39 | 1000 | 1 | 100 | 100 | 100 | 91 # Try all submissions from AC's 0090-VAMM-001 through 0090-VAMM-003, add some more for good measure 92 When the parties submit the following AMM: 93 | party | market id | amount | slippage | base | lower bound | upper bound | lower leverage | upper leverage | error | proposed fee | 94 | vamm1 | ETH/MAR22 | 200000 | 0.1 | 100 | 90 | 110 | 4 | 4 | not enough collateral in general account | 0.01 | 95 96 When the parties submit the following AMM: 97 | party | market id | amount | slippage | base | lower bound | lower leverage | error | proposed fee | 98 | vamm1 | ETH/MAR22 | 200000 | 0.1 | 90 | 85 | 0.25 | not enough collateral in general account | 0.01 | 99 100 When the parties submit the following AMM: 101 | party | market id | amount | slippage | base | upper bound | upper leverage | error | proposed fee | 102 | vamm1 | ETH/MAR22 | 200000 | 0.1 | 110 | 150 | 0.25 | not enough collateral in general account | 0.01 | 103 104 When the parties submit the following AMM: 105 | party | market id | amount | slippage | base | lower bound | lower leverage | error | proposed fee | 106 | vamm1 | ETH/MAR22 | 200000 | 0.01 | 110 | 99 | 0.1 | not enough collateral in general account | 0.01 | 107 108 When the parties submit the following AMM: 109 | party | market id | amount | slippage | base | upper bound | upper leverage | error | proposed fee | 110 | vamm1 | ETH/MAR22 | 200000 | 0.01 | 90 | 101 | 0.02 | not enough collateral in general account | 0.01 | 111 112 When the parties submit the following AMM: 113 | party | market id | amount | slippage | base | lower bound | upper bound | lower leverage | upper leverage | error | proposed fee | 114 | vamm1 | ETH/MAR22 | 200000 | 0.001 | 101 | 95 | 105 | 0.01 | 0.01 | not enough collateral in general account | 0.01 |