binance/spot/
url.rs

1/// For APIs that only send public market data
2pub const BASE_URL_API_DATA: &str = "https://data-api.binance.vision";
3pub const BASE_URL_API: &str = "https://api.binance.com";
4pub const BASE_URL_API_GCP: &str = "https://api-gcp.binance.com";
5pub const BASE_URL_API1: &str = "https://api1.binance.com";
6pub const BASE_URL_API2: &str = "https://api2.binance.com";
7pub const BASE_URL_API3: &str = "https://api3.binance.com";
8pub const BASE_URL_API4: &str = "https://api4.binance.com";
9
10pub const BASE_URL_STREAM_DATA1: &str = "wss://data-stream.binance.vision:9443";
11pub const BASE_URL_STREAM_DATA2: &str = "wss://data-stream.binance.vision:443";
12
13pub enum Path {
14    // General endpoints.
15    Ping,
16    Time,
17    ExchangeInfo,
18
19    // Market Data endpoints.
20    Depth,
21    Trades,
22    HistoricalTrades,
23    AggTrades,
24    KLines,
25    UIKLines,
26    AvgPrice,
27    Ticker24hr,
28    TickerTradingDay,
29    TickerPrice,
30    TickerBook,
31    Ticker,
32
33    // Trading endpoints
34    Order,
35    OrderTest,
36    OpenOrders,
37    OrderCancelReplace,
38    OrderAmendKeepPriority,
39    OrderListOCO,
40    OrderListOTO,
41    OrderListOTOCO,
42    OrderList,
43    SOROrder,
44    SOROrderTest,
45
46    RateLimitOrder,
47}
48
49impl std::fmt::Display for Path {
50    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
51        let s = match self {
52            // General endpoints.
53            Self::Ping => "/api/v3/ping",
54            Self::Time => "/api/v3/time",
55            Self::ExchangeInfo => "/api/v3/exchangeInfo",
56
57            // Market Data endpoints.
58            Self::Depth => "/api/v3/depth",
59            Self::Trades => "/api/v3/trades",
60            Self::HistoricalTrades => "/api/v3/historicalTrades",
61            Self::AggTrades => "/api/v3/aggTrades",
62            Self::KLines => "/api/v3/klines",
63            Self::UIKLines => "/api/v3/uiKlines",
64            Self::AvgPrice => "/api/v3/avgPrice",
65            Self::Ticker24hr => "/api/v3/ticker/24hr",
66            Self::TickerTradingDay => "/api/v3/ticker/tradingDay",
67            Self::TickerPrice => "/api/v3/ticker/price",
68            Self::TickerBook => "/api/v3/ticker/bookTicker",
69            Self::Ticker => "/api/v3/ticker",
70
71            // Trading endpoints
72            Self::Order => "/api/v3/order",
73            Self::OrderTest => "/api/v3/order/test",
74            Self::OpenOrders => "/api/v3/openOrders",
75            Self::OrderCancelReplace => "/api/v3/order/cancelReplace",
76            Self::OrderAmendKeepPriority => "/api/v3/order/amend/keepPriority",
77            Self::OrderListOCO => "/api/v3/orderList/oco",
78            Self::OrderListOTO => "/api/v3/orderList/oto",
79            Self::OrderListOTOCO => "/api/v3/orderList/otoco",
80            Self::OrderList => "/api/v3/orderList",
81            Self::SOROrder => "/api/v3/sor/order",
82            Self::SOROrderTest => "/api/v3/sor/order/test",
83
84            Self::RateLimitOrder => "/api/v3/rateLimit/order",
85        };
86
87        write!(f, "{}", s)
88    }
89}
90
91// TODO: X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter)
92pub const HEADER_RETRY_AFTER: &str = "Retry-After";
93pub const HEADER_X_MBX_APIKEY: &str = "X-MBX-APIKEY";