pub struct RestApi { /* private fields */ }Implementations§
Source§impl RestApi
impl RestApi
pub fn new(configuration: ConfigurationRestApi) -> Self
Sourcepub async fn send_request<R: DeserializeOwned + Send + 'static>(
&self,
endpoint: &str,
method: Method,
query_params: BTreeMap<String, Value>,
body_params: BTreeMap<String, Value>,
) -> Result<RestApiResponse<R>>
pub async fn send_request<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, method: Method, query_params: BTreeMap<String, Value>, body_params: BTreeMap<String, Value>, ) -> Result<RestApiResponse<R>>
Send an unsigned request to the API
§Arguments
endpoint- The API endpoint to send the request tomethod- The HTTP method to use for the requestquery_params- A map of query parameters to send with the requestbody_params- A map of body parameters to send with the request
§Returns
A RestApiResponse containing the deserialized response data on success, or an error if the request fails
§Errors
Returns an anyhow::Error if the HTTP request fails or if parsing the response fails
Sourcepub async fn send_signed_request<R: DeserializeOwned + Send + 'static>(
&self,
endpoint: &str,
method: Method,
query_params: BTreeMap<String, Value>,
body_params: BTreeMap<String, Value>,
) -> Result<RestApiResponse<R>>
pub async fn send_signed_request<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, method: Method, query_params: BTreeMap<String, Value>, body_params: BTreeMap<String, Value>, ) -> Result<RestApiResponse<R>>
Send a signed request to the API
§Arguments
endpoint- The API endpoint to send the request tomethod- The HTTP method to use for the requestquery_params- A map of query parameters to send with the requestbody_params- A map of body parameters to send with the request
§Returns
A RestApiResponse containing the deserialized response data on success, or an error if the request fails
§Errors
Returns an anyhow::Error if the HTTP request fails or if parsing the response fails
Sourcepub async fn aggregated_trades(
&self,
params: AggregatedTradesParams,
) -> Result<RestApiResponse<AggregatedTradesResponse>>
pub async fn aggregated_trades( &self, params: AggregatedTradesParams, ) -> Result<RestApiResponse<AggregatedTradesResponse>>
Aggregated Trades
Retrieves compressed, aggregated historical trades for a specific symbol. Useful for recent trade history.
Weight: 0
§Arguments
params:AggregatedTradesParamsThe parameters for this operation.
§Returns
RestApiResponse<models::AggregatedTradesResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn get_exchange_info(
&self,
) -> Result<RestApiResponse<GetExchangeInfoResponse>>
pub async fn get_exchange_info( &self, ) -> Result<RestApiResponse<GetExchangeInfoResponse>>
Get Exchange Info
Fetches general exchange information, such as supported symbols, rate limits, and server time.
Weight: 0
§Arguments
params: [GetExchangeInfoParams] The parameters for this operation.
§Returns
RestApiResponse<models::GetExchangeInfoResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn klines(
&self,
params: KlinesParams,
) -> Result<RestApiResponse<KlinesResponse>>
pub async fn klines( &self, params: KlinesParams, ) -> Result<RestApiResponse<KlinesResponse>>
Klines (Candlestick Data)
Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and volume over intervals. Useful for charting and analysis.
Weight: 0
§Arguments
params:KlinesParamsThe parameters for this operation.
§Returns
RestApiResponse<models::KlinesResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn ticker(
&self,
params: TickerParams,
) -> Result<RestApiResponse<TickerResponse>>
pub async fn ticker( &self, params: TickerParams, ) -> Result<RestApiResponse<TickerResponse>>
Ticker (24hr Price Statistics)
Gets the 24-hour rolling window price change statistics for a symbol, including volume and price changes.
Weight: 0
§Arguments
params:TickerParamsThe parameters for this operation.
§Returns
RestApiResponse<models::TickerResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn token_list(&self) -> Result<RestApiResponse<TokenListResponse>>
pub async fn token_list(&self) -> Result<RestApiResponse<TokenListResponse>>
Token List
Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this to find the token ID for constructing symbols in other endpoints.
Weight: 0
§Arguments
params: [TokenListParams] The parameters for this operation.
§Returns
RestApiResponse<models::TokenListResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.