Skip to main content

oanda_rs/
lib.rs

1//! # oanda-rs
2//!
3//! An asynchronous Rust SDK for the [OANDA v20 REST and streaming
4//! API](https://developer.oanda.com/rest-live-v20/introduction/), designed
5//! for multi-threaded tokio environments.
6//!
7//! - **One shared client** — [`Client`] is cheap to clone and `Send + Sync`;
8//!   all clones share a connection pool and a built-in rate limiter that
9//!   keeps you under OANDA's per-IP limits (120 REST requests/s, 2 new
10//!   connections/s).
11//! - **Typed models** — every request/response type derives `Debug`,
12//!   `Serialize` and `Deserialize`, with decimals as
13//!   [`rust_decimal::Decimal`] newtypes (never floats).
14//! - **Streaming** — pricing and transaction streams are self-managing:
15//!   they detect stale connections via heartbeats, reconnect with capped
16//!   exponential backoff, and back-fill missed transactions.
17//!
18//! ## Quickstart
19//!
20//! ```no_run
21//! use oanda_rs::{Client, Environment};
22//!
23//! # async fn run() -> Result<(), oanda_rs::Error> {
24//! let client = Client::new(Environment::Practice, std::env::var("OANDA_TOKEN").unwrap());
25//! # Ok(())
26//! # }
27//! ```
28//!
29//! This is an unofficial SDK; use the Practice environment until you are
30//! confident in your integration. See the repository's `docs/` directory
31//! for guides on streaming, rate limiting and testing.
32
33#![deny(missing_docs)]
34#![deny(rustdoc::broken_intra_doc_links)]
35
36mod client;
37mod error;
38mod rate_limit;
39mod transport;
40
41pub mod endpoints;
42pub mod models;
43pub mod prelude;
44pub mod streaming;
45
46pub use client::{Client, ClientBuilder, Environment};
47pub use error::{ApiErrorBody, Error};