Skip to content

Commit

Permalink
feat: ensure all metrics and distribution strategies covered
Browse files Browse the repository at this point in the history
  • Loading branch information
cdummett committed Aug 13, 2024
1 parent d57ef98 commit 05406b7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
27 changes: 27 additions & 0 deletions vega_sim/scenario/common/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
),
)


Expand Down
17 changes: 16 additions & 1 deletion vega_sim/scenario/fuzzing/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,43 +188,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,
),
]
):
Expand All @@ -241,6 +255,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(
Expand Down

0 comments on commit 05406b7

Please sign in to comment.