| Crates.io | paradex |
| lib.rs | paradex |
| version | 0.7.2 |
| created_at | 2025-01-21 18:48:42.584943+00 |
| updated_at | 2026-01-14 01:53:03.481384+00 |
| description | Paradex client library |
| homepage | |
| repository | https://github.com/snow-avocado/paradex-rs |
| max_upload_size | |
| id | 1525222 |
| size | 280,685 |
A simple, yet high performance client library for paradex
Both websocket and rest connectivity are supported. Currently a sub-set of the most important APIs are supported.
The benchmark uses mimalloc as I notice a 10-20% speedup using a mimalloc vs default allocator. Suggest benchmarking on your system / environment.
If you appreciate this crate, donate to 0x4a0b9C3781d78BDE1Ca29B216e78f192c636De0f on ethereum or base. Or use my paradex referral link for a 5% fee discount. Click Here
See here for full examples.
Run the onboarding helper (requires the onboarding feature) to derive your Paradex Stark key from an Ethereum private key and optionally attach marketing/referral metadata:
cargo run --example onboarding --features onboarding -- \
--ethereum-private-key <hex> \
--marketing-code OPTIONAL_CODE \
--referral-code OPTIONAL_REFERRAL
Override the --utm-* flags to populate campaign tracking fields, or pass --production to talk to mainnet instead of testnet.
#[tokio::main]
async fn main() {
let symbol: String = "BTC-USD-PERP".into();
let manager = paradex::ws::WebsocketManager::new(paradex::url::URL::Testnet, None).await;
let summary_id = manager
.subscribe(
paradex::ws::Channel::MarketSummary,
Box::new(|message| info!("Received message {message:?}")),
)
.await
.unwrap();
let bbo_id = manager
.subscribe(
paradex::ws::Channel::BBO {
market_symbol: symbol.clone(),
},
Box::new(|message| info!("Received message {message:?}")),
)
.await
.unwrap();
let trades_id = manager
.subscribe(
paradex::ws::Channel::Trades {
market_symbol: symbol.clone(),
},
Box::new(|message| info!("Received message {message:?}")),
)
.await
.unwrap();
let orderbook_id = manager
.subscribe(
paradex::ws::Channel::OrderBook {
market_symbol: symbol.clone(),
refresh_rate: "50ms".into(),
price_tick: None,
},
Box::new(|message| info!("Received message {message:?}")),
)
.await
.unwrap();
let orderbook_deltas_id = manager
.subscribe(
paradex::ws::Channel::OrderBookDeltas {
market_symbol: symbol.clone(),
},
Box::new(|message| info!("Received message {message:?}")),
)
.await
.unwrap();
let funding_id = manager
.subscribe(
paradex::ws::Channel::FundingData {
market_symbol: None,
},
Box::new(|message| info!("Received message {message:?}")),
)
.await
.unwrap();
tokio::time::sleep(Duration::from_secs(120)).await;
for id in [
summary_id,
bbo_id,
trades_id,
orderbook_id,
orderbook_deltas_id,
funding_id,
] {
manager.unsubscribe(id).await.unwrap();
}
tokio::time::sleep(Duration::from_secs(5)).await;
manager.stop().await.unwrap();
}