code.vegaprotocol.io/vega@v0.79.0/core/integration/features/fees/0029-FEES-high_volume_maker.feature (about) 1 Feature: high volume maker fee rebate 2 3 Background: 4 5 # Initialise timings 6 Given time is updated to "2023-01-01T00:00:00Z" 7 And the average block duration is "1" 8 And the margin calculator named "margin-calculator-1": 9 | search factor | initial factor | release factor | 10 | 1.2 | 1.5 | 1.7 | 11 And the log normal risk model named "log-normal-risk-model": 12 | risk aversion | tau | mu | r | sigma | 13 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 14 And the price monitoring named "price-monitoring": 15 | horizon | probability | auction extension | 16 | 3600 | 0.99 | 15 | 17 18 # Initialise the markets and network parameters 19 Given the following network parameters are set: 20 | name | value | 21 | market.fee.factors.infrastructureFee | 0.01 | 22 | market.fee.factors.makerFee | 0.01 | 23 | market.fee.factors.buybackFee | 0.001 | 24 | market.fee.factors.treasuryFee | 0.002 | 25 | market.auction.minimumDuration | 1 | 26 | limits.markets.maxPeggedOrders | 4 | 27 | referralProgram.minStakedVegaTokens | 0 | 28 | referralProgram.maxPartyNotionalVolumeByQuantumPerEpoch | 1000000000 | 29 | referralProgram.maxReferralRewardProportion | 0.1 | 30 | validators.epoch.length | 10s | 31 32 And the volume rebate program tiers named "vrt": 33 | fraction | rebate | 34 | 0.2 | 0.001 | 35 | 0.3 | 0.002 | 36 37 And the volume rebate program: 38 | id | tiers | closing timestamp | window length | 39 | id1 | vrt | 0 | 2 | 40 41 And the network moves ahead "1" epochs 42 43 # Initialse the assets and markets 44 And the following assets are registered: 45 | id | decimal places | quantum | 46 | USD | 1 | 1 | 47 And the markets: 48 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | position decimal places | 49 | ETH/USD | ETH | USD | log-normal-risk-model | margin-calculator-1 | 1 | default-none | price-monitoring | default-eth-for-future | 1e-3 | 0 | default-futures | 1 | 1 | 50 And the liquidity monitoring parameters: 51 | name | triggering ratio | time window | scaling factor | 52 | lqm-params | 1.0 | 3600s | 1 | 53 When the markets are updated: 54 | id | liquidity monitoring | linear slippage factor | quadratic slippage factor | 55 | ETH/USD | lqm-params | 1e-3 | 0 | 56 57 # Initialise the parties 58 Given the parties deposit on asset's general account the following amount: 59 | party | asset | amount | 60 | lpprov | USD | 1000000000 | 61 | lpprov2 | USD | 1000000000 | 62 | aux1 | USD | 1000000000 | 63 | aux2 | USD | 1000000000 | 64 | trader1 | USD | 1000000000 | 65 | trader2 | USD | 1000000000 | 66 | trader3 | USD | 1000000000 | 67 68 # Exit the opening auction 69 Given the parties submit the following liquidity provision: 70 | id | party | market id | commitment amount | fee | lp type | 71 | lp1 | lpprov | ETH/USD | 1000000 | 0.01 | submission | 72 73 And the parties place the following pegged iceberg orders: 74 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 75 | lpprov | ETH/USD | 5000 | 1000 | buy | BID | 10000 | 1 | 76 | lpprov | ETH/USD | 5000 | 1000 | sell | ASK | 10000 | 1 | 77 78 When the parties place the following orders: 79 | party | market id | side | volume | price | resulting trades | type | tif | 80 | aux1 | ETH/USD | buy | 1 | 990 | 0 | TYPE_LIMIT | TIF_GTC | 81 | aux1 | ETH/USD | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 82 | aux2 | ETH/USD | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 83 | aux2 | ETH/USD | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 84 85 Then the opening auction period ends for market "ETH/USD" 86 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD" 87 88 Scenario: When there is `high_volume_market_maker_rebate`, `high_volume_maker_fee` should be taken from the `treasury/buyback_fee` components with value `high_volume_maker_fee = high_volume_factor * trade_value_for_fee_purposes` (0029-FEES-042, 0029-FEES-043, 0029-FEES-044, 0029-FEES-047) 89 90 Given the parties place the following orders: 91 | party | market id | side | volume | price | resulting trades | type | tif | 92 | trader1 | ETH/USD | sell | 210 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 93 | trader2 | ETH/USD | sell | 310 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 94 | trader3 | ETH/USD | sell | 480 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 95 | aux1 | ETH/USD | buy | 1000 | 1000 | 3 | TYPE_LIMIT | TIF_GTC | 96 97 And the network moves ahead "1" epochs 98 Given the parties place the following orders: 99 | party | market id | side | volume | price | resulting trades | type | tif | 100 | trader1 | ETH/USD | sell | 210 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 101 | trader2 | ETH/USD | sell | 310 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 102 | trader3 | ETH/USD | sell | 480 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 103 | aux1 | ETH/USD | buy | 1000 | 1000 | 3 | TYPE_LIMIT | TIF_GTC | 104 105 And the network moves ahead "1" epochs 106 Given the parties place the following orders: 107 | party | market id | side | volume | price | resulting trades | type | tif | 108 | trader1 | ETH/USD | sell | 210 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 109 | trader2 | ETH/USD | sell | 310 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 110 | trader3 | ETH/USD | sell | 480 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 111 | aux1 | ETH/USD | buy | 1000 | 1000 | 3 | TYPE_LIMIT | TIF_GTC | 112 113 Then the following trades should be executed: 114 | buyer | price | size | seller | 115 | aux1 | 1000 | 210 | trader1 | 116 | aux1 | 1000 | 310 | trader2 | 117 | aux1 | 1000 | 480 | trader3 | 118 119 And the network moves ahead "1" epochs 120 121 # trade_value_for_fee_purposes for trade between aux1 and trader1 = size_of_trade * price_of_trade = 21 * 100 = 2100 122 # treasury_fee = 0.002*2100=4.2 123 # buyback_fee = 0.001*2100=2.1 124 # treasury_fee = treasury_fee *(1 - high_volume_maker_fee / (treasury_fee + buyback_fee)) = 4.2*(1-2.1/(4.2+2.1))=2.8 125 # buyback_fee = buyback_fee*(1 - high_volume_maker_fee / (treasury_fee + buyback_fee)) =2.1*(1-2.1/(4.2+2.1))=1.4 126 127 # trade_value_for_fee_purposes for trade between aux1 and trader2 = size_of_trade * price_of_trade = 31 * 100 = 3100 128 # treasury_fee = 0.002*3100=6.2 129 # buyback_fee = 0.001*3100=3.1 130 # treasury_fee = treasury_fee *(1 - high_volume_maker_fee / (treasury_fee + buyback_fee)) = 6.2*(1-6.2/(6.2+3.1))=2.07 131 # buyback_fee = buyback_fee*(1 - high_volume_maker_fee / (treasury_fee + buyback_fee)) =3.1*(1-6.2/(6.2+3.1))=1.03 132 133 134 # trade_value_for_fee_purposes for trade between aux1 and trader3 = size_of_trade * price_of_trade = 48 * 100 = 4800 135 # treasury_fee = 0.002*4800=9.6 136 # buyback_fee = 0.001*4800=4.8 137 # treasury_fee = treasury_fee *(1 - high_volume_maker_fee / (treasury_fee + buyback_fee)) = 9.6*(1-9.6/(9.6+4.8))=3.2 138 # buyback_fee = buyback_fee*(1 - high_volume_maker_fee / (treasury_fee + buyback_fee)) =4.8*(1-9.6/(9.6+4.8))=1.6 139 140 # trade_value_for_fee_purposes for trader1 = size_of_trade * price_of_trade = 21 * 100 = 2100 141 # maker_fee = fee_factor[maker] * trade_value_for_fee_purposes = 0.01 * 2100 = 21 142 # high_marker_fee_rebate_receive=0.001 * 2100=2.1 143 144 # trade_value_for_fee_purposes for trader2 = size_of_trade * price_of_trade = 31 * 100 = 3100 145 # maker_fee = fee_factor[maker] * trade_value_for_fee_purposes = 0.01 * 3100 = 31 146 # high_marker_fee_rebate_receive=0.002 * 3100=6.2 147 148 # trade_value_for_fee_purposes for trader3 = size_of_trade * price_of_trade = 48 * 100 = 4800 149 # maker_fee = fee_factor[maker] * trade_value_for_fee_purposes = 0.01 * 4800 = 48 150 # high_marker_fee_rebate_receive=0.002 * 4800=9.6 151 152 And the following transfers should happen: 153 | from | to | from account | to account | market id | amount | asset | 154 | aux1 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_NETWORK_TREASURY | | 28 | USD | 155 | aux1 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_NETWORK_TREASURY | | 20 | USD | 156 | aux1 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_NETWORK_TREASURY | | 31 | USD | 157 | aux1 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_BUY_BACK_FEES | | 14 | USD | 158 | aux1 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_BUY_BACK_FEES | | 10 | USD | 159 | aux1 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_BUY_BACK_FEES | | 15 | USD | 160 | market | trader1 | ACCOUNT_TYPE_FEES_MAKER | ACCOUNT_TYPE_GENERAL | ETH/USD | 210 | USD | 161 | market | trader1 | ACCOUNT_TYPE_FEES_MAKER | ACCOUNT_TYPE_GENERAL | ETH/USD | 21 | USD | 162 | market | trader2 | ACCOUNT_TYPE_FEES_MAKER | ACCOUNT_TYPE_GENERAL | ETH/USD | 310 | USD | 163 | market | trader2 | ACCOUNT_TYPE_FEES_MAKER | ACCOUNT_TYPE_GENERAL | ETH/USD | 62 | USD | 164 | market | trader3 | ACCOUNT_TYPE_FEES_MAKER | ACCOUNT_TYPE_GENERAL | ETH/USD | 480 | USD | 165 | market | trader3 | ACCOUNT_TYPE_FEES_MAKER | ACCOUNT_TYPE_GENERAL | ETH/USD | 96 | USD | 166 167 168 169