1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//! # DataMaxi+ Rust SDK
//!
//! This is the official implementation of Rust SDK for [DataMaxi+](https://datamaxiplus.com/).
//! The package can be used to fetch both historical and latest data using [DataMaxi+ API](https://docs.datamaxiplus.com/).
//!
//! - [Installation](#installation)
//! - [Configuration](#configuration)
//! - [Links](#links)
//! - [Contributing](#contributing)
//! - [License](#license)
//!
//! ## Installation
//!
//! ```shell
//! [dependencies]
//! datamaxi = { git = "https://github.com/bisonai/datamaxi-rust.git" }
//! ```
//!
//! ## Configuration
//!
//! Private API endpoints are protected by an API key.
//! You can get the API key upon registering at <https://datamaxiplus.com/auth>.
//!
//!
//!| Option     | Explanation                                                                   |
//!|------------|-------------------------------------------------------------------------------|
//!| `api_key`  | Your API key                                                                  |
//!| `base_url` | If `base_url` is not provided, it defaults to `https://api.datamaxiplus.com`. |
//!
//! ## Examples
//!
//! ### CEX Candle
//!
//! ```rust
//! let api_key = "my_api_key".to_string();
//! let candle: datamaxi::cex::Candle = datamaxi::api::Datamaxi::new(api_key);
//!
//! // Fetch supported exchanges for CEX candle data
//! candle.exchanges("spot");
//!
//! // Fetch supported symbols for CEX candle data
//! let symbols_options = datamaxi::cex::SymbolsOptions::new();
//! candle.symbols("binance", symbols_options);
//!
//! // Fetch supported intervals for CEX candle data
//! candle.intervals();
//!
//! // Fetch CEX candle data
//! let candle_options = datamaxi::cex::CandleOptions::new();
//! candle.get("binance", "ETH-USDT", candle_options);
//! ```
//!
//! ### DEX
//!
//! ```rust
//! let api_key = "my_api_key".to_string();
//! let dex: datamaxi::dex::Dex = datamaxi::api::Datamaxi::new(api_key);
//!
//! // Fetch supported intervals for DEX candle data
//! dex.intervals();
//!
//! // Fetch supported exchange for DEX data
//! dex.exchanges();
//!
//! // Fetch supported chains for DEX data
//! dex.chains();
//!
//! // Fetch supported pools for DEX data
//! let pools_options = datamaxi::dex::PoolsOptions::new();
//! dex.pools(pools_options);
//!
//! // Fetch DEX candle data
//! let params = datamaxi::dex::CandleOptions::new();
//! dex.candle(
//!   "bsc_mainnet",
//!   "pancakeswap",
//!   "0xb24cd29e32FaCDDf9e73831d5cD1FFcd1e535423",
//!   params,
//! );
//!
//! // Fetch DEX trade data
//! let trade_options = datamaxi::dex::TradeOptions::new().limit(5);
//! dex.trade(
//!   "bsc_mainnet",
//!   "pancakeswap",
//!   "0xb24cd29e32FaCDDf9e73831d5cD1FFcd1e535423",
//!   trade_options
//! );
//! ```
//!
//! ## Links
//!
//! - [Official Website](https://datamaxiplus.com/)
//! - [Documentation](https://docs.datamaxiplus.com/)
//!
//! ## Contributing
//!
//! We welcome contributions!
//! If you discover a bug in this project, please feel free to open an issue to discuss the changes you would like to propose.
//!
//! ## License
//!
//![MIT License](./LICENSE)

/// API definitions and related utilities.
pub mod api;

/// CEX-related data fetcher and data structures.
///
/// This module provides functionality related to centralized exchange (CEX) data.
/// It includes data structures and methods for retrieving candle data, as well as information about supported exchanges, symbols and intervals.
///
/// # Usage
///
/// The `Candle` struct is the primary interface for interacting with the CEX data.
/// It provides methods for retrieving data with optional parameters to filter and sort the results.
///
/// ## Example
///
/// ```rust
/// let config = datamaxi::api::Config {
///     base_url: None,
///     api_key: "my_api_key".to_string(),
/// };
/// let client = datamaxi::api::Client::new(config);
/// let candle = datamaxi::cex::Candle { client: client.clone() };
///
/// // Retrieve supported exchanges
/// let exchanges = candle.exchanges("spot");
///
/// // Retrieve supported intervals
/// let intervals = candle.intervals();
///
/// // Retrieve supported Binance symbols
/// let symbols_options = datamaxi::cex::SymbolsOptions::new();
/// let symbols = candle.symbols("binance", symbols_options);
///
/// // Retrieve candle data
/// let candle_options = datamaxi::cex::CandleOptions::new().interval("1h").market("spot");
/// let candle_data = candle.get("binance", "BTC-USDT", candle_options);
/// ```
///
/// # Error Handling
///
/// All methods return a `Result` type, which should be handled appropriately to manage potential errors.
pub mod cex;

/// 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
///
/// ```rust
/// 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.
pub mod dex;

/// Data models representing API responses and optional parameters.
pub mod models;