Skip to main content

binance_common/spot/endpoint/
route.rs

1pub enum General {
2    Ping,
3    ServerTime,
4    ExchangeInfo,
5}
6
7impl AsRef<str> for General {
8    fn as_ref(&self) -> &'static str {
9        match self {
10            General::Ping => "/api/v3/ping?",
11            General::ServerTime => "/api/v3/time?",
12            General::ExchangeInfo => "/api/v3/exchangeInfo?",
13        }
14    }
15}
16
17pub enum Market {
18    Depth,
19    Trades,
20    HistoricalTrades,
21    AggTrades,
22    Klines,
23    UIKlines,
24    AvgPrice,
25    Ticker24h,
26    TickerDay,
27    TickerPrice,
28    BookTicker,
29    RollingTicker,
30}
31
32impl AsRef<str> for Market {
33    fn as_ref(&self) -> &'static str {
34        match self {
35            Market::Depth => "/api/v3/depth?",
36            Market::Trades => "/api/v3/trades?",
37            Market::HistoricalTrades => "/api/v3/historicalTrades?",
38            Market::AggTrades => "/api/v3/aggTrades?",
39            Market::Klines => "/api/v3/klines?",
40            Market::UIKlines => "/api/v3/uiKlines?",
41            Market::AvgPrice => "/api/v3/avgPrice?",
42            Market::Ticker24h => "/api/v3/ticker/24hr?",
43            Market::TickerDay => "/api/v3/ticker/tradingDay?",
44            Market::TickerPrice => "/api/v3/ticker/price?",
45            Market::BookTicker => "/api/v3/ticker/bookTicker?",
46            Market::RollingTicker => "/api/v3/ticker?",
47        }
48    }
49}
50
51pub enum Trade {
52    NewOrder,
53    TestOrder,
54    GetOrder,
55    CancelOrder,
56    CancelAllOrders,
57    CancelReplaceOrder,
58    AmendOrderPriority,
59    OpenOrders,
60    AllOrders,
61    OcoOrderList,
62    OtoOrderList,
63    OtocoOrderList,
64    GetOrderList,
65    AllOrderLists,
66    OpenOrderLists,
67    SorOrder,
68    TestSorOrder,
69}
70
71impl AsRef<str> for Trade {
72    fn as_ref(&self) -> &'static str {
73        match self {
74            Trade::NewOrder => "/api/v3/order?",
75            Trade::TestOrder => "/api/v3/order/test?",
76            Trade::GetOrder => "/api/v3/order?",
77            Trade::CancelOrder => "/api/v3/order?",
78            Trade::CancelAllOrders => "/api/v3/openOrders?",
79            Trade::CancelReplaceOrder => "/api/v3/order/cancelReplace?",
80            Trade::AmendOrderPriority => "/api/v3/order/amend/keepPriority?",
81            Trade::OpenOrders => "/api/v3/openOrders?",
82            Trade::AllOrders => "/api/v3/allOrders?",
83            Trade::OcoOrderList => "/api/v3/orderList/oco?",
84            Trade::OtoOrderList => "/api/v3/orderList/oto?",
85            Trade::OtocoOrderList => "/api/v3/orderList/otoco?",
86            Trade::GetOrderList => "/api/v3/orderList?",
87            Trade::AllOrderLists => "/api/v3/allOrderList?",
88            Trade::OpenOrderLists => "/api/v3/openOrderList?",
89            Trade::SorOrder => "/api/v3/sor/order?",
90            Trade::TestSorOrder => "/api/v3/sor/order/test?",
91        }
92    }
93}
94
95pub enum Account {
96    Info,
97    MyTrades,
98    UnfilledOrderCount,
99    PreventedMatches,
100    Allocations,
101    CommissionRates,
102    Amendments,
103}
104
105impl AsRef<str> for Account {
106    fn as_ref(&self) -> &'static str {
107        match self {
108            Account::Info => "/api/v3/account?",
109            Account::MyTrades => "/api/v3/myTrades?",
110            Account::UnfilledOrderCount => "/api/v3/rateLimit/order?",
111            Account::PreventedMatches => "/api/v3/myPreventedMatches?",
112            Account::Allocations => "/api/v3/myAllocations?",
113            Account::CommissionRates => "/api/v3/account/commission?",
114            Account::Amendments => "/api/v3/order/amendments?",
115        }
116    }
117}