#![allow(unused_imports)] use std::collections::HashMap;
use bitcoin_de::bitcoin_de_trading_api_sdk_v4::TradingApiSdkV4;
use bitcoin_de::bitcoin_de_trading_api_sdk_v4::method_settings::constants::{
METHOD_SHOW_ACCOUNT_INFO, METHOD_SHOW_RATES, SHOW_RATES_PARAMETER_TRADING_PAIR};
use bitcoin_de::enums::TradingPair::*;
use std::env;
#[cfg(feature = "cmdline")]
use {tokio, clap::Parser, dotenv::dotenv};
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
#[arg(long = "api-key")]
api_key: Option<String>,
#[arg(long = "api-secret")]
api_secret: Option<String>,
}
#[cfg(feature = "cmdline")]
#[tokio::main]
async fn main() {
dotenv().ok();
let args = Args::parse();
let api_key = args.api_key
.or_else(|| env::var("API_KEY").ok())
.expect("API_KEY must be set either via --api-key argument or API_KEY environment variable");
let api_secret = args.api_secret
.or_else(|| env::var("API_SECRET").ok())
.expect("API_SECRET must be set either via --api-secret argument or API_SECRET environment variable");
let trading_api_sdk = TradingApiSdkV4::new(api_key, api_secret);
println!("\n>>> Calling showAccountInfo...");
let account_info_result = trading_api_sdk.show_account_info();
match account_info_result.await {
Ok(response) => println!("showAccountInfo successful Response: {:?}", response),
Err(e) => eprintln!("Error during showAccountInfo: {}", e),
}
println!("\n>>> Calling showRates...");
let show_rates_result = trading_api_sdk.show_rates(BTCEUR);
match show_rates_result.await {
Ok(response) => println!("showRates successful Response: {:?}", response),
Err(e) => eprintln!("Error during showRates: {}", e),
}
}