@orderly.network/perp 4.8.9 → 4.8.10-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ declare global {
8
8
  };
9
9
  }
10
10
  }
11
- declare const _default: "4.8.9";
11
+ declare const _default: "4.8.10-alpha.0";
12
12
 
13
13
  /**
14
14
  * Calculates the notional value of a single position.
@@ -52,19 +52,18 @@ declare function unrealizedPnLROI(inputs: UnrealPnLROIInputs): number;
52
52
  * @returns The total unrealized profit or loss of all positions.
53
53
  */
54
54
  declare function totalUnrealizedPnL(positions: API.Position[]): number;
55
- type LiqPriceInputs = {
55
+ declare const liqPrice: (inputs: {
56
56
  markPrice: number;
57
+ symbol: string;
57
58
  totalCollateral: number;
58
59
  positionQty: number;
59
- positions: Pick<API.PositionExt, "position_qty" | "mark_price" | "mmr">[];
60
+ positions: Pick<API.PositionExt, "position_qty" | "mark_price" | "mmr" | "symbol">[];
60
61
  MMR: number;
61
- };
62
- /**
63
- * Calculates the liquidation price of a single position.
64
- * @param inputs The inputs for calculating the liquidation price.
65
- * @returns The liquidation price of the position.
66
- */
67
- declare function liqPrice(inputs: LiqPriceInputs): number | null;
62
+ baseMMR: number;
63
+ baseIMR: number;
64
+ IMRFactor: number;
65
+ costPosition: number;
66
+ }) => number | null;
68
67
  type MMInputs = {
69
68
  positionQty: number;
70
69
  markPrice: number;
@@ -127,6 +126,8 @@ declare function estPnLForTP(inputs: {
127
126
  }): number;
128
127
  /**
129
128
  * Calculates the estimated price for take profit.
129
+ * This is the inverse of estPnLForTP: given PnL, calculates the price.
130
+ * Formula: price = PnL / positionQty + entryPrice
130
131
  */
131
132
  declare function estPriceForTP(inputs: {
132
133
  positionQty: number;
@@ -171,7 +172,6 @@ declare function maxPositionLeverage(inputs: {
171
172
  notional: number;
172
173
  }): number;
173
174
 
174
- type positions_LiqPriceInputs = LiqPriceInputs;
175
175
  type positions_MMInputs = MMInputs;
176
176
  type positions_MMRInputs = MMRInputs;
177
177
  type positions_TotalUnsettlementPnLInputs = TotalUnsettlementPnLInputs;
@@ -195,7 +195,7 @@ declare const positions_unrealizedPnL: typeof unrealizedPnL;
195
195
  declare const positions_unrealizedPnLROI: typeof unrealizedPnLROI;
196
196
  declare const positions_unsettlementPnL: typeof unsettlementPnL;
197
197
  declare namespace positions {
198
- export { type positions_LiqPriceInputs as LiqPriceInputs, type positions_MMInputs as MMInputs, MMR$1 as MMR, type positions_MMRInputs as MMRInputs, type positions_TotalUnsettlementPnLInputs as TotalUnsettlementPnLInputs, type positions_UnrealPnLInputs as UnrealPnLInputs, type positions_UnrealPnLROIInputs as UnrealPnLROIInputs, type positions_UnsettlementPnLInputs as UnsettlementPnLInputs, positions_estOffsetForTP as estOffsetForTP, positions_estPnLForSL as estPnLForSL, positions_estPnLForTP as estPnLForTP, positions_estPriceForTP as estPriceForTP, positions_estPriceFromOffsetForTP as estPriceFromOffsetForTP, positions_liqPrice as liqPrice, positions_maintenanceMargin as maintenanceMargin, positions_maxPositionLeverage as maxPositionLeverage, positions_maxPositionNotional as maxPositionNotional, positions_notional as notional, positions_totalNotional as totalNotional, positions_totalUnrealizedPnL as totalUnrealizedPnL, positions_totalUnsettlementPnL as totalUnsettlementPnL, positions_unrealizedPnL as unrealizedPnL, positions_unrealizedPnLROI as unrealizedPnLROI, positions_unsettlementPnL as unsettlementPnL };
198
+ export { type positions_MMInputs as MMInputs, MMR$1 as MMR, type positions_MMRInputs as MMRInputs, type positions_TotalUnsettlementPnLInputs as TotalUnsettlementPnLInputs, type positions_UnrealPnLInputs as UnrealPnLInputs, type positions_UnrealPnLROIInputs as UnrealPnLROIInputs, type positions_UnsettlementPnLInputs as UnsettlementPnLInputs, positions_estOffsetForTP as estOffsetForTP, positions_estPnLForSL as estPnLForSL, positions_estPnLForTP as estPnLForTP, positions_estPriceForTP as estPriceForTP, positions_estPriceFromOffsetForTP as estPriceFromOffsetForTP, positions_liqPrice as liqPrice, positions_maintenanceMargin as maintenanceMargin, positions_maxPositionLeverage as maxPositionLeverage, positions_maxPositionNotional as maxPositionNotional, positions_notional as notional, positions_totalNotional as totalNotional, positions_totalUnrealizedPnL as totalUnrealizedPnL, positions_totalUnsettlementPnL as totalUnsettlementPnL, positions_unrealizedPnL as unrealizedPnL, positions_unrealizedPnLROI as unrealizedPnLROI, positions_unsettlementPnL as unsettlementPnL };
199
199
  }
200
200
 
201
201
  type ResultOptions = {
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ declare global {
8
8
  };
9
9
  }
10
10
  }
11
- declare const _default: "4.8.9";
11
+ declare const _default: "4.8.10-alpha.0";
12
12
 
13
13
  /**
14
14
  * Calculates the notional value of a single position.
@@ -52,19 +52,18 @@ declare function unrealizedPnLROI(inputs: UnrealPnLROIInputs): number;
52
52
  * @returns The total unrealized profit or loss of all positions.
53
53
  */
54
54
  declare function totalUnrealizedPnL(positions: API.Position[]): number;
55
- type LiqPriceInputs = {
55
+ declare const liqPrice: (inputs: {
56
56
  markPrice: number;
57
+ symbol: string;
57
58
  totalCollateral: number;
58
59
  positionQty: number;
59
- positions: Pick<API.PositionExt, "position_qty" | "mark_price" | "mmr">[];
60
+ positions: Pick<API.PositionExt, "position_qty" | "mark_price" | "mmr" | "symbol">[];
60
61
  MMR: number;
61
- };
62
- /**
63
- * Calculates the liquidation price of a single position.
64
- * @param inputs The inputs for calculating the liquidation price.
65
- * @returns The liquidation price of the position.
66
- */
67
- declare function liqPrice(inputs: LiqPriceInputs): number | null;
62
+ baseMMR: number;
63
+ baseIMR: number;
64
+ IMRFactor: number;
65
+ costPosition: number;
66
+ }) => number | null;
68
67
  type MMInputs = {
69
68
  positionQty: number;
70
69
  markPrice: number;
@@ -127,6 +126,8 @@ declare function estPnLForTP(inputs: {
127
126
  }): number;
128
127
  /**
129
128
  * Calculates the estimated price for take profit.
129
+ * This is the inverse of estPnLForTP: given PnL, calculates the price.
130
+ * Formula: price = PnL / positionQty + entryPrice
130
131
  */
131
132
  declare function estPriceForTP(inputs: {
132
133
  positionQty: number;
@@ -171,7 +172,6 @@ declare function maxPositionLeverage(inputs: {
171
172
  notional: number;
172
173
  }): number;
173
174
 
174
- type positions_LiqPriceInputs = LiqPriceInputs;
175
175
  type positions_MMInputs = MMInputs;
176
176
  type positions_MMRInputs = MMRInputs;
177
177
  type positions_TotalUnsettlementPnLInputs = TotalUnsettlementPnLInputs;
@@ -195,7 +195,7 @@ declare const positions_unrealizedPnL: typeof unrealizedPnL;
195
195
  declare const positions_unrealizedPnLROI: typeof unrealizedPnLROI;
196
196
  declare const positions_unsettlementPnL: typeof unsettlementPnL;
197
197
  declare namespace positions {
198
- export { type positions_LiqPriceInputs as LiqPriceInputs, type positions_MMInputs as MMInputs, MMR$1 as MMR, type positions_MMRInputs as MMRInputs, type positions_TotalUnsettlementPnLInputs as TotalUnsettlementPnLInputs, type positions_UnrealPnLInputs as UnrealPnLInputs, type positions_UnrealPnLROIInputs as UnrealPnLROIInputs, type positions_UnsettlementPnLInputs as UnsettlementPnLInputs, positions_estOffsetForTP as estOffsetForTP, positions_estPnLForSL as estPnLForSL, positions_estPnLForTP as estPnLForTP, positions_estPriceForTP as estPriceForTP, positions_estPriceFromOffsetForTP as estPriceFromOffsetForTP, positions_liqPrice as liqPrice, positions_maintenanceMargin as maintenanceMargin, positions_maxPositionLeverage as maxPositionLeverage, positions_maxPositionNotional as maxPositionNotional, positions_notional as notional, positions_totalNotional as totalNotional, positions_totalUnrealizedPnL as totalUnrealizedPnL, positions_totalUnsettlementPnL as totalUnsettlementPnL, positions_unrealizedPnL as unrealizedPnL, positions_unrealizedPnLROI as unrealizedPnLROI, positions_unsettlementPnL as unsettlementPnL };
198
+ export { type positions_MMInputs as MMInputs, MMR$1 as MMR, type positions_MMRInputs as MMRInputs, type positions_TotalUnsettlementPnLInputs as TotalUnsettlementPnLInputs, type positions_UnrealPnLInputs as UnrealPnLInputs, type positions_UnrealPnLROIInputs as UnrealPnLROIInputs, type positions_UnsettlementPnLInputs as UnsettlementPnLInputs, positions_estOffsetForTP as estOffsetForTP, positions_estPnLForSL as estPnLForSL, positions_estPnLForTP as estPnLForTP, positions_estPriceForTP as estPriceForTP, positions_estPriceFromOffsetForTP as estPriceFromOffsetForTP, positions_liqPrice as liqPrice, positions_maintenanceMargin as maintenanceMargin, positions_maxPositionLeverage as maxPositionLeverage, positions_maxPositionNotional as maxPositionNotional, positions_notional as notional, positions_totalNotional as totalNotional, positions_totalUnrealizedPnL as totalUnrealizedPnL, positions_totalUnsettlementPnL as totalUnsettlementPnL, positions_unrealizedPnL as unrealizedPnL, positions_unrealizedPnLROI as unrealizedPnLROI, positions_unsettlementPnL as unsettlementPnL };
199
199
  }
200
200
 
201
201
  type ResultOptions = {