@gainsnetwork/sdk 0.2.33-rc2 → 0.2.33-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.
package/lib/constants.js CHANGED
@@ -327,8 +327,8 @@ exports.stockSplits = {
327
327
  exports.delistedPairIxs = new Set([
328
328
  6, 31, 36, 45, 48, 51, 54, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
329
329
  71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
330
- 97, 99, 101, 106, 108, 52, 131, 147, 160, 179, 182, 183, 190, 229, 163, 155,
331
- 15, 170, 239, 254, 230, 4, 275, 282, 283, 284, 285,
330
+ 97, 99, 101, 106, 108, 52, 131, 147, 160, 179, 182, 183, 190, 229, 163, 15,
331
+ 170, 239, 254, 230, 4, 275,
332
332
  ]);
333
333
  exports.delistedGroupsIxs = new Set([6, 7]);
334
334
  exports.DEFAULT_PROTECTION_CLOSE_FACTOR = 1;
@@ -1,16 +1,14 @@
1
- import { LiquidationParams, OiWindows, OiWindowsSettings, PairDepth } from "./types";
1
+ import { LiquidationParams, OiWindows, OiWindowsSettings, PairDepth, PairFactor } from "./types";
2
2
  import { ContractsVersion } from "../contracts/types";
3
3
  export type SpreadContext = {
4
4
  isOpen?: boolean;
5
5
  isPnlPositive?: boolean;
6
- protectionCloseFactor?: number;
7
- protectionCloseFactorBlocks?: number;
8
- cumulativeFactor?: number;
9
6
  createdBlock?: number;
10
7
  liquidationParams?: LiquidationParams | undefined;
11
8
  currentBlock?: number | undefined;
12
9
  contractsVersion?: ContractsVersion | undefined;
13
- };
10
+ protectionCloseFactorWhitelist?: boolean;
11
+ } & Partial<PairFactor>;
14
12
  export declare const getProtectionCloseFactor: (spreadCtx: SpreadContext | undefined) => number;
15
13
  export declare const getCumulativeFactor: (spreadCtx: SpreadContext | undefined) => number;
16
14
  export declare const getLegacyFactor: (spreadCtx: SpreadContext | undefined) => number;
@@ -12,7 +12,8 @@ const getProtectionCloseFactor = (spreadCtx) => {
12
12
  spreadCtx.protectionCloseFactor === undefined ||
13
13
  spreadCtx.protectionCloseFactorBlocks === undefined ||
14
14
  spreadCtx.createdBlock === undefined ||
15
- spreadCtx.currentBlock === undefined)
15
+ spreadCtx.currentBlock === undefined ||
16
+ spreadCtx.protectionCloseFactorWhitelist === true)
16
17
  return constants_1.DEFAULT_PROTECTION_CLOSE_FACTOR;
17
18
  if (spreadCtx.isPnlPositive &&
18
19
  !spreadCtx.isOpen &&
@@ -37,6 +38,7 @@ const getLegacyFactor = (spreadCtx) => {
37
38
  return (spreadCtx === null || spreadCtx === void 0 ? void 0 : spreadCtx.contractsVersion) === types_1.ContractsVersion.BEFORE_V9_2 ? 1 : 2;
38
39
  };
39
40
  exports.getLegacyFactor = getLegacyFactor;
41
+ // @todo
40
42
  const getSpreadWithPriceImpactP = (pairSpreadP, buy, collateral, leverage, pairDepth, oiWindowsSettings, oiWindows, spreadCtx) => {
41
43
  if (pairSpreadP === undefined) {
42
44
  return 0;
@@ -62,6 +64,7 @@ const getSpreadWithPriceImpactP = (pairSpreadP, buy, collateral, leverage, pairD
62
64
  if (!onePercentDepth || activeOi === undefined || collateral === undefined) {
63
65
  return pairSpreadP / 2;
64
66
  }
67
+ // @todo implement exemptOnOpen && exemptAfterProtectionCloseFactor
65
68
  return ((0, exports.getSpreadP)(pairSpreadP) +
66
69
  ((activeOi * (0, exports.getCumulativeFactor)(spreadCtx) + (collateral * leverage) / 2) /
67
70
  onePercentDepth /
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gainsnetwork/sdk",
3
- "version": "0.2.33-rc2",
3
+ "version": "0.2.33-rc4",
4
4
  "description": "Gains Network SDK",
5
5
  "main": "./lib/index.js",
6
6
  "files": [