exc_binance/http/request/
instrument.rs

1use crate::http::error::RestError;
2
3use super::{Rest, RestEndpoint};
4
5/// Exchange info.
6#[derive(Debug, Clone, Copy, Default)]
7pub struct ExchangeInfo;
8
9impl Rest for ExchangeInfo {
10    fn method(&self, _endpoint: &RestEndpoint) -> Result<http::Method, RestError> {
11        Ok(http::Method::GET)
12    }
13
14    fn to_path(&self, endpoint: &RestEndpoint) -> Result<String, RestError> {
15        match endpoint {
16            RestEndpoint::UsdMarginFutures => Ok("/fapi/v1/exchangeInfo".to_string()),
17            RestEndpoint::Spot(_) => Ok("/api/v3/exchangeInfo".to_string()),
18            RestEndpoint::EuropeanOptions => Ok("/eapi/v1/exchangeInfo".to_string()),
19        }
20    }
21
22    fn to_payload(&self) -> super::Payload {
23        super::Payload::new(*self)
24    }
25}