@gainsnetwork/sdk 1.3.0-rc3 → 1.3.0-rc4

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.
@@ -90,7 +90,7 @@ export declare const getSpreadP: (pairSpreadP: number | undefined, isLiquidation
90
90
  * @param context Additional context for the calculation
91
91
  * @returns Total spread + cumulative volume price impact percentage
92
92
  */
93
- export declare const getSpreadWithCumulVolPriceImpactP: (pairSpreadP: number, buy: boolean, collateral: number, leverage: number, oiWindowsSettings?: OiWindowsSettings | undefined, oiWindows?: OiWindows | undefined, context?: CumulVolContext | undefined) => number;
93
+ export declare const getSpreadWithCumulVolPriceImpactP: (pairSpreadP: number, buy: boolean, collateral: number, leverage: number, context: CumulVolContext) => number;
94
94
  /**
95
95
  * @dev Convenience function for calculating cumulative volume price impact
96
96
  * @dev Uses collateral and leverage instead of USD position size
@@ -104,6 +104,6 @@ export declare const getSpreadWithCumulVolPriceImpactP: (pairSpreadP: number, bu
104
104
  export declare const getCumulVolPriceImpact: (buy: boolean, collateral: number, leverage: number, open: boolean, context: CumulVolContext & {
105
105
  collateralPriceUsd: number;
106
106
  }) => number;
107
- export declare const getSpreadWithPriceImpactP: (pairSpreadP: number, buy: boolean, collateral: number, leverage: number, oiWindowsSettings?: OiWindowsSettings | undefined, oiWindows?: OiWindows | undefined, context?: CumulVolContext | undefined) => number;
107
+ export declare const getSpreadWithPriceImpactP: (pairSpreadP: number, buy: boolean, collateral: number, leverage: number, context: CumulVolContext) => number;
108
108
  export { convertOiWindowsSettings, convertOiWindow, convertOiWindows, convertOiWindowsSettingsArray, } from "./converter";
109
109
  export { buildCumulVolContext } from "./builder";
@@ -268,7 +268,7 @@ exports.getSpreadP = getSpreadP;
268
268
  * @param context Additional context for the calculation
269
269
  * @returns Total spread + cumulative volume price impact percentage
270
270
  */
271
- const getSpreadWithCumulVolPriceImpactP = (pairSpreadP, buy, collateral, leverage, oiWindowsSettings, oiWindows, context) => {
271
+ const getSpreadWithCumulVolPriceImpactP = (pairSpreadP, buy, collateral, leverage, context) => {
272
272
  if (pairSpreadP === undefined) {
273
273
  return 0;
274
274
  }
@@ -277,12 +277,7 @@ const getSpreadWithCumulVolPriceImpactP = (pairSpreadP, buy, collateral, leverag
277
277
  const positionSizeUsd = collateral * leverage * ((context === null || context === void 0 ? void 0 : context.collateralPriceUsd) || 1);
278
278
  const cumulVolImpact = (0, exports.getTradeCumulVolPriceImpactP)("", // trader - not used in calculation
279
279
  0, // pairIndex - not used in calculation
280
- buy, positionSizeUsd, (context === null || context === void 0 ? void 0 : context.isPnlPositive) || false, (context === null || context === void 0 ? void 0 : context.isOpen) !== false, (context === null || context === void 0 ? void 0 : context.createdBlock) || 0, Object.assign(Object.assign({}, context), { oiWindowsSettings,
281
- oiWindows }));
282
- // If no cumulative volume impact calculated, return half of base spread
283
- if (cumulVolImpact === 0 && !oiWindowsSettings) {
284
- return pairSpreadP / 2;
285
- }
280
+ buy, positionSizeUsd, (context === null || context === void 0 ? void 0 : context.isPnlPositive) || false, (context === null || context === void 0 ? void 0 : context.isOpen) !== false, (context === null || context === void 0 ? void 0 : context.createdBlock) || 0, context);
286
281
  return baseSpread + cumulVolImpact;
287
282
  };
288
283
  exports.getSpreadWithCumulVolPriceImpactP = getSpreadWithCumulVolPriceImpactP;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gainsnetwork/sdk",
3
- "version": "1.3.0-rc3",
3
+ "version": "1.3.0-rc4",
4
4
  "description": "Gains Network SDK",
5
5
  "main": "./lib/index.js",
6
6
  "files": [