@gainsnetwork/sdk 0.2.67-rc7 → 0.2.67-rc8

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.
Files changed (147) hide show
  1. package/lib/backend/globalTrades/index.d.ts +11 -0
  2. package/lib/backend/globalTrades/index.js +69 -0
  3. package/lib/backend/index.d.ts +3 -0
  4. package/lib/backend/index.js +28 -0
  5. package/lib/backend/tradingVariables/backend.types.d.ts +312 -0
  6. package/lib/backend/tradingVariables/backend.types.js +2 -0
  7. package/lib/backend/tradingVariables/converter.d.ts +31 -0
  8. package/lib/backend/tradingVariables/converter.js +330 -0
  9. package/lib/backend/tradingVariables/index.d.ts +5 -0
  10. package/lib/backend/tradingVariables/index.js +95 -0
  11. package/lib/backend/tradingVariables/types.d.ts +109 -0
  12. package/lib/backend/tradingVariables/types.js +14 -0
  13. package/lib/constants.js +1 -1
  14. package/lib/contracts/types/generated/GFarmTradingStorageV5.d.ts +1911 -0
  15. package/lib/contracts/types/generated/GFarmTradingStorageV5.js +2 -0
  16. package/lib/contracts/types/generated/GNSBorrowingFees.d.ts +1067 -0
  17. package/lib/contracts/types/generated/GNSBorrowingFees.js +2 -0
  18. package/lib/contracts/types/generated/GNSMultiCollatDiamond.d.ts +2140 -286
  19. package/lib/contracts/types/generated/GNSNftRewardsV6.d.ts +533 -0
  20. package/lib/contracts/types/generated/GNSNftRewardsV6.js +2 -0
  21. package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.d.ts +613 -0
  22. package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.js +2 -0
  23. package/lib/contracts/types/generated/GNSTrading.d.ts +758 -0
  24. package/lib/contracts/types/generated/GNSTrading.js +2 -0
  25. package/lib/contracts/types/generated/GNSTradingCallbacks.d.ts +875 -0
  26. package/lib/contracts/types/generated/GNSTradingCallbacks.js +2 -0
  27. package/lib/contracts/types/generated/GNSTradingStorage.d.ts +1387 -0
  28. package/lib/contracts/types/generated/GNSTradingStorage.js +2 -0
  29. package/lib/contracts/types/generated/GToken.d.ts +78 -107
  30. package/lib/contracts/types/generated/GTokenV6_3_2.d.ts +1838 -0
  31. package/lib/contracts/types/generated/GTokenV6_3_2.js +2 -0
  32. package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.d.ts +83 -0
  33. package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.js +2691 -0
  34. package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.d.ts +124 -0
  35. package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.js +1784 -0
  36. package/lib/contracts/types/generated/factories/GNSMultiCollatDiamond__factory.d.ts +90 -53
  37. package/lib/contracts/types/generated/factories/GNSMultiCollatDiamond__factory.js +4502 -427
  38. package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.d.ts +100 -0
  39. package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.js +1116 -0
  40. package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.d.ts +100 -0
  41. package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.js +1003 -0
  42. package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.d.ts +113 -0
  43. package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.js +1428 -0
  44. package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.d.ts +96 -0
  45. package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.js +2241 -0
  46. package/lib/contracts/types/generated/factories/GNSTrading__factory.d.ts +95 -0
  47. package/lib/contracts/types/generated/factories/GNSTrading__factory.js +1071 -0
  48. package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.d.ts +110 -0
  49. package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.js +2682 -0
  50. package/lib/contracts/types/generated/factories/GToken__factory.js +65 -142
  51. package/lib/contracts/utils/openLimitOrders.d.ts +8 -0
  52. package/lib/contracts/utils/openLimitOrders.js +88 -0
  53. package/lib/markets/collateral/converter.d.ts +5 -0
  54. package/lib/markets/collateral/converter.js +11 -0
  55. package/lib/markets/collateral/index.d.ts +1 -0
  56. package/lib/markets/collateral/index.js +17 -0
  57. package/lib/markets/collateral/types.d.ts +7 -0
  58. package/lib/markets/collateral/types.js +2 -0
  59. package/lib/markets/oi/converter.d.ts +63 -0
  60. package/lib/markets/oi/converter.js +103 -0
  61. package/lib/markets/oi/fetcher.d.ts +58 -0
  62. package/lib/markets/oi/fetcher.js +181 -0
  63. package/lib/markets/oi/index.d.ts +10 -0
  64. package/lib/markets/oi/index.js +37 -0
  65. package/lib/markets/oi/types.d.ts +82 -0
  66. package/lib/markets/oi/types.js +6 -0
  67. package/lib/markets/oi/validation.d.ts +80 -0
  68. package/lib/markets/oi/validation.js +172 -0
  69. package/lib/trade/fees/borrowing/builder.d.ts +14 -0
  70. package/lib/trade/fees/borrowing/builder.js +33 -0
  71. package/lib/trade/fees/borrowingV2/builder.d.ts +6 -0
  72. package/lib/trade/fees/borrowingV2/builder.js +24 -0
  73. package/lib/trade/fees/borrowingV2/converter.d.ts +75 -0
  74. package/lib/trade/fees/borrowingV2/converter.js +132 -0
  75. package/lib/trade/fees/borrowingV2/fetcher.d.ts +75 -0
  76. package/lib/trade/fees/borrowingV2/fetcher.js +185 -0
  77. package/lib/trade/fees/borrowingV2/index.d.ts +48 -0
  78. package/lib/trade/fees/borrowingV2/index.js +112 -0
  79. package/lib/trade/fees/borrowingV2/types.d.ts +95 -0
  80. package/lib/trade/fees/borrowingV2/types.js +5 -0
  81. package/lib/trade/fees/converter.d.ts +48 -0
  82. package/lib/trade/fees/converter.js +110 -0
  83. package/lib/trade/fees/fundingFees/builder.d.ts +9 -0
  84. package/lib/trade/fees/fundingFees/builder.js +35 -0
  85. package/lib/trade/fees/fundingFees/converter.d.ts +102 -0
  86. package/lib/trade/fees/fundingFees/converter.js +196 -0
  87. package/lib/trade/fees/fundingFees/fetcher.d.ts +66 -0
  88. package/lib/trade/fees/fundingFees/fetcher.js +150 -0
  89. package/lib/trade/fees/fundingFees/index.d.ts +146 -0
  90. package/lib/trade/fees/fundingFees/index.js +346 -0
  91. package/lib/trade/fees/fundingFees/pairContext.d.ts +33 -0
  92. package/lib/trade/fees/fundingFees/pairContext.js +17 -0
  93. package/lib/trade/fees/fundingFees/types.d.ts +77 -0
  94. package/lib/trade/fees/fundingFees/types.js +5 -0
  95. package/lib/trade/fees/tiers/converter.d.ts +54 -0
  96. package/lib/trade/fees/tiers/converter.js +81 -0
  97. package/lib/trade/fees/trading/builder.d.ts +18 -0
  98. package/lib/trade/fees/trading/builder.js +20 -0
  99. package/lib/trade/fees/trading/converter.d.ts +30 -0
  100. package/lib/trade/fees/trading/converter.js +43 -0
  101. package/lib/trade/fees/trading/index.d.ts +62 -0
  102. package/lib/trade/fees/trading/index.js +155 -0
  103. package/lib/trade/fees/trading/types.d.ts +48 -0
  104. package/lib/trade/fees/trading/types.js +5 -0
  105. package/lib/trade/liquidation/builder.d.ts +25 -0
  106. package/lib/trade/liquidation/builder.js +59 -0
  107. package/lib/trade/liquidation/converter.d.ts +23 -0
  108. package/lib/trade/liquidation/converter.js +46 -0
  109. package/lib/trade/liquidation/index.d.ts +26 -0
  110. package/lib/trade/liquidation/index.js +142 -0
  111. package/lib/trade/liquidation/types.d.ts +59 -0
  112. package/lib/trade/liquidation/types.js +2 -0
  113. package/lib/trade/openLimitOrder.d.ts +2 -0
  114. package/lib/trade/openLimitOrder.js +23 -0
  115. package/lib/trade/pnl/builder.d.ts +16 -0
  116. package/lib/trade/pnl/builder.js +44 -0
  117. package/lib/trade/pnl/converter.d.ts +47 -0
  118. package/lib/trade/pnl/converter.js +72 -0
  119. package/lib/trade/pnl/index.d.ts +77 -0
  120. package/lib/trade/pnl/index.js +270 -0
  121. package/lib/trade/pnl/types.d.ts +114 -0
  122. package/lib/trade/pnl/types.js +5 -0
  123. package/lib/trade/priceImpact/close/index.d.ts +21 -0
  124. package/lib/trade/priceImpact/close/index.js +131 -0
  125. package/lib/trade/priceImpact/close/types.d.ts +43 -0
  126. package/lib/trade/priceImpact/close/types.js +5 -0
  127. package/lib/trade/priceImpact/cumulVol/converter.d.ts +31 -0
  128. package/lib/trade/priceImpact/cumulVol/converter.js +59 -0
  129. package/lib/trade/priceImpact/cumulVol/index.d.ts +107 -0
  130. package/lib/trade/priceImpact/cumulVol/index.js +228 -0
  131. package/lib/trade/priceImpact/index.d.ts +12 -0
  132. package/lib/trade/priceImpact/index.js +59 -0
  133. package/lib/trade/priceImpact/open/index.d.ts +22 -0
  134. package/lib/trade/priceImpact/open/index.js +76 -0
  135. package/lib/trade/priceImpact/open/types.d.ts +41 -0
  136. package/lib/trade/priceImpact/open/types.js +5 -0
  137. package/lib/trade/priceImpact/skew/converter.d.ts +77 -0
  138. package/lib/trade/priceImpact/skew/converter.js +171 -0
  139. package/lib/trade/priceImpact/skew/fetcher.d.ts +63 -0
  140. package/lib/trade/priceImpact/skew/fetcher.js +168 -0
  141. package/lib/trade/priceImpact/skew/index.d.ts +58 -0
  142. package/lib/trade/priceImpact/skew/index.js +179 -0
  143. package/lib/trade/priceImpact/skew/types.d.ts +55 -0
  144. package/lib/trade/priceImpact/skew/types.js +5 -0
  145. package/lib/trade/utils.d.ts +18 -0
  146. package/lib/trade/utils.js +30 -0
  147. package/package.json +1 -1
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ /**
3
+ * @dev Skew price impact calculations for v10+ trades
4
+ * @dev Based on formula: (existingSkew + tradeSize/2) / skewDepth
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.SkewPriceImpact = exports.calculatePartialSizeToken = exports.getTradeSkewPriceImpactWithChecks = exports.getTradeSkewPriceImpact = exports.calculateSkewPriceImpactP = exports.getTradeSkewDirection = exports.getNetSkewCollateral = exports.getNetSkewToken = void 0;
34
+ const utils_1 = require("../../utils");
35
+ // Constants
36
+ const PRICE_IMPACT_DIVIDER = 2; // Half price impact to match cumulative volume impact scale
37
+ /**
38
+ * @dev Calculates net skew in tokens (long - short)
39
+ * @param pairOi Pair OI data with long and short token amounts
40
+ * @returns Net skew in tokens (positive = long heavy, negative = short heavy)
41
+ */
42
+ const getNetSkewToken = (pairOi) => {
43
+ return pairOi.oiLongToken - pairOi.oiShortToken;
44
+ };
45
+ exports.getNetSkewToken = getNetSkewToken;
46
+ /**
47
+ * @dev Calculates net skew in collateral tokens
48
+ * @param netSkewToken Net skew in tokens
49
+ * @param currentPrice Current pair price
50
+ * @returns Net skew in collateral tokens
51
+ */
52
+ const getNetSkewCollateral = (netSkewToken, currentPrice) => {
53
+ return netSkewToken * currentPrice;
54
+ };
55
+ exports.getNetSkewCollateral = getNetSkewCollateral;
56
+ /**
57
+ * @dev Determines trade direction impact on skew
58
+ * @param long Is long position
59
+ * @param open Is opening (true) or closing (false)
60
+ * @returns Whether trade increases or decreases skew
61
+ */
62
+ const getTradeSkewDirection = (long, open) => {
63
+ // Opening long or closing short increases positive skew
64
+ // Opening short or closing long increases negative skew
65
+ return (long && open) || (!long && !open);
66
+ };
67
+ exports.getTradeSkewDirection = getTradeSkewDirection;
68
+ /**
69
+ * @dev Core skew price impact calculation
70
+ * @param existingSkewToken Current net skew in tokens (signed)
71
+ * @param tradeSizeToken Trade size in tokens (always positive)
72
+ * @param skewDepth Skew depth in collateral tokens
73
+ * @param tradeIncreasesSkew Whether trade increases skew in its direction
74
+ * @returns Price impact percentage (can be positive or negative)
75
+ */
76
+ const calculateSkewPriceImpactP = (existingSkewToken, tradeSizeToken, skewDepth, tradeIncreasesSkew) => {
77
+ if (skewDepth === 0) {
78
+ return 0; // No impact if depth is 0
79
+ }
80
+ // Convert signed values based on trade direction
81
+ const tradeSkewMultiplier = tradeIncreasesSkew ? 1 : -1;
82
+ const signedExistingSkew = existingSkewToken;
83
+ const signedTradeSize = tradeSizeToken * tradeSkewMultiplier;
84
+ // Formula: (existingSkew + tradeSize/2) / skewDepth
85
+ const numerator = signedExistingSkew + signedTradeSize / 2;
86
+ const priceImpactP = (numerator / skewDepth) * 100; // Convert to percentage
87
+ // Apply divider to match cumulative volume impact scale
88
+ return priceImpactP / PRICE_IMPACT_DIVIDER;
89
+ };
90
+ exports.calculateSkewPriceImpactP = calculateSkewPriceImpactP;
91
+ /**
92
+ * @dev Main function to calculate skew price impact for a trade
93
+ * @param context Skew price impact context with depths and OI data
94
+ * @param input Trade parameters
95
+ * @returns Skew price impact result
96
+ */
97
+ const getTradeSkewPriceImpact = (context, input) => {
98
+ var _a, _b;
99
+ // Get skew depth for the pair
100
+ const skewDepth = (_a = context.skewDepths[input.collateralIndex]) === null || _a === void 0 ? void 0 : _a[input.pairIndex];
101
+ if (skewDepth === undefined) {
102
+ throw new Error(`Missing skew depth for collateral ${input.collateralIndex} pair ${input.pairIndex}`);
103
+ }
104
+ // Get pair OI data
105
+ const pairOi = (_b = context.pairOiTokens[input.collateralIndex]) === null || _b === void 0 ? void 0 : _b[input.pairIndex];
106
+ if (!pairOi) {
107
+ throw new Error(`Missing pair OI data for collateral ${input.collateralIndex} pair ${input.pairIndex}`);
108
+ }
109
+ // Calculate net skew
110
+ const netSkewToken = (0, exports.getNetSkewToken)(pairOi);
111
+ // Determine trade direction impact
112
+ const tradeIncreasesSkew = (0, exports.getTradeSkewDirection)(input.long, input.open);
113
+ // Calculate price impact
114
+ const priceImpactP = (0, exports.calculateSkewPriceImpactP)(netSkewToken, input.positionSizeToken, skewDepth, tradeIncreasesSkew);
115
+ // Determine trade direction relative to skew
116
+ let tradeDirection;
117
+ if (priceImpactP > 0) {
118
+ tradeDirection = "increase";
119
+ }
120
+ else if (priceImpactP < 0) {
121
+ tradeDirection = "decrease";
122
+ }
123
+ else {
124
+ tradeDirection = "neutral";
125
+ }
126
+ return {
127
+ priceImpactP,
128
+ netSkewToken,
129
+ netSkewCollateral: 0,
130
+ tradeDirection,
131
+ };
132
+ };
133
+ exports.getTradeSkewPriceImpact = getTradeSkewPriceImpact;
134
+ /**
135
+ * @dev Calculate skew price impact for a trade with all parameters
136
+ * @param params Trade parameters including price and version checks
137
+ * @param context Skew price impact context
138
+ * @returns Price impact percentage or 0 if not applicable
139
+ */
140
+ const getTradeSkewPriceImpactWithChecks = (params, context) => {
141
+ // v10+ trades only
142
+ if (params.contractsVersion < 10) {
143
+ return 0;
144
+ }
145
+ // Counter trades don't pay skew impact
146
+ if (params.isCounterTrade) {
147
+ return 0;
148
+ }
149
+ // Calculate position size in tokens
150
+ const positionSizeToken = (0, utils_1.calculatePositionSizeToken)(params.positionSizeCollateral, params.currentPrice);
151
+ // Get skew price impact
152
+ const result = (0, exports.getTradeSkewPriceImpact)(context, {
153
+ collateralIndex: params.collateralIndex,
154
+ pairIndex: params.pairIndex,
155
+ long: params.long,
156
+ open: params.open,
157
+ positionSizeToken,
158
+ });
159
+ return result.priceImpactP;
160
+ };
161
+ exports.getTradeSkewPriceImpactWithChecks = getTradeSkewPriceImpactWithChecks;
162
+ /**
163
+ * @dev Calculate position sizes for partial operations
164
+ * @param originalSizeCollateral Original position size in collateral
165
+ * @param deltaCollateral Position size delta in collateral
166
+ * @param originalSizeToken Original position size in tokens
167
+ * @returns Delta in tokens proportional to collateral delta
168
+ */
169
+ const calculatePartialSizeToken = (originalSizeCollateral, deltaCollateral, originalSizeToken) => {
170
+ if (originalSizeCollateral === 0) {
171
+ return 0;
172
+ }
173
+ // For partial close/add, token delta is proportional to collateral delta
174
+ return (deltaCollateral * originalSizeToken) / originalSizeCollateral;
175
+ };
176
+ exports.calculatePartialSizeToken = calculatePartialSizeToken;
177
+ // Export namespace for types
178
+ exports.SkewPriceImpact = __importStar(require("./types"));
179
+ __exportStar(require("./fetcher"), exports);
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @dev Skew price impact types for v10+ trades
3
+ */
4
+ export type PairOiToken = {
5
+ oiLongToken: number;
6
+ oiShortToken: number;
7
+ };
8
+ export type PairOiCollateral = {
9
+ oiLongCollateral: number;
10
+ oiShortCollateral: number;
11
+ };
12
+ export type SkewDepth = {
13
+ collateralIndex: number;
14
+ pairIndex: number;
15
+ depth: number;
16
+ };
17
+ export type SkewPriceImpactInput = {
18
+ collateralIndex: number;
19
+ pairIndex: number;
20
+ long: boolean;
21
+ open: boolean;
22
+ positionSizeToken: number;
23
+ };
24
+ export type SkewPriceImpactResult = {
25
+ priceImpactP: number;
26
+ netSkewToken: number;
27
+ netSkewCollateral: number;
28
+ tradeDirection: "increase" | "decrease" | "neutral";
29
+ };
30
+ export type SkewPriceImpactContext = {
31
+ skewDepths: {
32
+ [collateralIndex: number]: {
33
+ [pairIndex: number]: number;
34
+ };
35
+ };
36
+ pairOiTokens: {
37
+ [collateralIndex: number]: {
38
+ [pairIndex: number]: PairOiToken;
39
+ };
40
+ };
41
+ };
42
+ export type TradeSkewParams = {
43
+ collateralIndex: number;
44
+ pairIndex: number;
45
+ long: boolean;
46
+ open: boolean;
47
+ positionSizeCollateral: number;
48
+ currentPrice: number;
49
+ contractsVersion: number;
50
+ isCounterTrade?: boolean;
51
+ };
52
+ export type PositionSizeResult = {
53
+ positionSizeToken: number;
54
+ positionSizeCollateral: number;
55
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * @dev Skew price impact types for v10+ trades
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @dev Trade-specific utility functions
3
+ * @dev Common calculations and conversions used across trading modules
4
+ */
5
+ /**
6
+ * @dev Converts position size from collateral to tokens
7
+ * @param positionSizeCollateral Position size in collateral tokens
8
+ * @param currentPrice Current pair price
9
+ * @returns Position size in tokens
10
+ */
11
+ export declare const calculatePositionSizeToken: (positionSizeCollateral: number, currentPrice: number) => number;
12
+ /**
13
+ * @dev Converts position size from tokens to collateral
14
+ * @param positionSizeToken Position size in tokens
15
+ * @param currentPrice Current pair price
16
+ * @returns Position size in collateral tokens
17
+ */
18
+ export declare const calculatePositionSizeCollateral: (positionSizeToken: number, currentPrice: number) => number;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * @dev Trade-specific utility functions
4
+ * @dev Common calculations and conversions used across trading modules
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.calculatePositionSizeCollateral = exports.calculatePositionSizeToken = void 0;
8
+ /**
9
+ * @dev Converts position size from collateral to tokens
10
+ * @param positionSizeCollateral Position size in collateral tokens
11
+ * @param currentPrice Current pair price
12
+ * @returns Position size in tokens
13
+ */
14
+ const calculatePositionSizeToken = (positionSizeCollateral, currentPrice) => {
15
+ if (currentPrice === 0) {
16
+ throw new Error("Current price cannot be zero");
17
+ }
18
+ return positionSizeCollateral / currentPrice;
19
+ };
20
+ exports.calculatePositionSizeToken = calculatePositionSizeToken;
21
+ /**
22
+ * @dev Converts position size from tokens to collateral
23
+ * @param positionSizeToken Position size in tokens
24
+ * @param currentPrice Current pair price
25
+ * @returns Position size in collateral tokens
26
+ */
27
+ const calculatePositionSizeCollateral = (positionSizeToken, currentPrice) => {
28
+ return positionSizeToken * currentPrice;
29
+ };
30
+ exports.calculatePositionSizeCollateral = calculatePositionSizeCollateral;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gainsnetwork/sdk",
3
- "version": "0.2.67-rc7",
3
+ "version": "0.2.67-rc8",
4
4
  "description": "Gains Network SDK",
5
5
  "main": "./lib/index.js",
6
6
  "files": [