Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 1.04 KB

File metadata and controls

28 lines (18 loc) · 1.04 KB

Rust quickstart

A short "hello world" that authenticates with the Cryptohopper API and prints your account info plus the BTC/USDT price.

Run it

export CRYPTOHOPPER_TOKEN=your-40-char-bearer
cargo run

What it shows

  • How to construct a client with Client::builder().api_key(...).build()?
  • One authenticated call: ch.user.get().await? returns serde_json::Value
  • One market-data call: ch.exchange.ticker(&json!({...})).await?
  • Typed error handling — every error has an ErrorCode enum variant

Where to get a token

cryptohopper.com developer dashboard → Create OAuth app → drive the consent flow once. See oauth/ for runnable OAuth examples, or use the cryptohopper CLI (cryptohopper login) which handles the flow for you.

Dependencies

  • cryptohopper
  • tokio for the async runtime, serde_json for the request payloads.

Requires Rust 1.75+ (2021 edition).