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