Calculates an accurate liquidation price for synthetix Perps V2 Positions
mkdir liquidation
cd liquidation
git clone [email protected]:Synthetixio/perp_liquidation_compute.git liquidation
- create folder config under project director
- create file conf.yaml that includes the below information
---
nodes:
mainnet: 'https://opt-mainnet.g.alchemy.com/v2/XXXXXXXXXXX'
goerli: 'https://opt-goerli.g.alchemy.com/v2/XXXXXXXXXXX'
etherscan:
mainnet: 'https://api-optimistic.etherscan.io/api?module=contract&action=getabi&address={}&apikey=XXXXXXXXXXX'
goerli: 'https://api-goerli-optimism.etherscan.io/api?module=contract&action=getabi&address={}&apikey=XXXXXXXXXXX'
resolver:
mainnet: '0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C'
goerli: '0x1d551351613a28d676BaC1Af157799e201279198'
pyth:
mainnet: 'https://xc-mainnet.pyth.network/api/latest_price_feeds?ids[]={}'
goerli: 'https://xc-testnet.pyth.network/api/latest_price_feeds?ids[]={}'
python3.8 -m venv myvenv
source myvenv/bin/activate
pip install env/requirements.txt
python main.py -h
$python main.py -a 0x21d099fE94FF5075654e36d7CaF0FeFADaFe7446 -t eth -s 1 -n mainnet
Args to be used:
a
being the address of the user or smart contractt
being the tickers
the size, 1.5 means 1.5 eth for example, sets
to zero for no position changesn
can bemainnet
orgoerli
{'liquidationPrice': 2010.5158171917135, 'safePrice': 2010.3147656099943}
safePrice
: Price at which an account is safe from liquidationliquidationPrice
: Price at which an account has already been liquidated
For usage, use safePrice
in the UI and note that highly leveraged positions that exceed maxLeverage, the displayed price is an estimate as the account is very near liquidation thresholds.