Skip to content

Commit 9a8df83

Browse files
Hiksangclaude
andcommitted
fix: position verification matches -PERP suffix (HL returns LINK-PERP not LINK)
Prevents false rollback when HL position exists but symbol format differs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d0e3abd commit 9a8df83

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "perp-cli",
3-
"version": "0.7.37",
3+
"version": "0.7.38",
44
"description": "Multi-DEX Perpetual Futures CLI - Pacifica, Hyperliquid, Lighter, Aster",
55
"bin": {
66
"perp": "dist/index.js",

src/bot/strategies/funding-arb-strategy.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,10 @@ export class FundingArbStrategy implements Strategy {
598598
longAdapter.getPositions(),
599599
shortAdapter.getPositions(),
600600
]);
601-
const longExists = longPositions.some(p => p.symbol.toUpperCase() === best.symbol.toUpperCase() && parseFloat(p.size) > 0);
602-
const shortExists = shortPositions.some(p => p.symbol.toUpperCase() === best.symbol.toUpperCase() && parseFloat(p.size) > 0);
601+
const symUpper = best.symbol.toUpperCase();
602+
const matchSymbol = (s: string) => { const u = s.toUpperCase(); return u === symUpper || u === symUpper + "-PERP" || u.replace(/-PERP$/, "") === symUpper; };
603+
const longExists = longPositions.some(p => matchSymbol(p.symbol) && parseFloat(p.size) > 0);
604+
const shortExists = shortPositions.some(p => matchSymbol(p.symbol) && parseFloat(p.size) > 0);
603605
if (!longExists && !shortExists) {
604606
// Both missing likely means cache issue — log warning but don't rollback
605607
ctx.log(` [ARB] Position verification: both sides not visible for ${best.symbol} (may be cache delay)`);

0 commit comments

Comments
 (0)