code.vegaprotocol.io/vega@v0.79.0/core/integration/features/activity-streak/0086-ASPR-evaluating_activity.feature (about) 1 Feature: Evaluating trader activity 2 3 Background: 4 5 # Initialise the network 6 Given time is updated to "2023-01-01T00:00:00Z" 7 And the average block duration is "1" 8 And the following network parameters are set: 9 | name | value | 10 | network.markPriceUpdateMaximumFrequency | 0s | 11 | market.auction.minimumDuration | 1 | 12 | validators.epoch.length | 20s | 13 | limits.markets.maxPeggedOrders | 4 | 14 15 And the following network parameters are set: 16 | name | value | 17 | rewards.activityStreak.inactivityLimit | 1 | 18 | rewards.activityStreak.minQuantumOpenVolume | 1 | 19 | rewards.activityStreak.minQuantumTradeVolume | 1 | 20 | rewards.activityStreak.benefitTiers | {"tiers": [{"minimum_activity_streak": 1, "reward_multiplier": "2", "vesting_multiplier": "2"}]} | 21 22 # Initialise the markets 23 And the following assets are registered: 24 | id | decimal places | quantum | 25 | USD.0.1 | 0 | 1 | 26 | USD.1.10 | 1 | 10 | 27 And the markets: 28 | 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 | 29 | ETH/USD.0.1 | ETH | USD.0.1 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | 30 | ETH/USD.1.10 | ETH | USD.1.10 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 1e-3 | 0 | default-futures | 1 | 1 | 31 And the liquidity monitoring parameters: 32 | name | triggering ratio | time window | scaling factor | 33 | lqm-params | 1.0 | 3600s | 1 | 34 When the markets are updated: 35 | id | liquidity monitoring | linear slippage factor | quadratic slippage factor | 36 | ETH/USD.0.1 | lqm-params | 1e-3 | 0 | 37 | ETH/USD.1.10 | lqm-params | 1e-3 | 0 | 38 Then the network moves ahead "1" blocks 39 40 # Initialise the parties 41 Given the parties deposit on asset's general account the following amount: 42 | party | asset | amount | 43 | lpprov | USD.1.10 | 10000000000 | 44 | aux1 | USD.1.10 | 10000000 | 45 | aux2 | USD.1.10 | 10000000 | 46 | trader1 | USD.1.10 | 10000000 | 47 | lpprov | USD.0.1 | 10000000000 | 48 | aux1 | USD.0.1 | 10000000 | 49 | aux2 | USD.0.1 | 10000000 | 50 | trader1 | USD.0.1 | 10000000 | 51 52 # Exit opening auctions 53 Given the parties submit the following liquidity provision: 54 | id | party | market id | commitment amount | fee | lp type | 55 | lp1 | lpprov | ETH/USD.0.1 | 1000000 | 0.01 | submission | 56 | lp2 | lpprov | ETH/USD.1.10 | 10000000 | 0.01 | submission | 57 And the parties place the following pegged iceberg orders: 58 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 59 | lpprov | ETH/USD.0.1 | 5000 | 1000 | buy | BID | 10000 | 1 | 60 | lpprov | ETH/USD.0.1 | 5000 | 1000 | sell | ASK | 10000 | 1 | 61 | lpprov | ETH/USD.1.10 | 50000 | 10000 | buy | BID | 100000 | 10 | 62 | lpprov | ETH/USD.1.10 | 50000 | 10000 | sell | ASK | 100000 | 10 | 63 When the parties place the following orders: 64 | party | market id | side | volume | price | resulting trades | type | tif | 65 | aux1 | ETH/USD.0.1 | buy | 1 | 990 | 0 | TYPE_LIMIT | TIF_GTC | 66 | aux1 | ETH/USD.0.1 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 67 | aux2 | ETH/USD.0.1 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 68 | aux2 | ETH/USD.0.1 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 69 | aux1 | ETH/USD.1.10 | buy | 1 | 9900 | 0 | TYPE_LIMIT | TIF_GTC | 70 | aux1 | ETH/USD.1.10 | buy | 1 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 71 | aux2 | ETH/USD.1.10 | sell | 1 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 72 | aux2 | ETH/USD.1.10 | sell | 1 | 11000 | 0 | TYPE_LIMIT | TIF_GTC | 73 And the opening auction period ends for market "ETH/USD.0.1" 74 And the opening auction period ends for market "ETH/USD.1.10" 75 And the network moves ahead "1" blocks 76 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD.0.1" 77 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD.1.10" 78 79 80 Scenario Outline: Party trades during continuous trading (0086-ASPR-004)(0086-ASPR-006) 81 # Expectation: traders activity streak should be incremented if they fulfill the trade volume requirement 82 83 # Test Cases: 84 # - single trade (as taker) in continuous trading does not fulfill the trade volume requirement 85 # - single trade (as maker) in continuous trading does not fulfill the trade volume requirement 86 # - single trade (as taker) in continuous trading does fulfill the trade volume requirement 87 # - single trade (as maker) in continuous trading does fulfill the trade volume requirement 88 89 # Test cares about trade volume so set open volume requirement high 90 Given the following network parameters are set: 91 | name | value | 92 | rewards.activityStreak.minQuantumTradeVolume | 10000 | 93 | rewards.activityStreak.minQuantumOpenVolume | 1000000000000000 | 94 95 When the parties place the following orders: 96 | party | market id | side | volume | price | resulting trades | type | tif | 97 | <maker> | ETH/USD.0.1 | buy | <size> | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 98 | <taker> | ETH/USD.0.1 | sell | <size> | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 99 Then the network moves ahead "1" epochs 100 Given the activity streaks at epoch "1" should be: 101 | party | active for | inactive for | reward multiplier | vesting multiplier | 102 | trader1 | <active for> | <inactive for> | <multipliers> | <multipliers> | 103 104 Examples: 105 | maker | taker | size | active for | inactive for | multipliers | 106 | aux1 | trader1 | 1 | 0 | 1 | 1 | 107 | trader1 | aux1 | 1 | 0 | 1 | 1 | 108 | aux1 | trader1 | 11 | 1 | 0 | 2 | 109 | trader1 | aux1 | 11 | 1 | 0 | 2 | 110 111 112 Scenario Outline: Party trades when exiting an auction (0086-ASPR-004)(0086-ASPR-006) 113 # Expectation: traders activity streak should be incremented if they fulfill the trade volume requirement 114 115 # Test Cases: 116 # - single trade (as taker) on auction exit does not fulfill the trade volume requirement 117 # - single trade (as maker) on auction exit does not fulfill the trade volume requirement 118 # - single trade (as taker) on auction exit does fulfill the trade volume requirement 119 # - single trade (as maker) on auction exit does fulfill the trade volume requirement 120 121 # Test cares about trade volume so set open volume requirement high 122 Given the following network parameters are set: 123 | name | value | 124 | rewards.activityStreak.minQuantumTradeVolume | 10000 | 125 | rewards.activityStreak.minQuantumOpenVolume | 1000000000000000 | 126 127 Given the parties submit the following liquidity provision: 128 | id | party | market id | commitment amount | fee | lp type | 129 | lp1 | lpprov | ETH/USD.0.1 | 0 | 0.001 | cancellation | 130 And the network moves ahead "1" epochs 131 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD.0.1" 132 133 Given the parties place the following orders: 134 | party | market id | side | volume | price | resulting trades | type | tif | 135 | aux1 | ETH/USD.0.1 | buy | <size> | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 136 | trader1 | ETH/USD.0.1 | sell | <size> | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 137 And the parties submit the following liquidity provision: 138 | id | party | market id | commitment amount | fee | lp type | 139 | lp2 | lpprov | ETH/USD.0.1 | 1000000 | 0.001 | submission | 140 When the network moves ahead "1" epochs 141 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD.0.1" 142 And the activity streaks at epoch "2" should be: 143 | party | active for | inactive for | reward multiplier | vesting multiplier | 144 | trader1 | <active for> | <inactive for> | <multipliers> | <multipliers> | 145 146 Examples: 147 | maker | taker | size | active for | inactive for | multipliers | 148 | aux1 | trader1 | 1 | 0 | 1 | 1 | 149 | trader1 | aux1 | 1 | 0 | 1 | 1 | 150 | aux1 | trader1 | 11 | 1 | 0 | 2 | 151 | trader1 | aux1 | 11 | 1 | 0 | 2 | 152 153 154 Scenario Outline: Party opens position in market (0086-ASPR-005)(0086-ASPR-006) 155 # Expectation: traders activity streak should be incremented if they fulfill the open volume requirement 156 157 # Test Cases: 158 # - long position does not meet the open volume requirement 159 # - short position does not meet the open volume requirement 160 # - long position does meet the open volume requirement and position open for a single epoch 161 # - short position does meet the open volume requirement and position open for a single epoch 162 # - long position does meet the open volume requirement and position open across multiple epochs 163 # - short position does meet the open volume requirement and position open across multiple epochs 164 165 # Test cares about open volume so set trade volume requirement high 166 Given the following network parameters are set: 167 | name | value | 168 | rewards.activityStreak.minQuantumTradeVolume | 1000000000000000 | 169 | rewards.activityStreak.minQuantumOpenVolume | 10000 | 170 171 Given the current epoch is "1" 172 And the parties place the following orders: 173 | party | market id | side | volume | price | resulting trades | type | tif | 174 | aux1 | ETH/USD.0.1 | <counterparty side> | <size> | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 175 | trader1 | ETH/USD.0.1 | <trader side> | <size> | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 176 When the network moves ahead <epochs> epochs 177 Then the activity streaks at epoch <epochs> should be: 178 | party | active for | inactive for | reward multiplier | vesting multiplier | 179 | trader1 | <active for> | <inactive for> | <multipliers> | <multipliers> | 180 181 Examples: 182 | trader side | counterparty side | epochs | size | active for | inactive for | multipliers | 183 | buy | sell | "1" | 1 | 0 | 1 | 1 | 184 | sell | buy | "1" | 1 | 0 | 1 | 1 | 185 | buy | sell | "1" | 11 | 1 | 0 | 2 | 186 | sell | buy | "1" | 11 | 1 | 0 | 2 | 187 | buy | sell | "2" | 11 | 2 | 0 | 2 | 188 | sell | buy | "2" | 11 | 2 | 0 | 2 | 189 190 191 Scenario Outline: Party splits trading between two markets using different settlement assets (0086-ASPR-004)(0086-ASPR-005) 192 # Expectation: parties activity streak should be incremented if they fulfill the trade volume or open volume requirements 193 194 # Test Cases: 195 # - party meets the open volume requirement but not the trade volume requirement 196 # - party meets the trade volume requirement but not the open volume requirement 197 # - party meets both the trade volume requirement and the open volume requirement 198 199 Given the following network parameters are set: 200 | name | value | 201 | rewards.activityStreak.minQuantumOpenVolume | <min open volume> | 202 | rewards.activityStreak.minQuantumTradeVolume | <min trade volume> | 203 Then the network moves ahead "1" blocks 204 And the parties place the following orders: 205 | party | market id | side | volume | price | resulting trades | type | tif | 206 | aux1 | ETH/USD.0.1 | buy | 6 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 207 | trader1 | ETH/USD.0.1 | sell | 6 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 208 | aux1 | ETH/USD.1.10 | buy | 60 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 209 | trader1 | ETH/USD.1.10 | sell | 60 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 210 When the network moves ahead "1" epochs 211 Then the activity streaks at epoch "1" should be: 212 | party | active for | inactive for | reward multiplier | vesting multiplier | 213 | trader1 | 1 | 0 | 2 | 2 | 214 215 Examples: 216 | min open volume | min trade volume | 217 | 10000 | 1000000000000000 | 218 | 1000000000000000 | 10000 | 219 | 10000 | 10000 | 220 221 222 Scenario Outline: Party builds an activity streak and is then inactive for n epochs (0086-ASPR-007) 223 # Expectation: parties activity streak should be reset if their inactivity streak is greater or equal than the network parameter 224 225 # Test Cases: 226 # - inactivity streak limit does not allow inactivity, as soon as party is inactive their streak is reset 227 # - inactivity streak allows inactivity, party is inactive for less than the inactivity limit 228 # - inactivity streak allows inactivity, party is inactive for the inactivity limit 229 230 Given the following network parameters are set: 231 | name | value | 232 | rewards.activityStreak.inactivityLimit | <param> | 233 234 # Open a position to be considered active then close it 235 Given the parties place the following orders: 236 | party | market id | side | volume | price | resulting trades | type | tif | 237 | aux1 | ETH/USD.0.1 | buy | 11 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 238 | trader1 | ETH/USD.0.1 | sell | 11 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 239 And the parties place the following orders: 240 | party | market id | side | volume | price | resulting trades | type | tif | 241 | aux1 | ETH/USD.0.1 | sell | 11 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 242 | trader1 | ETH/USD.0.1 | buy | 11 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 243 Given the network moves ahead <forward to epoch> epochs 244 Then the activity streaks at epoch <forward to epoch> should be: 245 | party | active for | inactive for | reward multiplier | vesting multiplier | 246 | trader1 | <active for> | <inactive for> | <multipliers> | <multipliers> | 247 248 Examples: 249 | param | forward to epoch | active for | inactive for | multipliers | 250 | 1 | "2" | 0 | 1 | 1 | 251 | 5 | "5" | 1 | 4 | 2 | 252 | 5 | "6" | 0 | 5 | 1 |