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
//! # oxarchive
//!
//! Rust client library for the [0xArchive](https://0xarchive.io) API.
//!
//! Query historical and real-time crypto market data — orderbooks, trades,
//! candles, funding rates, open interest, and liquidations across Hyperliquid,
//! Lighter.xyz, and HIP-3.
//!
//! ## Quick start
//!
//! ```no_run
//! use oxarchive::OxArchive;
//!
//! #[tokio::main]
//! async fn main() -> oxarchive::Result<()> {
//! let client = OxArchive::new("your-api-key")?;
//!
//! // Get BTC orderbook from Hyperliquid
//! let ob = client.hyperliquid.orderbook.get("BTC", None).await?;
//! println!("BTC mid price: {:?}", ob.mid_price);
//!
//! // List Lighter.xyz instruments
//! let instruments = client.lighter.instruments.list().await?;
//! println!("Lighter has {} instruments", instruments.len());
//!
//! // Get current funding rate
//! let funding = client.hyperliquid.funding.current("ETH").await?;
//! println!("ETH funding: {}", funding.funding_rate);
//!
//! Ok(())
//! }
//! ```
//!
//! ## Pagination
//!
//! Historical endpoints return [`CursorResponse`] with an optional
//! `next_cursor`. Pass it back as the `cursor` parameter to fetch the
//! next page:
//!
//! ```no_run
//! # use oxarchive::{OxArchive, types::CursorResponse};
//! # use oxarchive::resources::trades::GetTradesParams;
//! # async fn example() -> oxarchive::Result<()> {
//! # let client = OxArchive::new("key")?;
//! let mut all_trades = vec![];
//! let mut cursor = None;
//!
//! loop {
//! let result = client.hyperliquid.trades.list("BTC", GetTradesParams {
//! start: 1704067200000_i64.into(),
//! end: 1704153600000_i64.into(),
//! cursor,
//! limit: Some(1000),
//! side: None,
//! }).await?;
//!
//! all_trades.extend(result.data);
//! cursor = result.next_cursor;
//! if cursor.is_none() {
//! break;
//! }
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ## WebSocket (optional)
//!
//! Enable the `websocket` feature for real-time streaming, historical replay,
//! and bulk data download:
//!
//! ```toml
//! oxarchive = { version = "1.3", features = ["websocket"] }
//! ```
// Re-export the main entry points at the crate root.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;