code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/0044-LIME-091.feature (about) 1 Feature: Test change of SLA market parameter 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 following network parameters are set: 12 | name | value | 13 | market.value.windowLength | 60s | 14 | network.markPriceUpdateMaximumFrequency | 0s | 15 | limits.markets.maxPeggedOrders | 6 | 16 | market.auction.minimumDuration | 1 | 17 | market.fee.factors.infrastructureFee | 0.001 | 18 | market.fee.factors.makerFee | 0.004 | 19 And the liquidity monitoring parameters: 20 | name | triggering ratio | time window | scaling factor | 21 | lqm-params | 1.0 | 20s | 1 | 22 #risk factor short:3.5569036 23 #risk factor long:0.801225765 24 And the following assets are registered: 25 | id | decimal places | 26 | USD | 0 | 27 And the fees configuration named "fees-config-1": 28 | maker fee | infrastructure fee | 29 | 0.0004 | 0.001 | 30 And the price monitoring named "price-monitoring": 31 | horizon | probability | auction extension | 32 | 3600 | 0.99 | 3 | 33 34 And the liquidity sla params named "SLA-22-1": 35 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 36 | 0.9 | 0.6 | 1 | 1.0 | 37 And the liquidity sla params named "SLA-22-2": 38 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 39 | 0.1 | 0.6 | 1 | 1.0 | 40 41 And the liquidity sla params named "SLA-22": 42 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 43 | 0.5 | 0.6 | 1 | 1.0 | 44 And the liquidity sla params named "SLA-23": 45 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 46 | 0 | 0.6 | 1 | 1.0 | 47 48 And the markets: 49 | 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 | 50 | 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 | 51 | 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 | 52 53 And the following network parameters are set: 54 | name | value | 55 | market.liquidity.bondPenaltyParameter | 0.2 | 56 | validators.epoch.length | 5s | 57 | market.liquidity.stakeToCcyVolume | 1 | 58 | market.liquidity.successorLaunchWindowLength | 1h | 59 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.7 | 60 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.6 | 61 | validators.epoch.length | 10s | 62 | market.liquidity.earlyExitPenalty | 0.25 | 63 64 Given the average block duration is "1" 65 @Now 66 Scenario: 001: lp1 and lp2 on the market ETH/MAR22, 0044-LIME-091, 0044-LIME-093, 0044-LIME-029 67 Given the parties deposit on asset's general account the following amount: 68 | party | asset | amount | 69 | lp1 | USD | 200000 | 70 | lp2 | USD | 200000 | 71 | party1 | USD | 100000 | 72 | party2 | USD | 100000 | 73 | party3 | USD | 100000 | 74 | ptbuy | USD | 100000 | 75 | ptsell | USD | 100000 | 76 77 And the parties submit the following liquidity provision: 78 | id | party | market id | commitment amount | fee | lp type | 79 | lp_1 | lp1 | ETH/MAR22 | 4000 | 0.02 | submission | 80 | lp_2 | lp2 | ETH/MAR22 | 4000 | 0.015 | submission | 81 82 When the network moves ahead "11" blocks 83 84 And the parties place the following pegged iceberg orders: 85 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 86 | lp1 | ETH/MAR22 | 1 | 1 | buy | BID | 12 | 200 | lp-b-1 | 87 | lp1 | ETH/MAR22 | 1 | 1 | sell | ASK | 12 | 200 | lp-s-1 | 88 | lp2 | ETH/MAR22 | 1 | 1 | buy | BID | 12 | 200 | lp-b-1 | 89 | lp2 | ETH/MAR22 | 1 | 1 | sell | ASK | 12 | 200 | lp-s-1 | 90 91 Then the parties place the following orders: 92 | party | market id | side | volume | price | resulting trades | type | tif | reference | 93 | party1 | ETH/MAR22 | buy | 10 | 910 | 0 | TYPE_LIMIT | TIF_GTC | best-buy | 94 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | 95 | party2 | ETH/MAR22 | sell | 10 | 1110 | 0 | TYPE_LIMIT | TIF_GTC | best-sell | 96 | party2 | ETH/MAR22 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | 97 98 Then the opening auction period ends for market "ETH/MAR22" 99 And the following trades should be executed: 100 | buyer | price | size | seller | 101 | party1 | 1000 | 1 | party2 | 102 103 And the market data for the market "ETH/MAR22" should be: 104 | mark price | trading mode | target stake | supplied stake | open interest | 105 | 1000 | TRADING_MODE_CONTINUOUS | 3556 | 8000 | 1 | 106 # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 1 x 1 x 3.5569036 =3556 107 And the liquidity fee factor should be "0.015" for the market "ETH/MAR22" 108 109 ##0044-LIME-091: price range in SLA parameter is getting wider, changes from 0.5 to 0.9 110 Then the markets are updated: 111 | id | risk model | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 112 | ETH/MAR22 | log-normal-risk-model | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA-22-1 | 113 Then the network moves ahead "1" epochs 114 And the insurance pool balance should be "0" for the market "ETH/MAR22" 115 116 Then the network moves ahead "1" epochs 117 And the insurance pool balance should be "0" for the market "ETH/MAR22" 118 #0044-LIME-093:price range in SLA parameter is getting narrower, changes from 0.5 to 0.1 119 Then the markets are updated: 120 | id | risk model | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 121 | ETH/MAR22 | log-normal-risk-model | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA-22-2 | 122 Then the network moves ahead "3" epochs 123 124 Then the following transfers should happen: 125 | from | to | from account | to account | market id | amount | asset | 126 | lp1 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 2400 | USD | 127 | lp2 | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 2400 | USD | 128 And the insurance pool balance should be "6720" for the market "ETH/MAR22" 129 130 When the parties place the following orders: 131 | party | market id | side | volume | price | resulting trades | type | tif | 132 | ptbuy | ETH/MAR22 | buy | 2 | 970 | 0 | TYPE_LIMIT | TIF_GTC | 133 | ptsell | ETH/MAR22 | sell | 2 | 970 | 0 | TYPE_LIMIT | TIF_GTC | 134 | ptbuy | ETH/MAR22 | sell | 1 | 990 | 0 | TYPE_LIMIT | TIF_GTC | 135 | ptsell | ETH/MAR22 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 136 Then the market data for the market "ETH/MAR22" should be: 137 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | auction end | 138 | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 10350 | 1280 | 1 | 3 | 139 140 When the parties submit the following liquidity provision: 141 | id | party | market id | commitment amount | fee | lp type | 142 | lp_1 | lp1 | ETH/MAR22 | 4000 | 0.02 | amendment | 143 | lp_2 | lp2 | ETH/MAR22 | 4000 | 0.015 | amendment | 144 145 #0044-LIME-095:during auction the parties place orders within the price range: 0.1 which should count as SLA 146 And the parties place the following orders: 147 | party | market id | side | volume | price | resulting trades | type | tif | 148 | lp1 | ETH/MAR22 | buy | 12 | 998 | 0 | TYPE_LIMIT | TIF_GTC | 149 | lp1 | ETH/MAR22 | sell | 12 | 1002 | 0 | TYPE_LIMIT | TIF_GTC | 150 | lp2 | ETH/MAR22 | buy | 12 | 998 | 0 | TYPE_LIMIT | TIF_GTC | 151 | lp2 | ETH/MAR22 | sell | 12 | 1002 | 0 | TYPE_LIMIT | TIF_GTC | 152 Then the network moves ahead "4" blocks 153 154 #indicative price buy is (990*10+998*24)/34=995; (1010*10+1002*24)/34=1004, 155 #last trade price is 1000, so the price range should be: (0.9*995, 1.1*1004)=(895, 1104) 156 # (1.0-market.liquidity.priceRange) x min(last trade price, indicative uncrossing price) <= price levels <= (1.0+market.liquidity.priceRange) x max(last trade price, indicative uncrossing price). 157 Then the parties should have the following account balances: 158 | party | asset | market id | margin | general | bond | 159 | lp1 | USD | ETH/MAR22 | 127281 | 65327 | 4000 | 160 | lp2 | USD | ETH/MAR22 | 127281 | 65359 | 4000 | 161 When the network moves ahead "11" blocks 162 And the insurance pool balance should be "6780" for the market "ETH/MAR22" 163 164 And the market data for the market "ETH/MAR22" should be: 165 | mark price | trading mode | target stake | supplied stake | open interest | 166 | 994 | TRADING_MODE_CONTINUOUS | 14142 | 8000 | 4 | 167 Then the parties should have the following account balances: 168 | party | asset | market id | margin | general | bond | 169 | lp1 | USD | ETH/MAR22 | 127281 | 65327 | 4000 | 170 | lp2 | USD | ETH/MAR22 | 127281 | 65359 | 4000 | 171 172