code.vegaprotocol.io/vega@v0.79.0/core/integration/features/0084-VDPR-013.feature (about) 1 Feature: A parties volume_discount_factor is set equal to the factors in the highest benefit tier they qualify for (0084-VDPR-013, 0029-FEES-028). 2 3 4 Background: 5 6 Given the margin calculator named "margin-calculator-1": 7 | search factor | initial factor | release factor | 8 | 1.2 | 1.5 | 1.7 | 9 Given the log normal risk model named "log-normal-risk-model": 10 | risk aversion | tau | mu | r | sigma | 11 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 12 13 Given the liquidity monitoring parameters: 14 | name | triggering ratio | time window | scaling factor | 15 | lqm-params | 1.0 | 20s | 1.0 | 16 17 And the following network parameters are set: 18 | name | value | 19 | market.value.windowLength | 60s | 20 | network.markPriceUpdateMaximumFrequency | 0s | 21 | limits.markets.maxPeggedOrders | 6 | 22 | market.auction.minimumDuration | 1 | 23 | market.fee.factors.infrastructureFee | 0.001 | 24 | market.fee.factors.makerFee | 0.004 | 25 26 #risk factor short:3.5569036 27 #risk factor long:0.801225765 28 And the volume discount program tiers named "VDP-01": 29 | volume | infra factor | liquidity factor | maker factor | 30 | 1000 | 0.011 | 0.012 | 0.013 | 31 | 2000 | 0.021 | 0.022 | 0.023 | 32 | 3000 | 0.031 | 0.032 | 0.033 | 33 And the volume discount program: 34 | id | tiers | closing timestamp | window length | 35 | id1 | VDP-01 | 0 | 4 | 36 37 And the following assets are registered: 38 | id | decimal places | 39 | ETH | 0 | 40 And the fees configuration named "fees-config-1": 41 | maker fee | infrastructure fee | 42 | 0.0004 | 0.001 | 43 And the price monitoring named "price-monitoring": 44 | horizon | probability | auction extension | 45 | 3600 | 0.99 | 3 | 46 47 And the liquidity sla params named "SLA-22": 48 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 49 | 0.5 | 0.6 | 1 | 1.0 | 50 51 And the markets: 52 | 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 | 53 | ETH/MAR24 | ETH | ETH | lqm-params | log-normal-risk-model | margin-calculator-1 | 2 | fees-config-1 | price-monitoring | default-eth-for-future | 1e0 | 0 | SLA-22 | 54 55 And the following network parameters are set: 56 | name | value | 57 | market.liquidity.bondPenaltyParameter | 0.2 | 58 | validators.epoch.length | 5s | 59 | market.liquidity.stakeToCcyVolume | 1 | 60 | market.liquidity.successorLaunchWindowLength | 1h | 61 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.7 | 62 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.6 | 63 | validators.epoch.length | 10s | 64 | market.liquidity.earlyExitPenalty | 0.25 | 65 66 Given the average block duration is "1" 67 68 @Now @DebugNoLA 69 Scenario: 001: Check that the volume discount factor is updated after each epoch 70 Given the parties deposit on asset's general account the following amount: 71 | party | asset | amount | 72 | lp1 | ETH | 10000000 | 73 | party1 | ETH | 10000000 | 74 | party2 | ETH | 10000000 | 75 | party3 | ETH | 10000000 | 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/MAR24 | 100000 | 0.02 | submission | 80 81 Then the parties place the following orders: 82 | party | market id | side | volume | price | resulting trades | type | tif | 83 | party1 | ETH/MAR24 | buy | 10 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 84 | party1 | ETH/MAR24 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 85 | lp1 | ETH/MAR24 | buy | 100 | 990 | 0 | TYPE_LIMIT | TIF_GTC | 86 | lp1 | ETH/MAR24 | sell | 100 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | 87 | party2 | ETH/MAR24 | sell | 10 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 88 | party2 | ETH/MAR24 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 89 90 Then the opening auction period ends for market "ETH/MAR24" 91 And the following trades should be executed: 92 | buyer | price | size | seller | 93 | party1 | 1000 | 1 | party2 | 94 And the market data for the market "ETH/MAR24" should be: 95 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 96 | 1000 | TRADING_MODE_CONTINUOUS | 3600 | 973 | 1027 | 3556 | 100000 | 1 | 97 And the party "party3" has the following taker notional "0" 98 And the party "party3" has the following discount infra factor "0" 99 100 Then the parties place the following orders: 101 | party | market id | side | volume | price | resulting trades | type | tif | 102 | party3 | ETH/MAR24 | buy | 1 | 0 | 1 | TYPE_MARKET | TIF_IOC | 103 | party3 | ETH/MAR24 | sell | 1 | 0 | 1 | TYPE_MARKET | TIF_IOC | 104 When the network moves ahead "1" epochs 105 And the party "party3" has the following taker notional "2000" 106 And the party "party3" has the following discount infra factor "0.021" 107 And the party "party3" has the following discount liquidity factor "0.022" 108 And the party "party3" has the following discount maker factor "0.023" 109 110 Then the parties place the following orders: 111 | party | market id | side | volume | price | resulting trades | type | tif | 112 | party3 | ETH/MAR24 | buy | 1 | 0 | 1 | TYPE_MARKET | TIF_IOC | 113 | party3 | ETH/MAR24 | sell | 1 | 0 | 1 | TYPE_MARKET | TIF_IOC | 114 When the network moves ahead "1" epochs 115 And the party "party3" has the following taker notional "4000" 116 And the party "party3" has the following discount infra factor "0.031" 117 And the party "party3" has the following discount liquidity factor "0.032" 118 And the party "party3" has the following discount maker factor "0.033" 119 120 # now that party3 has a discount, lets do a trade with fees 121 # Volume discount rewards are correctly calculated and transferred for each taker fee component during continuous trading. (0029-FEES-027) 122 Then the parties place the following orders: 123 | party | market id | side | volume | price | resulting trades | type | tif | 124 | party3 | ETH/MAR24 | buy | 50 | 1000 | 1 | TYPE_MARKET | TIF_IOC | 125 126 # maker fee discount = floor(202 * 0.033) = 6 127 # infra fee discount - floor(51 *0.031) = 1 128 # lp fee discount - floor(1010 * 0.032) = 32 129 Then the following transfers should happen: 130 | from | to | from account | to account | market id | amount | asset | 131 | party3 | market | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_FEES_MAKER | ETH/MAR24 | 196 | ETH | 132 | party3 | market | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_FEES_LIQUIDITY | ETH/MAR24 | 978 | ETH | 133 | party3 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_FEES_INFRASTRUCTURE | | 50 | ETH | 134 135 Given the parties submit the following liquidity provision: 136 | id | party | market id | commitment amount | fee | lp type | 137 | lp1 | lp1 | ETH/MAR24 | 0 | 0.001 | cancellation | 138 And the network moves ahead "1" epochs 139 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR24" 140 141 And the party "party3" has the following discount infra factor "0.031" 142 And the party "party3" has the following discount liquidity factor "0.032" 143 And the party "party3" has the following discount maker factor "0.033" 144 145 Given the parties place the following orders: 146 | party | market id | side | volume | price | resulting trades | type | tif | 147 | party1 | ETH/MAR24 | buy | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 148 | party3 | ETH/MAR24 | sell | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 149 150 And the parties submit the following liquidity provision: 151 | id | party | market id | commitment amount | fee | lp type | 152 | lp1 | lp1 | ETH/MAR24 | 1000000 | 0.02 | submission | 153 When the network moves ahead "1" epochs 154 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR24" 155 156 Then the following transfers should happen: 157 | from | to | from account | to account | market id | amount | asset | 158 | party3 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_FEES_INFRASTRUCTURE | | 97 | ETH |