Skip to main content

Crate cryptohopper

Crate cryptohopper 

Source
Expand description

Official Rust SDK for the Cryptohopper API.

§Quickstart

use cryptohopper::Client;

let ch = Client::new(std::env::var("CRYPTOHOPPER_TOKEN").unwrap())?;

let me = ch.user.get().await?;
println!("{}", me);

let ticker = ch
    .exchange
    .ticker(&serde_json::json!({"exchange": "binance", "market": "BTC/USDT"}))
    .await?;
println!("{}", ticker["last"]);

§Full configuration

use cryptohopper::Client;
use std::time::Duration;

let ch = Client::builder()
    .api_key("ch_...")
    .app_key("your_client_id")
    .base_url("https://api-staging.cryptohopper.com/v1")
    .timeout(Duration::from_secs(60))
    .max_retries(5)
    .user_agent("my-bot/1.0")
    .build()?;

Re-exports§

pub use error::Error;
pub use error::ErrorCode;

Modules§

error
Typed errors returned by every SDK call on non-2xx responses and on transport-level failures.
resources
Resource modules. Each corresponds to one public API domain.

Structs§

Client
The public entry point. Clone freely — resources share transport via Arc.
ClientBuilder
Builder for Client.

Enums§

Value
Represents any valid JSON value.

Constants§

VERSION
Current SDK version, kept in lockstep with Cargo.toml.