binance/lib.rs
1//! [![github]](https://github.com/Igosuki/binance-rs-async) [![crates-io]](https://crates.io/Igosuki/binance-rs-async) [![docs-rs]](https://docs.rs/binance-rs-async)
2//!
3//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
4//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
5//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
6//!
7//! <br>
8//!
9//! This library provides access to all of Binance's APIs using .
10//! [`tokio`]: <https://docs.rs/tokio/latest/tokio/>
11//!
12//! <br>
13//!
14//! # Risk Warning
15//!
16//! It is a personal project, use at your own risk. I will not be responsible for your investment losses.
17//! Cryptocurrency investment is subject to high market risk.
18//! Nonetheless, this crate is aimed at high performance and production use.
19//!
20//! # Example
21//!
22//! This example simply pings the main binance api
23//!
24//! ```rust
25//! # use std::io;
26//! use binance::general::General;
27//! use binance::api::Binance;
28//! use binance::errors::Error as BinanceLibError;
29//!
30//! #[tokio::main]
31//! async fn main() -> std::io::Result<()> {
32//! let general: General = Binance::new(None, None);
33//! let ping = general.ping().await;
34//! match ping {
35//! Ok(answer) => println!("{:?}", answer),
36//! Err(err) => {
37//! match err {
38//! BinanceLibError::BinanceError { response } => match response.code {
39//! -1000_i32 => println!("An unknown error occured while processing the request"),
40//! _ => println!("Unknown code {}: {}", response.code, response.msg),
41//! },
42//! _ => println!("Other errors: {}.", err),
43//! };
44//! }
45//! }
46//! Ok(())
47//! }
48//! ```
49//!
50//! <br>
51//!
52//! # Details
53//!
54//! - Credentials are not enforced, you will get authentication errors if you don't provide
55//! credentials and they are required by an endpoint
56//!
57//! - Error codes are handled on a best effort basis as some are inconsistent and not even
58//! documented on Binance's side
59//!
60//! - Errors are implemented using [![thiserror]](https://docs.rs/thiserror/1.0.25/thiserror/)
61//!
62
63#![deny(unstable_features, unused_must_use, unused_mut, unused_imports, unused_import_braces)]
64
65// #[macro_use]
66extern crate lazy_static;
67#[macro_use]
68extern crate serde;
69extern crate serde_qs as qs;
70
71pub use util::bool_to_string;
72pub use util::bool_to_string_some;
73
74mod client;
75pub mod errors;
76pub mod util;
77
78pub mod account;
79pub mod api;
80pub mod config;
81#[cfg(feature = "futures_api")]
82pub mod futures;
83pub mod general;
84#[cfg(feature = "margin_api")]
85pub mod margin;
86pub mod market;
87pub mod rest_model;
88#[cfg(feature = "savings_api")]
89pub mod savings;
90pub mod userstream;
91#[cfg(feature = "wallet_api")]
92pub mod wallet;
93pub mod websockets;
94pub mod ws_model;