Module datamaxi::dex

source ·
Expand description

DEX-related data fetcher and data structures.

This module provides functionality related to decentralized exchange (DEX) data, It includes data structures and methods for retrieving candle and trade data, as well as information supported chains, exchanges, pools and intervals.

§Usage

The Candle and Trade structs are the primary interfaces for interacting with the DEX data. They provide methods for retrieving data with optional parameters to filter and sort the results.

§Example

let config = datamaxi::api::Config {
    base_url: None,
    api_key: "my_api_key".to_string(),
};
let client = datamaxi::api::Client::new(config);
let dex = datamaxi::dex::Dex { client: client.clone() };

// Retrieve candle data
let candle_options = datamaxi::dex::CandleOptions::new().interval("1h").limit(100);
let candle_data = dex.candle("kaia_mainnet", "dragonswap", "0x...", candle_options);

// Retrieve trade data
let trade_options = datamaxi::dex::TradeOptions::new().limit(50);
let trade_data = dex.trade("kaia_mainnet", "dragonswap", "0x...", trade_options);

// Retrieve available pools
let pools_options = datamaxi::dex::PoolsOptions::new().chain("kaia_mainnet");
let pools = dex.pools(pools_options);

§Error Handling

All methods return a Result type, which should be handled appropriately to manage potential errors.

Re-exports§

Structs§

  • Provides methods for retrieving DEX candle data and related information.