📈 hyperliquid-sdk
A wrapper for the Hyperliquid API.
简体中文 | English
Examples
Client initialization
Method 1
# Set environment variables
export HYPERLIQUID_API_KEY=hyperliquid_api_key
export HYPERLIQUID_SECRET_KEY=
let api_key = env::var("HYPERLIQUID_API_KEY").unwrap_or_else(|_| "your api key".to_string());
let secret_key = env::var("HYPERLIQUID_SECRET_KEY").unwrap_or_else(|_| "your secret key".to_string());
let client = HyperliquidClient::new().auth(api_key, secret_key);
Method 2
let client = HyperliquidClient::new().auth("your api key".to_string(), "your secret key".to_string());
Get price by symbol
let client = HyperliquidClient::new().auth("your api key".to_string(), "your secret key".to_string());
match client.get_price_by_symbol(symbol).await {
Ok(price) => println!("{} current price: ${:.2}", symbol, price),
Err(e) => println!("error: {}", e),
}