Skip to content

feat: add Hyperliquid WebSocket and Solana gRPC streaming endpoints#98

Closed
user1303836 wants to merge 1 commit intomainfrom
feature/hyperliquid-streaming
Closed

feat: add Hyperliquid WebSocket and Solana gRPC streaming endpoints#98
user1303836 wants to merge 1 commit intomainfrom
feature/hyperliquid-streaming

Conversation

@user1303836
Copy link
Owner

Summary

  • Add real-time streaming infrastructure with 3 new endpoints: POST /v1/stream/start, POST /v1/stream/{stream_id}/stop, GET /v1/streams
  • Support Hyperliquid WebSocket streaming via existing HyperliquidWsClient (subscribes to userFills, userFundings, userNonFundingLedgerUpdates)
  • Support Solana gRPC streaming via existing SolanaGrpcAdapter (Yellowstone)
  • Batch-flush ingested transactions (100 items or 5-second interval)
  • Semaphore-based concurrency limiting (max 5 concurrent streams)
  • CancellationToken for clean stream shutdown
  • Add solana_grpc_url and solana_grpc_token config fields
  • Add Clone derive on Repository for spawned task usage
  • 13 new tests covering all stream endpoints, auth, wallet scoping, semaphore limits, and serialization (189 total tests pass)

Changed files

  • api/src/main.rs - streaming handlers, routes, StreamEntry/StreamInfo structs, run_hyperliquid_stream, run_solana_stream, tests
  • api/Cargo.toml - add tokio-util, chrono dependencies
  • core/src/config.rs - add solana_grpc_url, solana_grpc_token fields
  • adapters/src/repo.rs - add #[derive(Clone)] to Repository

Test plan

  • All 189 tests pass (cargo test)
  • cargo clippy -- -D warnings clean
  • cargo fmt -- --check clean
  • Verify Hyperliquid WS streaming against mainnet (requires live wallet)
  • Verify Solana gRPC streaming against a Yellowstone endpoint (requires solana_grpc_url configured)

…upport

Add real-time streaming infrastructure to the API with three new
endpoints: POST /v1/stream/start, POST /v1/stream/{id}/stop, and
GET /v1/streams. Streams ingest transactions in batches (100 items or
5-second interval) using CancellationToken for lifecycle management
and semaphore-based concurrency limiting (max 5 concurrent streams).

Hyperliquid streaming uses the existing HyperliquidWsClient to subscribe
to user fills, fundings, and ledger updates via WebSocket. Solana
streaming uses the existing SolanaGrpcAdapter via Yellowstone gRPC.

Also adds solana_grpc_url/solana_grpc_token config fields and
Clone derive on Repository for spawned task usage.
@user1303836
Copy link
Owner Author

Closing: PR #94 already merged Solana gRPC streaming with the shared stream infrastructure. This PR's Hyperliquid WS streaming additions conflict with that merged code. Filed as a future enhancement issue instead.

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