Skip to content

fix: Hyperliquid array parser, Aevo wrong channel, add ping keepalive#4

Merged
bokiko merged 1 commit intomainfrom
fix/websocket-bugs
Mar 22, 2026
Merged

fix: Hyperliquid array parser, Aevo wrong channel, add ping keepalive#4
bokiko merged 1 commit intomainfrom
fix/websocket-bugs

Conversation

@bokiko
Copy link
Copy Markdown
Owner

@bokiko bokiko commented Mar 22, 2026

Summary

Fixes critical bugs found during code review that caused Hyperliquid and Aevo liquidations to be silently dropped.

  • Hyperliquid parser: trades channel sends data as an array of trade objects, not a single object. The old parser accessed msg.data.liquidation on the array itself, which was always undefined — zero Hyperliquid liquidations were ever captured. Now iterates the array correctly.
  • Aevo subscription: was subscribing to orderbook:BTC-PERP which delivers order book snapshots, not trades. Changed to trades:BTC-PERP which carries the is_liquidation flag the parser expects.
  • Hyperliquid ping keepalive: added { method: 'ping' } every 30s to prevent silent connection drops during quiet markets (~60s idle timeout).
  • ID collision: added random suffix to Hyperliquid IDs to prevent dedup collisions on same-millisecond trades.
  • Parse errors: logged via console.debug instead of silently swallowed.

Test plan

  • Verify Hyperliquid WebSocket connects and stays alive during quiet periods
  • Confirm Hyperliquid liquidations appear in the feed when they occur
  • Confirm Aevo receives trade data (not orderbook snapshots)
  • Check browser console for parse error debug logs (should be minimal)

🤖 Generated with Claude Code

- Hyperliquid trades channel sends data as array, not single object.
  Parser now iterates the array so liquidations are actually captured.
- Aevo subscription changed from orderbook:BTC-PERP to trades:BTC-PERP.
  Orderbook channel never carries trade/liquidation data.
- Added configurable ping keepalive (30s) for Hyperliquid to prevent
  silent connection drops during quiet markets.
- Fixed ID collision risk by adding random suffix to Hyperliquid IDs.
- Parse errors now logged via console.debug instead of silently swallowed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
btc-liquidations Ready Ready Preview, Comment Mar 22, 2026 11:06pm

Request Review

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@bokiko bokiko merged commit ca21a0b into main Mar 22, 2026
3 checks passed
@bokiko bokiko deleted the fix/websocket-bugs branch March 22, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant