Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
cdummett committed Oct 18, 2024
1 parent f1b3d67 commit c4d0cd1
Show file tree
Hide file tree
Showing 9 changed files with 576 additions and 509 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VEGA_SIM_VEGA_TAG=260cc2e885acfbca297fd2c7cefd6a8abc0fd788
VEGA_SIM_VEGA_TAG=base-price-oracle
VEGA_SIM_CONSOLE_TAG=develop
VEGA_DEFAULT_KEY_NAME='Key 1'
VEGA_SIM_NETWORKS_INTERNAL_TAG=main
Expand Down
28 changes: 14 additions & 14 deletions vega_protos/protos/vega/commands/v1/commands_pb2.py

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions vega_protos/protos/vega/commands/v1/commands_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ class SubmitAMM(_message.Message):
"slippage_tolerance",
"concentrated_liquidity_parameters",
"proposed_fee",
"minimum_price_change_trigger",
)

class ConcentratedLiquidityParameters(_message.Message):
Expand All @@ -623,36 +624,42 @@ class SubmitAMM(_message.Message):
"base",
"leverage_at_upper_bound",
"leverage_at_lower_bound",
"data_source_id",
)
UPPER_BOUND_FIELD_NUMBER: _ClassVar[int]
LOWER_BOUND_FIELD_NUMBER: _ClassVar[int]
BASE_FIELD_NUMBER: _ClassVar[int]
LEVERAGE_AT_UPPER_BOUND_FIELD_NUMBER: _ClassVar[int]
LEVERAGE_AT_LOWER_BOUND_FIELD_NUMBER: _ClassVar[int]
DATA_SOURCE_ID_FIELD_NUMBER: _ClassVar[int]
upper_bound: str
lower_bound: str
base: str
leverage_at_upper_bound: str
leverage_at_lower_bound: str
data_source_id: str
def __init__(
self,
upper_bound: _Optional[str] = ...,
lower_bound: _Optional[str] = ...,
base: _Optional[str] = ...,
leverage_at_upper_bound: _Optional[str] = ...,
leverage_at_lower_bound: _Optional[str] = ...,
data_source_id: _Optional[str] = ...,
) -> None: ...

MARKET_ID_FIELD_NUMBER: _ClassVar[int]
COMMITMENT_AMOUNT_FIELD_NUMBER: _ClassVar[int]
SLIPPAGE_TOLERANCE_FIELD_NUMBER: _ClassVar[int]
CONCENTRATED_LIQUIDITY_PARAMETERS_FIELD_NUMBER: _ClassVar[int]
PROPOSED_FEE_FIELD_NUMBER: _ClassVar[int]
MINIMUM_PRICE_CHANGE_TRIGGER_FIELD_NUMBER: _ClassVar[int]
market_id: str
commitment_amount: str
slippage_tolerance: str
concentrated_liquidity_parameters: SubmitAMM.ConcentratedLiquidityParameters
proposed_fee: str
minimum_price_change_trigger: str
def __init__(
self,
market_id: _Optional[str] = ...,
Expand All @@ -662,6 +669,7 @@ class SubmitAMM(_message.Message):
_Union[SubmitAMM.ConcentratedLiquidityParameters, _Mapping]
] = ...,
proposed_fee: _Optional[str] = ...,
minimum_price_change_trigger: _Optional[str] = ...,
) -> None: ...

class AmendAMM(_message.Message):
Expand All @@ -671,6 +679,7 @@ class AmendAMM(_message.Message):
"slippage_tolerance",
"concentrated_liquidity_parameters",
"proposed_fee",
"minimum_price_change_trigger",
)

class ConcentratedLiquidityParameters(_message.Message):
Expand All @@ -680,36 +689,42 @@ class AmendAMM(_message.Message):
"base",
"leverage_at_upper_bound",
"leverage_at_lower_bound",
"data_source_id",
)
UPPER_BOUND_FIELD_NUMBER: _ClassVar[int]
LOWER_BOUND_FIELD_NUMBER: _ClassVar[int]
BASE_FIELD_NUMBER: _ClassVar[int]
LEVERAGE_AT_UPPER_BOUND_FIELD_NUMBER: _ClassVar[int]
LEVERAGE_AT_LOWER_BOUND_FIELD_NUMBER: _ClassVar[int]
DATA_SOURCE_ID_FIELD_NUMBER: _ClassVar[int]
upper_bound: str
lower_bound: str
base: str
leverage_at_upper_bound: str
leverage_at_lower_bound: str
data_source_id: str
def __init__(
self,
upper_bound: _Optional[str] = ...,
lower_bound: _Optional[str] = ...,
base: _Optional[str] = ...,
leverage_at_upper_bound: _Optional[str] = ...,
leverage_at_lower_bound: _Optional[str] = ...,
data_source_id: _Optional[str] = ...,
) -> None: ...

