code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/liquidity_provision/0044-LIME-048.feature (about) 1 Feature: Spot market SLA 2 3 Scenario: 001 0044-LIME-048, check SLA when fraction_of_time_on_book < market.liquidity.commitmentMinTimeFraction 4 5 Given time is updated to "2023-07-20T00:00:00Z" 6 7 Given the fees configuration named "fees-config-1": 8 | maker fee | infrastructure fee | 9 | 0 | 0 | 10 Given the log normal risk model named "lognormal-risk-model-1": 11 | risk aversion | tau | mu | r | sigma | 12 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 13 14 And the price monitoring named "price-monitoring-1": 15 | horizon | probability | auction extension | 16 | 360000 | 0.999 | 300 | 17 18 And the liquidity sla params named "SLA-1": 19 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 20 | 1 | 0.6 | 2 | 0.2 | 21 22 Given the following assets are registered: 23 | id | decimal places | 24 | ETH | 1 | 25 | BTC | 1 | 26 27 And the following network parameters are set: 28 | name | value | 29 | network.markPriceUpdateMaximumFrequency | 2s | 30 | market.liquidity.earlyExitPenalty | 0.25 | 31 | market.liquidity.bondPenaltyParameter | 0.2 | 32 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.7 | 33 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.6 | 34 | market.liquidity.maximumLiquidityFeeFactorLevel | 0.4 | 35 | validators.epoch.length | 10s | 36 37 And the spot markets: 38 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 39 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | SLA-1 | 40 And the following network parameters are set: 41 | name | value | 42 | market.liquidity.providersFeeCalculationTimeStep | 1s | 43 | market.liquidity.stakeToCcyVolume | 1 | 44 45 Given the parties deposit on asset's general account the following amount: 46 | party | asset | amount | 47 | party1 | ETH | 10000 | 48 | party2 | BTC | 500 | 49 | lp1 | ETH | 40000 | 50 | lp1 | BTC | 2000 | 51 | lp2 | ETH | 4000 | 52 | lp2 | BTC | 60 | 53 54 And the average block duration is "1" 55 56 Given the liquidity monitoring parameters: 57 | name | triggering ratio | time window | scaling factor | 58 | updated-lqm-params | 0.2 | 20s | 0.8 | 59 60 When the spot markets are updated: 61 | id | liquidity monitoring | linear slippage factor | quadratic slippage factor | 62 | BTC/ETH | updated-lqm-params | 0.5 | 0.5 | 63 64 When the parties submit the following liquidity provision: 65 | id | party | market id | commitment amount | fee | lp type | 66 | lp1 | lp1 | BTC/ETH | 3000 | 0.1 | submission | 67 68 Then the network moves ahead "4" blocks 69 And the network treasury balance should be "0" for the asset "ETH" 70 And the global insurance pool balance should be "0" for the asset "ETH" 71 And the global insurance pool balance should be "0" for the asset "BTC" 72 And the party "lp1" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 73 Then the party "lp1" lp liquidity bond account balance should be "3000" for the market "BTC/ETH" 74 75 # place orders and generate trades 76 And the parties place the following orders: 77 | party | market id | side | volume | price | resulting trades | type | tif | reference | 78 | lp1 | BTC/ETH | buy | 600 | 5 | 0 | TYPE_LIMIT | TIF_GTC | lp1-b | 79 | party1 | BTC/ETH | buy | 6 | 8 | 0 | TYPE_LIMIT | TIF_GTC | party-order5 | 80 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order3 | 81 | party2 | BTC/ETH | sell | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order4 | 82 | party2 | BTC/ETH | sell | 6 | 24 | 0 | TYPE_LIMIT | TIF_GTC | party-order6 | 83 | lp1 | BTC/ETH | sell | 120 | 25 | 0 | TYPE_LIMIT | TIF_GTC | lp1-s | 84 85 Then the network moves ahead "1" blocks 86 87 Then the following trades should be executed: 88 | buyer | price | size | seller | 89 | party1 | 15 | 1 | party2 | 90 91 Then "lp1" should have holding account balance of "30000" for asset "ETH" 92 Then "lp1" should have general account balance of "7000" for asset "ETH" 93 Then the party "lp1" lp liquidity bond account balance should be "3000" for the market "BTC/ETH" 94 Then "lp1" should have holding account balance of "1200" for asset "BTC" 95 Then "lp1" should have general account balance of "800" for asset "BTC" 96 97 When the network moves ahead "2" blocks 98 Then the parties cancel the following orders: 99 | party | reference | 100 | lp1 | lp1-b | 101 | lp1 | lp1-s | 102 103 #0011-MARA-020 cancelling an order releases the holding amount back to user's general account. 104 Then "lp1" should have holding account balance of "0" for asset "ETH" 105 Then "lp1" should have general account balance of "37000" for asset "ETH" 106 Then "lp1" should have holding account balance of "0" for asset "BTC" 107 Then "lp1" should have general account balance of "2000" for asset "BTC" 108 109 Then the market data for the market "BTC/ETH" should be: 110 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 111 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 2400 | 3000 | 0 | 112 113 Then the network moves ahead "7" blocks 114 And the network treasury balance should be "1322" for the asset "ETH" 115 #fraction_of_time_on_book=2/9 = 0.222 116 #0.7 * (1 - 0.222 / 0.6)*3000 = 1322 117 Then the party "lp1" lp liquidity bond account balance should be "1678" for the market "BTC/ETH" 118 119 120 121