Struct bpx_api_client::BpxClient
source · pub struct BpxClient {
pub verifier: VerifyingKey,
pub client: Client,
/* private fields */
}Fields§
§verifier: VerifyingKey§client: ClientImplementations§
source§impl BpxClient
impl BpxClient
pub async fn get_balances(&self) -> Result<HashMap<String, Balance>>
pub async fn get_deposits( &self, limit: Option<i64>, offset: Option<i64> ) -> Result<Vec<Deposit>>
pub async fn get_deposit_address( &self, blockchain: Blockchain ) -> Result<DepositAddress>
pub async fn get_withdrawals( &self, limit: Option<i64>, offset: Option<i64> ) -> Result<Vec<Withdrawal>>
pub async fn request_withdrawal( &self, payload: RequestWithdrawalPayload ) -> Result<()>
source§impl BpxClient
impl BpxClient
pub async fn get_assets(&self) -> Result<HashMap<String, Vec<Token>>>
pub async fn get_markets(&self) -> Result<Vec<Market>>
pub async fn get_ticker(&self, symbol: &str) -> Result<Vec<Ticker>>
pub async fn get_order_book_depth(&self, symbol: &str) -> Result<OrderBookDepth>
pub async fn get_k_lines( &self, symbol: &str, kline_interval: &str, start_time: Option<i64>, end_time: Option<i64> ) -> Result<Vec<Kline>>
source§impl BpxClient
impl BpxClient
pub async fn get_open_order( &self, symbol: &str, order_id: Option<&str>, client_id: Option<u32> ) -> Result<Order>
pub async fn execute_order(&self, payload: ExecuteOrderPayload) -> Result<Order>
pub async fn cancel_order( &self, symbol: &str, order_id: Option<&str>, client_id: Option<u32> ) -> Result<Order>
pub async fn get_open_orders(&self, symbol: Option<&str>) -> Result<Vec<Order>>
pub async fn cancel_open_orders( &self, payload: CancelOpenOrdersPayload ) -> Result<Vec<Order>>
source§impl BpxClient
impl BpxClient
pub async fn request_two_factor( &self, payload: RequestTwoFactorPayload ) -> Result<RequestTwoFactorResponse>
source§impl BpxClient
impl BpxClient
sourcepub fn init(
base_url: String,
api_key: &str,
api_secret: &str,
headers: Option<HeaderMap>
) -> Result<Self>
pub fn init( base_url: String, api_key: &str, api_secret: &str, headers: Option<HeaderMap> ) -> Result<Self>
pub async fn get<U: IntoUrl>(&self, url: U) -> Result<Response>
pub async fn post<P: Serialize, U: IntoUrl>( &self, url: U, payload: P ) -> Result<Response>
pub async fn delete<P: Serialize, U: IntoUrl>( &self, url: U, payload: P ) -> Result<Response>
Methods from Deref<Target = Client>§
sourcepub fn get<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn get<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a GET request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
sourcepub fn post<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn post<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a POST request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
sourcepub fn put<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn put<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a PUT request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
sourcepub fn patch<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn patch<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a PATCH request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
sourcepub fn delete<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn delete<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a DELETE request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
sourcepub fn head<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn head<U>(&self, url: U) -> RequestBuilderwhere
U: IntoUrl,
Convenience method to make a HEAD request to a URL.
§Errors
This method fails whenever the supplied Url cannot be parsed.
sourcepub fn request<U>(&self, method: Method, url: U) -> RequestBuilderwhere
U: IntoUrl,
pub fn request<U>(&self, method: Method, url: U) -> RequestBuilderwhere
U: IntoUrl,
Start building a Request with the Method and Url.
Returns a RequestBuilder, which will allow setting headers and
the request body before sending.
§Errors
This method fails whenever the supplied Url cannot be parsed.
sourcepub fn execute(
&self,
request: Request
) -> impl Future<Output = Result<Response, Error>>
pub fn execute( &self, request: Request ) -> impl Future<Output = Result<Response, Error>>
Executes a Request.
A Request can be built manually with Request::new() or obtained
from a RequestBuilder with RequestBuilder::build().
You should prefer to use the RequestBuilder and
RequestBuilder::send().
§Errors
This method fails if there was an error while sending request, redirect loop was detected or redirect limit was exhausted.