MARKET_ID_FIELD_NUMBER: _ClassVar[int]
COMMITMENT_AMOUNT_FIELD_NUMBER: _ClassVar[int]
SLIPPAGE_TOLERANCE_FIELD_NUMBER: _ClassVar[int]
CONCENTRATED_LIQUIDITY_PARAMETERS_FIELD_NUMBER: _ClassVar[int]
PROPOSED_FEE_FIELD_NUMBER: _ClassVar[int]
MINIMUM_PRICE_CHANGE_TRIGGER_FIELD_NUMBER: _ClassVar[int]
market_id: str
commitment_amount: str
slippage_tolerance: str
concentrated_liquidity_parameters: AmendAMM.ConcentratedLiquidityParameters
proposed_fee: str
minimum_price_change_trigger: str
def __init__(
self,
market_id: _Optional[str] = ...,
Expand All @@ -719,6 +734,7 @@ class AmendAMM(_message.Message):
_Union[AmendAMM.ConcentratedLiquidityParameters, _Mapping]
] = ...,
proposed_fee: _Optional[str] = ...,
minimum_price_change_trigger: _Optional[str] = ...,
) -> None: ...

class CancelAMM(_message.Message):
Expand Down
452 changes: 226 additions & 226 deletions vega_protos/protos/vega/events/v1/events_pb2.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions vega_protos/protos/vega/events/v1/events_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class AMM(_message.Message):
"proposed_fee",
"lower_curve",
"upper_curve",
"minimum_price_change_trigger",
)

class Status(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
Expand All @@ -285,13 +286,15 @@ class AMM(_message.Message):
STATUS_CANCELLED: _ClassVar[AMM.Status]
STATUS_STOPPED: _ClassVar[AMM.Status]
STATUS_REDUCE_ONLY: _ClassVar[AMM.Status]
STATUS_PENDING: _ClassVar[AMM.Status]

STATUS_UNSPECIFIED: AMM.Status
STATUS_ACTIVE: AMM.Status
STATUS_REJECTED: AMM.Status
STATUS_CANCELLED: AMM.Status
STATUS_STOPPED: AMM.Status
STATUS_REDUCE_ONLY: AMM.Status
STATUS_PENDING: AMM.Status

class StatusReason(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
__slots__ = ()
Expand Down Expand Up @@ -320,24 +323,28 @@ class AMM(_message.Message):
"upper_bound",
"leverage_at_upper_bound",
"leverage_at_lower_bound",
"data_source_id",
)
BASE_FIELD_NUMBER: _ClassVar[int]
LOWER_BOUND_FIELD_NUMBER: _ClassVar[int]
UPPER_BOUND_FIELD_NUMBER: _ClassVar[int]
LEVERAGE_AT_UPPER_BOUND_FIELD_NUMBER: _ClassVar[int]
LEVERAGE_AT_LOWER_BOUND_FIELD_NUMBER: _ClassVar[int]
DATA_SOURCE_ID_FIELD_NUMBER: _ClassVar[int]
base: str
lower_bound: str
upper_bound: str
leverage_at_upper_bound: str
leverage_at_lower_bound: str
data_source_id: str
def __init__(
self,
base: _Optional[str] = ...,
lower_bound: _Optional[str] = ...,
upper_bound: _Optional[str] = ...,
leverage_at_upper_bound: _Optional[str] = ...,
leverage_at_lower_bound: _Optional[str] = ...,
data_source_id: _Optional[str] = ...,
) -> None: ...

class Curve(_message.Message):
Expand All @@ -363,6 +370,7 @@ class AMM(_message.Message):
PROPOSED_FEE_FIELD_NUMBER: _ClassVar[int]
LOWER_CURVE_FIELD_NUMBER: _ClassVar[int]
UPPER_CURVE_FIELD_NUMBER: _ClassVar[int]
MINIMUM_PRICE_CHANGE_TRIGGER_FIELD_NUMBER: _ClassVar[int]
id: str
party_id: str
market_id: str
Expand All @@ -374,6 +382,7 @@ class AMM(_message.Message):
proposed_fee: str
lower_curve: AMM.Curve
upper_curve: AMM.Curve
minimum_price_change_trigger: str
def __init__(
self,
id: _Optional[str] = ...,
Expand All @@ -389,6 +398,7 @@ class AMM(_message.Message):
proposed_fee: _Optional[str] = ...,
lower_curve: _Optional[_Union[AMM.Curve, _Mapping]] = ...,
upper_curve: _Optional[_Union[AMM.Curve, _Mapping]] = ...,
minimum_price_change_trigger: _Optional[str] = ...,
) -> None: ...

class VestingBalancesSummary(_message.Message):
Expand Down
534 changes: 267 additions & 267 deletions vega_protos/protos/vega/snapshot/v1/snapshot_pb2.py

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions vega_protos/protos/vega/snapshot/v1/snapshot_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,8 @@ class PoolMapEntry(_message.Message):
"upper",
"status",
"proposed_fee",
"slippage_tolerance",
"minimum_price_change_trigger",
)
ID_FIELD_NUMBER: _ClassVar[int]
AMM_PARTY_ID_FIELD_NUMBER: _ClassVar[int]
Expand All @@ -1756,6 +1758,8 @@ class PoolMapEntry(_message.Message):
UPPER_FIELD_NUMBER: _ClassVar[int]
STATUS_FIELD_NUMBER: _ClassVar[int]
PROPOSED_FEE_FIELD_NUMBER: _ClassVar[int]
SLIPPAGE_TOLERANCE_FIELD_NUMBER: _ClassVar[int]
MINIMUM_PRICE_CHANGE_TRIGGER_FIELD_NUMBER: _ClassVar[int]
id: str
amm_party_id: str
commitment: str
Expand All @@ -1766,6 +1770,8 @@ class PoolMapEntry(_message.Message):
upper: PoolMapEntry.Curve
status: _events_pb2.AMM.Status
proposed_fee: str
slippage_tolerance: str
minimum_price_change_trigger: str
def __init__(
self,
id: _Optional[str] = ...,
Expand All @@ -1780,6 +1786,8 @@ class PoolMapEntry(_message.Message):
upper: _Optional[_Union[PoolMapEntry.Curve, _Mapping]] = ...,
status: _Optional[_Union[_events_pb2.AMM.Status, str]] = ...,
proposed_fee: _Optional[str] = ...,
slippage_tolerance: _Optional[str] = ...,
minimum_price_change_trigger: _Optional[str] = ...,
) -> None: ...

