pub struct AccountManager {
pub client: Client,
pub recv_window: u16,
}Fields§
§client: Client§recv_window: u16Implementations§
Source§impl AccountManager
impl AccountManager
Sourcepub async fn get_wallet_balance(
&self,
account: &str,
coin: Option<&str>,
) -> Result<WalletResponse, BybitError>
pub async fn get_wallet_balance( &self, account: &str, coin: Option<&str>, ) -> Result<WalletResponse, BybitError>
Sourcepub async fn upgrade_to_uta(&self) -> Result<UTAResponse, BybitError>
pub async fn upgrade_to_uta(&self) -> Result<UTAResponse, BybitError>
Upgrades the current account to UTA.
This function sends a POST request to the Bybit API to upgrade the current account to UTA (Unified Trading Account). It awaits the response and returns the result.
§Returns
A result containing the UTA response or an error.
Sourcepub async fn get_borrow_history<'b>(
&self,
req: BorrowHistoryRequest<'_>,
) -> Result<BorrowHistoryResponse, BybitError>
pub async fn get_borrow_history<'b>( &self, req: BorrowHistoryRequest<'_>, ) -> Result<BorrowHistoryResponse, BybitError>
Retrieves the borrow history for the current account.
This function sends a signed GET request to the Bybit API to retrieve the borrow history for
the current account. The request can be filtered by the coin and start_time parameters.
The response is deserialized into the BorrowHistoryResponse struct.
The await? operator awaits the response and returns an error if the request fails.
§Arguments
req- ABorrowHistoryRequeststruct containing the parameters for the request.
§Returns
A result containing the borrow history response or an error.
Sourcepub async fn repay_liability(
&self,
coin: Option<&str>,
) -> Result<RepayLiabilityResponse, BybitError>
pub async fn repay_liability( &self, coin: Option<&str>, ) -> Result<RepayLiabilityResponse, BybitError>
Sourcepub async fn set_collateral_coin(
&self,
coin: &str,
switch: bool,
) -> Result<SetCollateralCoinResponse, BybitError>
pub async fn set_collateral_coin( &self, coin: &str, switch: bool, ) -> Result<SetCollateralCoinResponse, BybitError>
Sourcepub async fn batch_set_collateral(
&self,
requests: Vec<(&str, bool)>,
) -> Result<BatchSetCollateralCoinResponse, BybitError>
pub async fn batch_set_collateral( &self, requests: Vec<(&str, bool)>, ) -> Result<BatchSetCollateralCoinResponse, BybitError>
Sourcepub async fn get_collateral_info(
&self,
coin: Option<&str>,
) -> Result<CollateralInfoResponse, BybitError>
pub async fn get_collateral_info( &self, coin: Option<&str>, ) -> Result<CollateralInfoResponse, BybitError>
Sourcepub async fn get_fee_rate(
&self,
category: Category,
symbol: Option<String>,
) -> Result<FeeRateResponse, BybitError>
pub async fn get_fee_rate( &self, category: Category, symbol: Option<String>, ) -> Result<FeeRateResponse, BybitError>
Retrieves the fee rate for a given market category and symbol.
§Arguments
category- The market category to fetch the fee rate from.symbol- The trading symbol to fetch the fee rate for. If not specified, the fee rate for all symbols in the category is returned.
§Returns
A result containing the fee rate response or an error.
Sourcepub async fn get_account_info(&self) -> Result<AccountInfoResponse, BybitError>
pub async fn get_account_info(&self) -> Result<AccountInfoResponse, BybitError>
Retrieves the account information for the current account.
This function sends a signed GET request to the Bybit API to retrieve the account information.
The response is deserialized into the AccountInfoResponse struct.
The await? operator awaits the response and returns an error if the request fails.
§Returns
A result containing the account information response or an error.
Sourcepub async fn get_transaction_log<'b>(
&self,
req: TransactionLogRequest<'_>,
) -> Result<TransactionLogResponse, BybitError>
pub async fn get_transaction_log<'b>( &self, req: TransactionLogRequest<'_>, ) -> Result<TransactionLogResponse, BybitError>
Retrieves the transaction log for the current account.
This function sends a signed GET request to the Bybit API to retrieve the transaction log.
The request parameters are serialized into a JSON object and sent in the request body.
The response is deserialized into the TransactionLogResponse struct.
The await? operator awaits the response and returns an error if the request fails.
§Arguments
req- An instance ofTransactionLogRequestcontaining the request parameters.
§Returns
A result containing the transaction log response or an error.
Sourcepub async fn get_smp_id(&self) -> Result<SmpResponse, BybitError>
pub async fn get_smp_id(&self) -> Result<SmpResponse, BybitError>
Retrieves the Server-Market-Portfolio (SMP) group ID for the current user.
§Returns
A result containing the SMP response or an error.
Sourcepub async fn set_margin_mode(
&self,
margin_mode: &str,
) -> Result<SetMarginModeResponse, BybitError>
pub async fn set_margin_mode( &self, margin_mode: &str, ) -> Result<SetMarginModeResponse, BybitError>
Sourcepub async fn set_spot_hedging(
&self,
spot_hedging: bool,
) -> Result<SpotHedgingResponse, BybitError>
pub async fn set_spot_hedging( &self, spot_hedging: bool, ) -> Result<SpotHedgingResponse, BybitError>
Trait Implementations§
Source§impl Bybit for AccountManager
impl Bybit for AccountManager
Source§fn new(api_key: Option<String>, secret_key: Option<String>) -> AccountManager
fn new(api_key: Option<String>, secret_key: Option<String>) -> AccountManager
Source§fn new_with_config(
config: &Config,
api_key: Option<String>,
secret_key: Option<String>,
) -> AccountManager
fn new_with_config( config: &Config, api_key: Option<String>, secret_key: Option<String>, ) -> AccountManager
Source§impl Clone for AccountManager
impl Clone for AccountManager
Source§fn clone(&self) -> AccountManager
fn clone(&self) -> AccountManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more