ccxt-rust 0.1.5

Cryptocurrency exchange trading library in Rust
Documentation
//! Binance Margin Borrow Example
//!
//! Note: Margin borrow methods are not yet migrated to the new modular structure.
//! This is a placeholder example.
//!
//! # Running the Example
//!
//! ```bash
//! cargo run --example binance_margin_borrow_example
//! ```

use ccxt_core::ExchangeConfig;
use ccxt_exchanges::binance::Binance;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("=================================");
    println!("Binance Margin Borrow 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)?;

    // Note: Margin borrow methods are not yet migrated to the new modular structure:
    // - borrow_margin
    // - repay_margin
    // - fetch_borrow_interest

    println!("Note: Margin borrow 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#"
// Borrow margin
let result = binance.borrow_margin(
    "BTC",       // Asset
    0.1,         // Amount
    "BTC/USDT",  // Symbol
    None,        // Optional parameters
).await?;

// Repay margin
let result = binance.repay_margin(
    "BTC",       // Asset
    0.1,         // Amount
    "BTC/USDT",  // Symbol
    None,        // Optional parameters
).await?;

// Fetch borrow interest
let interests = binance.fetch_borrow_interest(
    Some("BTC"),  // Asset filter
    None,         // Symbol filter
    None,         // Since timestamp
    Some(10),     // Limit
    None,         // Optional parameters
).await?;
"#
    );

    println!("\n=================================");
    println!("Example completed!");
    println!("=================================");

    Ok(())
}