PARTY_FIELD_NUMBER: _ClassVar[int]
Expand Down
8 changes: 8 additions & 0 deletions vega_sim/builders/commands/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ def submit_amm(
upper_bound: Optional[float] = None,
leverage_at_lower_bound: Optional[float] = None,
leverage_at_upper_bound: Optional[float] = None,
data_source_id: Optional[str] = None,
minimum_price_change_trigger: Optional[float] = None,
) -> vega_protos.commands.v1.commands.SubmitAMM:
# Note ConcentratedLiquidityParameters does not have a stand alone
# function as message is nested specifically with SubmitAmm.
Expand Down Expand Up @@ -296,8 +298,14 @@ def submit_amm(
if leverage_at_upper_bound is not None
else None
),
data_source_id=data_source_id,
),
proposed_fee=str(proposed_fee),
minimum_price_change_trigger=(
str(minimum_price_change_trigger)
if minimum_price_change_trigger is not None
else None
),
)


Expand Down
27 changes: 26 additions & 1 deletion vega_sim/scenario/fuzzed_markets/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -1949,12 +1949,32 @@ def initialise(
key_name=self.key_name,
)
self.vega.wait_for_total_catchup()
# Data oracle id
market = vega.market_info(self.market_id)
self.data_source_id = None
if market.tradable_instrument.instrument.future != vega_protos.markets.Future():
# We have a future market so we need an oracle component
# in the mark price configuration otherwise none exists.
self.data_source_id = None
if market.tradable_instrument.instrument.perpetual != vega_protos.markets.Perpetual():
# We have a perpetual market so we are guaranteed an oracle
# component in the market index price configuration.
self.data_source_id = (
market.tradable_instrument.instrument.perpetual.data_source_spec_for_settlement_data.id
)

def step(self, vega_state) -> None:
if self.random_state.rand() < self.submit_probability:
transaction = fuzzers.fuzz_submit_amm(
vega=self.vega, rs=self.random_state, bias=0.8
vega=self.vega,
rs=self.random_state,
bias=0.8,
)
if self.data_source_id is not None:
transaction.concentrated_liquidity_parameters.data_source_id = (
self.data_source_id
)
transaction.minimum_price_change_trigger = str(0.001)
self.vega.submit_transaction(
key_name=self.key_name,
transaction=transaction,
Expand All @@ -1965,6 +1985,11 @@ def step(self, vega_state) -> None:
transaction = fuzzers.fuzz_amend_amm(
vega=self.vega, rs=self.random_state, bias=0.8
)
if self.data_source_id is not None:
transaction.concentrated_liquidity_parameters.data_source_id = (
self.data_source_id
)
transaction.minimum_price_change_trigger = str(0.001)
self.vega.submit_transaction(
key_name=self.key_name,
transaction=transaction,
Expand Down

0 comments on commit c4d0cd1

Please sign in to comment.