@t2000/sdk 0.17.26 → 0.17.28
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/README.md +5 -0
- package/dist/t2000.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,10 @@ await agent.investEarn({ asset: 'SUI' });
|
|
|
70
70
|
// Stop earning (withdraw from lending, keep in portfolio)
|
|
71
71
|
await agent.investUnearn({ asset: 'SUI' });
|
|
72
72
|
|
|
73
|
+
// Rebalance earning positions to better-rate protocols
|
|
74
|
+
await agent.investRebalance(); // execute
|
|
75
|
+
await agent.investRebalance({ dryRun: true }); // preview only
|
|
76
|
+
|
|
73
77
|
// Sell position (auto-withdraws if earning first)
|
|
74
78
|
await agent.investSell({ asset: 'SUI', usdAmount: 'all' });
|
|
75
79
|
|
|
@@ -197,6 +201,7 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
197
201
|
| `agent.investSell({ asset, usdAmount \| 'all', maxSlippage? })` | Sell crypto back to USDC (auto-withdraws if earning) | `InvestResult` |
|
|
198
202
|
| `agent.investEarn({ asset })` | Deposit invested asset into best-rate lending for yield | `InvestEarnResult` |
|
|
199
203
|
| `agent.investUnearn({ asset })` | Withdraw from lending, keep in portfolio | `InvestUnearnResult` |
|
|
204
|
+
| `agent.investRebalance({ dryRun?, minYieldDiff? })` | Move earning positions to better-rate protocols | `InvestRebalanceResult` |
|
|
200
205
|
| `agent.getPortfolio()` | Investment positions + P&L (grouped by strategy) | `PortfolioResult` |
|
|
201
206
|
|
|
202
207
|
### Strategy Methods
|
package/dist/t2000.js
CHANGED
|
@@ -1264,7 +1264,7 @@ export class T2000 extends EventEmitter {
|
|
|
1264
1264
|
// -- Invest Rebalance --
|
|
1265
1265
|
async investRebalance(opts = {}) {
|
|
1266
1266
|
this.enforcer.assertNotLocked();
|
|
1267
|
-
const minDiff = opts.minYieldDiff ?? 0.
|
|
1267
|
+
const minDiff = opts.minYieldDiff ?? 0.1;
|
|
1268
1268
|
const positions = this.portfolio.getPositions().filter((p) => p.earning && p.earningProtocol);
|
|
1269
1269
|
if (positions.length === 0) {
|
|
1270
1270
|
return { executed: false, moves: [], totalGasCost: 0, skipped: [] };
|