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