bybit_rust_api/lib.rs
1//! # Bybit Rust API
2//!
3//! A comprehensive and type-safe Rust SDK for the Bybit API V5.
4//!
5//! This library provides a clean and easy-to-use interface for interacting with
6//! Bybit's exchange, supporting Market Data, Trading, Account management,
7//! Position management, and more.
8//!
9//! ## Quick Start
10//!
11//! ```rust,no_run
12//! use bybit_rust_api::{ApiKeyPair, Category, MarketClient, RestClient};
13//!
14//! #[tokio::main]
15//! async fn main() -> anyhow::Result<()> {
16//! let api_key_pair = ApiKeyPair::new("env".to_string(), "".to_string(), "".to_string());
17//! let rest_client = RestClient::new(api_key_pair, "https://api.bybit.com".to_string());
18//! let market_client = MarketClient::new(rest_client);
19//!
20//! let server_time = market_client.get_server_time().await?;
21//! println!("Server time: {:?}", server_time.result);
22//! Ok(())
23//! }
24//! ```
25
26pub mod consts;
27pub mod handlers;
28pub mod rest;
29pub mod utils;
30
31// Re-export commonly used types at the top level
32pub use rest::{
33 AccountClient, AnnouncementsClient, ApiKeyPair, AssetClient, BrokerClient, CryptoLoanClient,
34 InstitutionalLoanClient, MarketClient, OrderClient, PositionClient, PreUpgradeClient,
35 RestClient, ServerResponse, SpotLeverageTokenClient, SpotMarginTradeClient, UserClient,
36};
37
38// Re-export common enums directly for convenience
39pub use rest::enums::{CancelType, Category, Interval, OrderStatus, OrderType, Side, TimeInForce};
40
41// Organized sub-modules for easier exploration
42pub mod enums {
43 pub use crate::rest::enums::*;
44}
45
46pub mod dto {
47 pub use crate::rest::account::dto::*;
48 pub use crate::rest::market::dto::*;
49 pub use crate::rest::order::dto::*;
50}