perp-cli 0.7.23 → 0.7.24

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.
@@ -119,15 +119,19 @@ export class FundingArbStrategy {
119
119
  }
120
120
  }
121
121
  const nonUsdc = spotBalances.filter(b => Number(b.total) > 0 && !b.token.toUpperCase().startsWith("USDC"));
122
+ ctx.log(` [ARB] ${name} spot balances: ${nonUsdc.map(b => `${b.token}=${b.total}`).join(", ") || "none"}`);
122
123
  if (nonUsdc.length === 0)
123
124
  continue;
124
125
  const perpPositions = positionsByExchange.get(name) ?? [];
125
126
  for (const perp of perpPositions) {
126
127
  const perpKey = `${name}:${perp.symbol}`;
127
- if (used.has(perpKey))
128
+ if (used.has(perpKey)) {
129
+ ctx.log(` [ARB] ${perpKey} already matched cross-exchange, skip spot-perp`);
128
130
  continue;
131
+ }
129
132
  const base = perp.symbol.replace(/-PERP$/, "").toUpperCase();
130
133
  const spotBal = nonUsdc.find(b => b.token.toUpperCase() === base);
134
+ ctx.log(` [ARB] ${name} perp ${perp.symbol}(${perp.side}) → base=${base}, spotMatch=${spotBal ? spotBal.token : "none"}`);
131
135
  if (spotBal && perp.side === "short") {
132
136
  recovered.push({ symbol: base, longExchange: `${name}-spot`, shortExchange: name, entrySpread: 0, size: perp.size, mode: "spot-perp" });
133
137
  used.add(perpKey);
@@ -385,7 +389,11 @@ export class FundingArbStrategy {
385
389
  }
386
390
  // Auto-execute: try each opportunity until one succeeds
387
391
  if (arbPositions < params.max_positions) {
392
+ // Skip symbols already in open positions
393
+ const openSymbols = new Set(ctx.state.get("arbOpenPositions").map(p => p.symbol.toUpperCase()));
388
394
  for (const best of opportunities) {
395
+ if (openSymbols.has(best.symbol.toUpperCase()))
396
+ continue;
389
397
  if (best.mode === "spot-perp") {
390
398
  const opened = await this.openSpotPerp(best, adapters, ctx);
391
399
  if (opened)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perp-cli",
3
- "version": "0.7.23",
3
+ "version": "0.7.24",
4
4
  "description": "Multi-DEX Perpetual Futures CLI - Pacifica, Hyperliquid, Lighter, Aster",
5
5
  "bin": {
6
6
  "perp": "dist/index.js",