code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/0044-LIME-016.feature (about) 1 Feature: Test LP SLA Bond penalty; 2 3 Background: 4 5 Given the margin calculator named "margin-calculator-1": 6 | search factor | initial factor | release factor | 7 | 1.2 | 1.5 | 1.7 | 8 Given the log normal risk model named "log-normal-risk-model": 9 | risk aversion | tau | mu | r | sigma | 10 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 11 And the liquidity monitoring parameters: 12 | name | triggering ratio | time window | scaling factor | 13 | lqm-params | 1.0 | 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 #risk factor short:3.5569036 24 #risk factor long:0.801225765 25 And the following assets are registered: 26 | id | decimal places | 27 | USD | 0 | 28 And the fees configuration named "fees-config-1": 29 | maker fee | infrastructure fee | 30 | 0.0004 | 0.001 | 31 And the price monitoring named "price-monitoring": 32 | horizon | probability | auction extension | 33 | 3600 | 0.99 | 3 | 34 35 And the liquidity sla params named "SLA-22": 36 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 37 | 0.5 | 0.6 | 1 | 1.0 | 38 And the liquidity sla params named "SLA-23": 39 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 40 | 0 | 0.6 | 1 | 1.0 | 41 42 And the markets: 43 | 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 | 44 | 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 | 45 | ETH/MAR23 | USD | USD | lqm-params | log-normal-risk-model | margin-calculator-1 | 2 | fees-config-1 | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA-23 | 46 47 And the following network parameters are set: 48 | name | value | 49 | market.liquidity.bondPenaltyParameter | 0.2 | 50 | validators.epoch.length | 5s | 51 | market.liquidity.stakeToCcyVolume | 1 | 52 | market.liquidity.successorLaunchWindowLength | 1h | 53 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.2 | 54 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.6 | 55 | validators.epoch.length | 10s | 56 | market.liquidity.earlyExitPenalty | 0.25 | 57 58 Given the average block duration is "1" 59 @Now 60 Scenario: 001: lp1 and lp2 on the market ETH/MAR22, 0044-LIME-016 61 Given the parties deposit on asset's general account the following amount: 62 | party | asset | amount | 63 | lp1 | USD | 100000 | 64 | lp2 | USD | 100000 | 65 | party1 | USD | 100000 | 66 | party2 | USD | 100000 | 67 | party3 | USD | 100000 | 68 69 And the parties submit the following liquidity provision: 70 | id | party | market id | commitment amount | fee | lp type | 71 | lp_1 | lp1 | ETH/MAR22 | 4000 | 0.02 | submission | 72 | lp_2 | lp2 | ETH/MAR22 | 4000 | 0.015 | submission | 73 74 When the network moves ahead "4" blocks 75 And the parties place the following pegged iceberg orders: 76 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 77 | lp1 | ETH/MAR22 | 12 | 1 | buy | BID | 12 | 20 | lp-b-1 | 78 | lp1 | ETH/MAR22 | 12 | 1 | sell | ASK | 12 | 20 | lp-s-1 | 79 80 Then the parties place the following orders: 81 | party | market id | side | volume | price | resulting trades | type | tif | 82 | party1 | ETH/MAR22 | buy | 10 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 83 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 84 | party2 | ETH/MAR22 | sell | 10 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 85 | party2 | ETH/MAR22 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 86 87 Then the opening auction period ends for market "ETH/MAR22" 88 And the following trades should be executed: 89 | buyer | price | size | seller | 90 | party1 | 1000 | 1 | party2 | 91 92 And the market data for the market "ETH/MAR22" should be: 93 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 94 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 973 | 1027 | 3556 | 8000 | 1 | 95 # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 1 x 1 x 3.5569036 =3556 96 And the liquidity fee factor should be "0.015" for the market "ETH/MAR22" 97 98 When the network moves ahead "3" blocks 99 Then the parties cancel the following orders: 100 | party | reference | 101 | lp1 | lp-b-1 | 102 | lp1 | lp-s-1 | 103 When the network moves ahead "7" blocks 104 #fraction_of_time_on_book=0.375 105 #0.2 * (1 - 0.375 / 0.6) = 0.075, so bond penalty for lp1 should be 0.075*4000=300; bond penalty for lp2 should be 0.2*4000=2400 106 Then the following transfers should happen: 107 | from | to | from account | to account | market id | amount | asset | 108 | lp1 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 300 | USD | 109 | lp2 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 800 | USD | 110