pub struct ApiKeyPair { /* private fields */ }Implementations§
Source§impl ApiKeyPair
impl ApiKeyPair
Sourcepub fn new(profile_name: String, key: String, secret: String) -> ApiKeyPair
pub fn new(profile_name: String, key: String, secret: String) -> ApiKeyPair
Examples found in repository?
examples/account_example.rs (line 15)
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let api_key = env::var("BYBIT_API_KEY").unwrap_or_else(|_| "YOUR_API_KEY".to_string());
9 let api_secret = env::var("BYBIT_API_SECRET").unwrap_or_else(|_| "YOUR_API_SECRET".to_string());
10
11 // Using testnet by default
12 let base_url = "https://api-testnet.bybit.com".to_string();
13
14 // ApiKeyPair takes (profile_name, key, secret)
15 let key_pair = ApiKeyPair::new("account_demo".to_string(), api_key, api_secret);
16 let client = RestClient::new(key_pair, base_url, true);
17
18 // AccountClient takes ownership of RestClient
19 let account_client = AccountClient::new(client);
20
21 println!("--- Testing get_wallet_balance ---");
22 let params = GetWalletBalanceParams {
23 account_type: AccountType::UNIFIED,
24 coin: None,
25 };
26
27 match account_client.get_wallet_balance(params).await {
28 Ok(response) => println!("Success: {:?}", response),
29 Err(e) => println!("Error: {:?}", e),
30 }
31
32 println!("\n--- Testing get_fee_rate ---");
33 match account_client.get_fee_rate("spot", None, None).await {
34 Ok(response) => println!("Success: {:?}", response),
35 Err(e) => println!("Error: {:?}", e),
36 }
37
38 Ok(())
39}pub fn profile_name(&self) -> &str
pub fn key(&self) -> &str
pub fn secret(&self) -> &str
Trait Implementations§
Source§impl Clone for ApiKeyPair
impl Clone for ApiKeyPair
Source§fn clone(&self) -> ApiKeyPair
fn clone(&self) -> ApiKeyPair
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApiKeyPair
impl Debug for ApiKeyPair
Source§impl<'de> Deserialize<'de> for ApiKeyPair
impl<'de> Deserialize<'de> for ApiKeyPair
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ApiKeyPair
impl RefUnwindSafe for ApiKeyPair
impl Send for ApiKeyPair
impl Sync for ApiKeyPair
impl Unpin for ApiKeyPair
impl UnwindSafe for ApiKeyPair
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more