use ccxt_core::ExchangeConfig;
use ccxt_exchanges::binance::Binance;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("=================================");
println!("Binance Deposit/Withdrawal Example");
println!("=================================\n");
let config = ExchangeConfig {
api_key: std::env::var("BINANCE_API_KEY")
.ok()
.map(ccxt_core::SecretString::new),
secret: std::env::var("BINANCE_API_SECRET")
.ok()
.map(ccxt_core::SecretString::new),
..Default::default()
};
let _binance = Binance::new(config)?;
println!(
"Note: Deposit and withdrawal methods are not yet migrated to the new modular structure."
);
println!(" See rest_old.rs for the original implementations.\n");
println!("Code examples (not executable until methods are migrated):");
println!(
r#"
// Fetch deposits (using i64 timestamps)
let deposits = binance.fetch_deposits(
Some("BTC"), // Currency filter
None, // Since timestamp (Option<i64> - milliseconds since Unix epoch)
Some(100), // Limit
None, // Optional parameters
).await?;
// Fetch withdrawals (using i64 timestamps)
let withdrawals = binance.fetch_withdrawals(
Some("USDT"), // Currency filter
None, // Since timestamp (Option<i64> - milliseconds since Unix epoch)
Some(100), // Limit
None, // Optional parameters
).await?;
// Withdraw
let result = binance.withdraw(
"USDT", // Currency
100.0, // Amount
"0x1234...", // Address
None, // Tag (for some currencies)
None, // Optional parameters
).await?;
"#
);
println!("\n=================================");
println!("Example completed!");
println!("=================================");
Ok(())
}