@nftperp/sdk
Advanced tools
Comparing version 2.0.5 to 2.0.6
{ | ||
"name": "@nftperp/sdk", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "SDK for nftperp protocol", | ||
@@ -5,0 +5,0 @@ "main": "sdk.js", |
@@ -41,4 +41,4 @@ # nftperp sdk ✨ | ||
- `notional` total value of position _margin x leverage_. | ||
- `mark price` nftperp's price of the asset. | ||
- `index price` actual price of the asset. _floor from marketplaces_. | ||
- `mark price` nftperp's price of the amm. | ||
- `index price` actual price of the amm. _floor from marketplaces_. | ||
- `margin ratio` margin to notional ratio. | ||
@@ -84,3 +84,3 @@ - `maintenance margin ratio` minimum margin ratio to be maintained to avoid liquidation. | ||
_note_: _currently limited nft collections are supported. to get a list of supported assets do:_ | ||
_note_: _currently limited nft collections are supported. to get a list of supported amms do:_ | ||
@@ -121,3 +121,3 @@ ```ts | ||
#### Get asset info | ||
#### Get amm info | ||
@@ -129,3 +129,3 @@ ```ts | ||
{ | ||
asset: 'BAYC', | ||
amm: 'BAYC', | ||
markPrice: 82.795, | ||
@@ -132,0 +132,0 @@ indexPrice: 84, |
@@ -305,8 +305,12 @@ "use strict"; | ||
async _getLiquidationPrice(amm, trader) { | ||
const ratios = await this._getRatios(amm); | ||
const position = await this._getPositionWithFundingPayment(amm, trader); | ||
const reserves = await this._getReserves(amm); | ||
const size = (0, mathUtil_1.fromWei)(position.size); | ||
if (size.eq(0)) | ||
return (0, mathUtil_1.toBig)(0); | ||
const mr = (0, mathUtil_1.fromWei)(await this._getMarginRatio(amm, trader)); | ||
const leverage = (0, mathUtil_1.toBig)(1).div(mr); | ||
if (leverage.lt(1.0001)) | ||
return (0, mathUtil_1.toBig)(0); | ||
const ratios = await this._getRatios(amm); | ||
const reserves = await this._getReserves(amm); | ||
const margin = (0, mathUtil_1.fromWei)(position.margin); | ||
@@ -313,0 +317,0 @@ const openNotional = (0, mathUtil_1.fromWei)(position.openNotional); |
@@ -14,3 +14,3 @@ "use strict"; | ||
if (!addr) { | ||
(0, commonUtil_1._throw)(`amm ${amm.toString()} does not exist on instance ${instance}`); | ||
(0, commonUtil_1._throw)(`amm ${amm} does not exist on instance ${instance}`); | ||
} | ||
@@ -17,0 +17,0 @@ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
467159
12761