diff --git a/vega_sim/scenario/common/agents.py b/vega_sim/scenario/common/agents.py index 7e1a5f660..61f561ed9 100644 --- a/vega_sim/scenario/common/agents.py +++ b/vega_sim/scenario/common/agents.py @@ -3305,6 +3305,7 @@ def __init__( metric: Optional[str] = None, market_names: Optional[str] = None, entity_scope: Optional[vega_protos.EntityScope.Value] = None, + distribution_strategy: Optional[vega_protos.DistributionStrategy.Value] = None, wallet_name: Optional[str] = None, stake_key: bool = False, tag: Optional[str] = None, @@ -3319,6 +3320,7 @@ def __init__( self.market_names = market_names self.entity_scope = entity_scope self.stake_key = stake_key + self.distribution_strategy = distribution_strategy def initialise( self, @@ -3394,12 +3396,37 @@ def initialise( else None ), metric=self.metric, + notional_time_weighted_average_position_requirement=( + 1 + if self.metric + not in [ + vega_protos.DISPATCH_METRIC_MARKET_VALUE, + vega_protos.DISPATCH_METRIC_VALIDATOR_RANKING, + ] + else None + ), window_length=2, transfer_interval=2, entity_scope=self.entity_scope, n_top_performers=( 0.5 if self.entity_scope == vega_protos.ENTITY_SCOPE_TEAMS else None ), + distribution_strategy=self.distribution_strategy, + rank_table=( + [ + vega_protos.Rank(start_rank=1, share_ratio=50), + vega_protos.Rank(start_rank=2, share_ratio=30), + vega_protos.Rank(start_rank=3, share_ratio=10), + vega_protos.Rank(start_rank=4, share_ratio=1), + vega_protos.Rank(start_rank=11, share_ratio=0), + ] + if self.distribution_strategy + in [ + vega_protos.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK, + vega_protos.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK_LOTTERY, + ] + else None + ), ) diff --git a/vega_sim/scenario/fuzzed_markets/fuzzers.py b/vega_sim/scenario/fuzzed_markets/fuzzers.py index fa57fbef2..861202203 100644 --- a/vega_sim/scenario/fuzzed_markets/fuzzers.py +++ b/vega_sim/scenario/fuzzed_markets/fuzzers.py @@ -136,7 +136,7 @@ def _pick_rank_table(): ) ) if valid(rs, bias): - if distribution_strategy != vega_protos.vega.DISTRIBUTION_STRATEGY_RANK: + if distribution_strategy == vega_protos.vega.DISTRIBUTION_STRATEGY_PRO_RATA: return None return val return None if rs.rand() < 0.5 else val @@ -262,9 +262,9 @@ def _pick_to_account_type(): return vega_protos.vega.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES if ( recurring.dispatch_strategy.metric - == vega_protos.vega.DISPATCH_METRIC_AVERAGE_POSITION + == vega_protos.vega.DISPATCH_METRIC_AVERAGE_NOTIONAL ): - return vega_protos.vega.ACCOUNT_TYPE_REWARD_AVERAGE_POSITION + return vega_protos.vega.ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL if ( recurring.dispatch_strategy.metric == vega_protos.vega.DISPATCH_METRIC_RELATIVE_RETURN @@ -462,9 +462,9 @@ def _pick_destination_type(): return vega_protos.vega.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES if ( recurring.dispatch_strategy.metric - == vega_protos.vega.DISPATCH_METRIC_AVERAGE_POSITION + == vega_protos.vega.ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL ): - return vega_protos.vega.ACCOUNT_TYPE_REWARD_AVERAGE_POSITION + return vega_protos.vega.DISPATCH_METRIC_AVERAGE_NOTIONAL if ( recurring.dispatch_strategy.metric == vega_protos.vega.DISPATCH_METRIC_RELATIVE_RETURN diff --git a/vega_sim/scenario/fuzzing/scenario.py b/vega_sim/scenario/fuzzing/scenario.py index 63ee34f47..18b145723 100644 --- a/vega_sim/scenario/fuzzing/scenario.py +++ b/vega_sim/scenario/fuzzing/scenario.py @@ -198,43 +198,57 @@ def configure_agents( asset_names.add( benchmark_config.market_config.instrument.perpetual.quote_name ) - for i_agent, (account_type, metric) in enumerate( + for i_agent, (account_type, metric, distribution_strategy) in enumerate( [ ( protos.vega.vega.ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES, protos.vega.vega.DISPATCH_METRIC_MAKER_FEES_PAID, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES, protos.vega.vega.DISPATCH_METRIC_MAKER_FEES_RECEIVED, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES, protos.vega.vega.DISPATCH_METRIC_LP_FEES_RECEIVED, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS, protos.vega.vega.DISPATCH_METRIC_MARKET_VALUE, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL, protos.vega.vega.DISPATCH_METRIC_AVERAGE_NOTIONAL, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_RELATIVE_RETURN, protos.vega.vega.DISPATCH_METRIC_RELATIVE_RETURN, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY, protos.vega.vega.DISPATCH_METRIC_RETURN_VOLATILITY, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_VALIDATOR_RANKING, protos.vega.vega.DISPATCH_METRIC_VALIDATOR_RANKING, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK, ), ( protos.vega.vega.ACCOUNT_TYPE_REWARD_REALISED_RETURN, protos.vega.vega.DISPATCH_METRIC_REALISED_RETURN, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK, + ), + ( + protos.vega.vega.ACCOUNT_TYPE_REWARD_ELIGIBLE_ENTITIES, + protos.vega.vega.DISPATCH_METRIC_ELIGIBLE_ENTITIES, + protos.vega.vega.DistributionStrategy.DISTRIBUTION_STRATEGY_RANK_LOTTERY, ), ] ): @@ -251,6 +265,7 @@ def configure_agents( market_names=[market_name], initial_mint=1e9, entity_scope=entity_scope, + distribution_strategy=distribution_strategy, tag=(f"{entity_scope}_{asset_for_metric_name}_{metric}"), ) for asset_for_metric_name, entity_scope in itertools.product(