@t2000/sdk 0.16.10 → 0.16.12
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.cjs +9 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3439,28 +3439,21 @@ To access invested funds: t2000 invest sell ${params.amount} ${asset}`,
|
|
|
3439
3439
|
investmentCostBasis += pos.costBasis;
|
|
3440
3440
|
}
|
|
3441
3441
|
}
|
|
3442
|
+
let strategySuiTotal = 0;
|
|
3442
3443
|
for (const key of this.portfolio.getAllStrategyKeys()) {
|
|
3443
3444
|
for (const sp of this.portfolio.getStrategyPositions(key)) {
|
|
3444
3445
|
if (!(sp.asset in INVESTMENT_ASSETS)) continue;
|
|
3445
3446
|
const price = assetPrices[sp.asset] ?? 0;
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
if (actualHeld < sp.totalAmount && sp.totalAmount > 0) {
|
|
3450
|
-
investmentCostBasis += sp.costBasis * (actualHeld / sp.totalAmount);
|
|
3451
|
-
} else {
|
|
3452
|
-
investmentCostBasis += sp.costBasis;
|
|
3453
|
-
}
|
|
3454
|
-
bal.gasReserve = {
|
|
3455
|
-
sui: Math.max(0, bal.gasReserve.sui - sp.totalAmount),
|
|
3456
|
-
usdEquiv: Math.max(0, bal.gasReserve.sui - sp.totalAmount) * price
|
|
3457
|
-
};
|
|
3458
|
-
} else {
|
|
3459
|
-
investmentValue += sp.totalAmount * price;
|
|
3460
|
-
investmentCostBasis += sp.costBasis;
|
|
3461
|
-
}
|
|
3447
|
+
investmentValue += sp.totalAmount * price;
|
|
3448
|
+
investmentCostBasis += sp.costBasis;
|
|
3449
|
+
if (sp.asset === "SUI") strategySuiTotal += sp.totalAmount;
|
|
3462
3450
|
}
|
|
3463
3451
|
}
|
|
3452
|
+
if (strategySuiTotal > 0) {
|
|
3453
|
+
const suiPrice2 = assetPrices["SUI"] ?? 0;
|
|
3454
|
+
const gasSui = Math.max(0, bal.gasReserve.sui - strategySuiTotal);
|
|
3455
|
+
bal.gasReserve = { sui: gasSui, usdEquiv: gasSui * suiPrice2 };
|
|
3456
|
+
}
|
|
3464
3457
|
bal.investment = investmentValue;
|
|
3465
3458
|
bal.investmentPnL = investmentValue - investmentCostBasis;
|
|
3466
3459
|
} catch {
|