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
extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate serde;
extern crate serde_json;
extern crate tokio;
extern crate url;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate failure;
extern crate chrono;
extern crate hex;
#[macro_use]
extern crate lazy_static;
extern crate log;
extern crate ring;
extern crate tokio_tungstenite;
extern crate tungstenite;
extern crate uuid;

mod client;
mod consts;
mod error;
pub mod model;
mod transport;

pub use client::websocket::BitMEXWebsocket;
pub use client::BitMEX;

pub use error::Result;
use failure::Error;
use futures::{Future, IntoFuture};

pub const API_VERSION: &str = "1.2.0";
pub const SWAGGER_URL: &str = "https://www.bitmex.com/api/explorer/swagger.json";

pub fn check_version() -> impl Future<Item = bool, Error = Error> {
    let resp = transport::Transport::new().get_swagger().into_future().flatten();
    resp.map(|desc| desc.info.version == API_VERSION)
}