fxoanda/
lib.rs

1//! This is an unofficial [Oanda](https://wwww.oanda.com/) API client. This client is still
2//! an experimental work in progress however it is reasonably functional.
3//!
4//! The client is generated from the Oanda V20 API definitions. The current state of the client
5//! API is low-level but usable however I would like to see a more ergonomic layer developed on
6//! top.
7//!
8//! # Installation
9//!
10//! ```bash
11//! $ cargo add fxoanda
12//! ```
13//!
14//! # Example usage
15//!
16//! ```
17//! use std::env;
18//! use fxoanda::*;
19//!
20//! #[tokio::main]
21//! async fn main() {
22//!     let api_key = env::var("OANDA_KEY").expect("expected OANDA_KEY environment variable to be set");
23//!     let api_host = env::var("OANDA_HOST").expect("expected OANDA_HOST environment variable to be set");
24//!
25//!     let client = fxoanda::Client {
26//!         host: String::from(api_host),
27//!         reqwest: reqwest::Client::new(),
28//!         authentication: String::from(api_key),
29//!     };
30//!     match fxoanda::GetInstrumentCandlesRequest::new()
31//!         .with_instrument("EUR_USD".to_string())
32//!         .with_granularity(CandlestickGranularity::H4)
33//!         .remote(&client).await
34//!     {
35//!         Ok(x) => println!("OK: {:#?}", x),
36//!         Err(e) => eprintln!("ERR: {:#?}", e),
37//!     };
38//! }
39//! ```
40//!
41//! # Warning
42//!
43//! Forex markets are extremely risky. Automated trading is also extremely risky.
44//! This project is extremely risky. Market conditions, news events, or software bugs
45//! can wipe out your account in an instant.
46//!
47//! # Disclaimer
48//!
49//! Use this project at your own risk. The maintainers of this project make no
50//! claims as to this product being fit for purpose. In fact, the maintainers of this
51//! project are telling you that you shouldn't use this project.
52//!
53
54#![crate_type = "lib"]
55#[allow(unused_imports)]
56#[macro_use]
57extern crate serde_derive;
58//#[macro_use]
59extern crate serde;
60//#[macro_use]
61extern crate chrono;
62extern crate fxoanda_definitions;
63extern crate fxoanda_serdes;
64extern crate serde_json;
65extern crate time;
66
67pub mod account;
68pub mod client;
69pub mod instrument;
70pub mod pricing;
71pub use self::account::*;
72pub use self::client::*;
73pub use self::instrument::*;
74pub use self::pricing::*;
75pub use fxoanda_definitions::*;
76pub use fxoanda_serdes::*;