hpx-transport
Exchange SDK toolkit for cryptocurrency trading with authentication, WebSocket, and rate limiting.
This crate is part of the hpx project and builds on the hpx HTTP client to provide exchange-specific functionality.
Features
- Authentication: API key, Bearer token, HMAC signing, and composable auth strategies
- REST Client: Generic exchange REST client with typed responses
- WebSocket: Single-task connection with
Connection/Handle/Streamsplit API and auto-reconnect - Rate Limiting: Token bucket rate limiter using lock-free
scccontainers - Typed Responses: Generic response wrapper with metadata and error handling
- Metrics: OpenTelemetry OTLP gRPC metrics integration
Quick Start
use ;
async
Live Proxy Pool Tests
The repository includes an ignored live test that validates proxy pool behavior
(StickyFailover and RandomPerRequest) against a real proxy list.
Default proxy list path:
docs/webshare_proxy_list.txt
You can override the file path with HPX_PROXY_LIST_PATH.
HPX_PROXY_LIST_PATH=/absolute/path/to/proxy_list.txt \
WebSocket (Split API)
use ;
use GenericJsonHandler;
# async
Rate Limiting
use RateLimiter;
let limiter = new;
limiter.add_limit.unwrap; // 10 capacity, 1/sec refill
if limiter.try_acquire
Feature Flags
| Feature | Default | Description |
|---|---|---|
ws-yawc |
Yes | WebSocket backend via hpx-yawc |
ws-fastwebsockets |
No | WebSocket backend via fastwebsockets |
Key Dependencies
hpx— HTTP client (withjson,tracing,boring,http1,http2)opentelemetry— Metrics via OTLP gRPCscc— Lock-free concurrent containerstracing— Structured logging
License
Apache-2.0