Skip to content

Commit

Permalink
feat: implement disposalSlippageRange into vega-market-sim (#661)
Browse files Browse the repository at this point in the history
* feat: update vega ad4121e

* fix: missing arg in update market
  • Loading branch information
cdummett authored Apr 19, 2024
1 parent 8c04763 commit ee8e18b
Show file tree
Hide file tree
Showing 32 changed files with 702 additions and 585 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=1d53ad7f2b6b6bb8215b8994c9f5f91418599a8b
VEGA_SIM_VEGA_TAG=ad4121e3704035e1229629de972fda628c82b5d4
VEGA_SIM_CONSOLE_TAG=develop
VEGA_DEFAULT_KEY_NAME='Key 1'
VEGA_SIM_NETWORKS_INTERNAL_TAG=main
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pipeline {
disableConcurrentBuilds(abortPrevious: true)
}
parameters {
string( name: 'VEGA_VERSION', defaultValue: '1d53ad7f2b6b6bb8215b8994c9f5f91418599a8b',
string( name: 'VEGA_VERSION', defaultValue: 'ad4121e3704035e1229629de972fda628c82b5d4',
description: 'Git branch, tag or hash of the vegaprotocol/vega repository')
string( name: 'VEGACAPSULE_VERSION', defaultValue: 'main',
description: 'Git branch, tag or hash of the vegaprotocol/vegacapsule repository')
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ traitlets==5.14.2 ; python_version >= "3.9" and python_version < "3.12"
typing-extensions==4.10.0 ; python_version >= "3.9" and python_version < "3.11"
tzdata==2024.1 ; python_version >= "3.9" and python_version < "3.12"
urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.12"
vegapy @ git+https://github.com/cdummett/vegapy/@fab6f82ad9e19f529d73f640bba65b2ad31f8ac8 ; python_version >= "3.9" and python_version < "3.12"
vegapy @ git+https://github.com/cdummett/vegapy/@dbfc21c0a6102cebd770d2d34b6a6fe5e4767f3c ; python_version >= "3.9" and python_version < "3.12"
wcwidth==0.2.13 ; python_version >= "3.9" and python_version < "3.12"
websocket==0.2.1 ; python_version >= "3.9" and python_version < "3.12"
websockets==12.0 ; python_version >= "3.9" and python_version < "3.12"
Expand Down
2 changes: 1 addition & 1 deletion requirements-learning.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ triton==2.2.0 ; platform_system == "Linux" and platform_machine == "x86_64" and
typing-extensions==4.10.0 ; python_version >= "3.9" and python_version < "3.12"
tzdata==2024.1 ; python_version >= "3.9" and python_version < "3.12"
urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.12"
vegapy @ git+https://github.com/cdummett/vegapy/@fab6f82ad9e19f529d73f640bba65b2ad31f8ac8 ; python_version >= "3.9" and python_version < "3.12"
vegapy @ git+https://github.com/cdummett/vegapy/@dbfc21c0a6102cebd770d2d34b6a6fe5e4767f3c ; python_version >= "3.9" and python_version < "3.12"
wcwidth==0.2.13 ; python_version >= "3.9" and python_version < "3.12"
websocket==0.2.1 ; python_version >= "3.9" and python_version < "3.12"
websockets==12.0 ; python_version >= "3.9" and python_version < "3.12"
Expand Down
1 change: 1 addition & 0 deletions vega_sim/api/governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def __propose_market(
disposal_fraction="1",
full_disposal_size=1000000000,
max_fraction_consumed="0.5",
disposal_slippage_range="0.5",
),
mark_price_configuration=vega_protos.markets.CompositePriceConfiguration(
composite_price_type=vega_protos.markets.COMPOSITE_PRICE_TYPE_LAST_TRADE,
Expand Down
3 changes: 3 additions & 0 deletions vega_sim/api/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ class LiquidationStrategy(Config):
"disposal_fraction": 0.1,
"full_disposal_size": 0,
"max_fraction_consumed": 0.1,
"disposal_slippage_range": 0.5,
}
}

Expand All @@ -643,13 +644,15 @@ def load(self, opt: Optional[str] = None):
self.disposal_fraction = config["disposal_fraction"]
self.full_disposal_size = config["full_disposal_size"]
self.max_fraction_consumed = config["max_fraction_consumed"]
self.disposal_slippage_range = config["disposal_slippage_range"]

def build(self):
return build.markets.liquidation_strategy(
disposal_time_step=self.disposal_time_step,
disposal_fraction=self.disposal_fraction,
full_disposal_size=self.full_disposal_size,
max_fraction_consumed=self.max_fraction_consumed,
disposal_slippage_range=self.disposal_slippage_range,
)


Expand Down
2 changes: 2 additions & 0 deletions vega_sim/builders/markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,14 @@ def liquidation_strategy(
disposal_fraction: float,
full_disposal_size: float,
max_fraction_consumed: float,
disposal_slippage_range: float,
) -> vega_protos.markets.LiquidationStrategy:
return vega_protos.markets.LiquidationStrategy(
disposal_time_step=int(disposal_time_step),
disposal_fraction=str(disposal_fraction),
full_disposal_size=num_to_padded_int(full_disposal_size, 1),
max_fraction_consumed=str(max_fraction_consumed),
disposal_slippage_range=str(disposal_slippage_range),
)


Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/mainnet/BTCUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/mainnet/EGLPUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@
"disposalFraction": "0.1",
"fullDisposalSize": "10000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"compositePriceType": "COMPOSITE_PRICE_TYPE_LAST_TRADE",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/mainnet/ETHUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/mainnet/INJUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/mainnet/LDOUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/mainnet/SNXUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/mainnet/SOLUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/research/ESHRUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
"disposalFraction": "0.1",
"fullDisposalSize": "10000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.2",
},
"liquidityFeeSettings": {"method": "METHOD_MARGINAL_COST"},
"liquidityMonitoringParameters": {
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/research/HLPUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
"disposalFraction": "0.1",
"fullDisposalSize": "10000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.2",
},
"liquidityFeeSettings": {"method": "METHOD_MARGINAL_COST"},
"liquidityMonitoringParameters": {
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/research/future/BTCUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"compositePriceType": "COMPOSITE_PRICE_TYPE_LAST_TRADE",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/research/future/ETHUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"compositePriceType": "COMPOSITE_PRICE_TYPE_LAST_TRADE",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/research/perpetual/BTCUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
1 change: 1 addition & 0 deletions vega_sim/configs/research/perpetual/ETHUSDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"disposalFraction": "1",
"fullDisposalSize": "1000000",
"maxFractionConsumed": "0.1",
"disposalSlippageRange": "0.03",
},
"markPriceConfiguration": {
"decayWeight": "1",
Expand Down
Loading

0 comments on commit ee8e18b

Please sign in to comment.